-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1125 from CruGlobal/8349-coaching-monthly-commitment
[MPDX-8349] Add monthly commitment average and goal
- Loading branch information
Showing
17 changed files
with
595 additions
and
169 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 6 additions & 2 deletions
8
pages/api/Schema/reports/pledgeHistories/pledgeHistories.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
src/components/Coaching/CoachingDetail/CoachingLink.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { render } from '@testing-library/react'; | ||
import { AccountListTypeEnum } from './CoachingDetail'; | ||
import { CoachingLink } from './CoachingLink'; | ||
|
||
describe('CoachingLink', () => { | ||
it('are hidden when viewing coaching account list', () => { | ||
const { queryByRole } = render( | ||
<CoachingLink accountListType={AccountListTypeEnum.Coaching} href="/page"> | ||
Page | ||
</CoachingLink>, | ||
); | ||
|
||
expect(queryByRole('link', { name: 'Page' })).not.toBeInTheDocument(); | ||
}); | ||
|
||
it('are shown when viewing own account list', async () => { | ||
const { getByRole } = render( | ||
<CoachingLink accountListType={AccountListTypeEnum.Own} href="/page"> | ||
Page | ||
</CoachingLink>, | ||
); | ||
|
||
expect(getByRole('link', { name: 'Page' })).toBeInTheDocument(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import NextLink from 'next/link'; | ||
import { Link, LinkProps as MuiLinkProps } from '@mui/material'; | ||
import { AccountListTypeEnum } from './CoachingDetail'; | ||
|
||
interface LinkProps extends MuiLinkProps { | ||
accountListType: AccountListTypeEnum; | ||
href: string; | ||
} | ||
|
||
/* | ||
* Component to show links when the account list belongs to the user and hide links when viewing a | ||
* coached account list. | ||
*/ | ||
export const CoachingLink: React.FC<LinkProps> = ({ | ||
accountListType, | ||
href, | ||
children, | ||
...props | ||
}) => | ||
accountListType === AccountListTypeEnum.Own ? ( | ||
<NextLink href={href} passHref> | ||
<Link {...props}>{children}</Link> | ||
</NextLink> | ||
) : ( | ||
<span>{children}</span> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.