-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add salary summary content (#4077)
* feat: add salary summary content * remove actions * fix: salary server props * fix await
- Loading branch information
Showing
7 changed files
with
147 additions
and
106 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
34 changes: 34 additions & 0 deletions
34
packages/next-common/components/fellowship/salary/summary.jsx
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,34 @@ | ||
import { has, partition } from "lodash-es"; | ||
import Summary from "next-common/components/summary"; | ||
import { usePageProps } from "next-common/context/page"; | ||
|
||
export default function FellowshipSalarySummary() { | ||
const { fellowshipMembers, fellowshipSalaryClaimants } = usePageProps(); | ||
|
||
const [registeredClaimants] = partition( | ||
fellowshipSalaryClaimants, | ||
(claimant) => { | ||
return ( | ||
has(claimant?.status?.status, "registered") || | ||
has(claimant?.status?.status, "attempted") | ||
); | ||
}, | ||
); | ||
|
||
const items = [ | ||
{ | ||
title: "Claimants", | ||
content: fellowshipSalaryClaimants?.length || 0, | ||
}, | ||
{ | ||
title: "Registered", | ||
content: registeredClaimants.length, | ||
}, | ||
{ | ||
title: "Not Inducted", | ||
content: fellowshipMembers?.length - fellowshipSalaryClaimants?.length, | ||
}, | ||
]; | ||
|
||
return <Summary items={items} />; | ||
} |
39 changes: 39 additions & 0 deletions
39
packages/next-common/services/serverSide/fellowship/common.js
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,39 @@ | ||
import { withCommonProps } from "next-common/lib"; | ||
import { fetchOpenGovTracksProps } from "next-common/services/serverSide"; | ||
import nextApi from "next-common/services/nextApi"; | ||
import { | ||
fellowshipMembersApiUri, | ||
fellowshipParamsApi, | ||
fellowshipSalaryClaimantsApi, | ||
} from "next-common/services/url"; | ||
import { merge, noop } from "lodash-es"; | ||
|
||
export function withFellowshipSalaryCommonProps(fn = noop) { | ||
return withCommonProps(async (context) => { | ||
const [ | ||
tracksProps, | ||
{ result: fellowshipMembers }, | ||
{ result: fellowshipParams = {} }, | ||
{ result: fellowshipSalaryClaimants }, | ||
] = await Promise.all([ | ||
fetchOpenGovTracksProps(), | ||
nextApi.fetch(fellowshipMembersApiUri), | ||
nextApi.fetch(fellowshipParamsApi), | ||
nextApi.fetch(fellowshipSalaryClaimantsApi), | ||
]); | ||
|
||
const res = await fn?.(context); | ||
|
||
return merge( | ||
{ | ||
props: { | ||
...tracksProps, | ||
fellowshipMembers, | ||
fellowshipParams, | ||
fellowshipSalaryClaimants, | ||
}, | ||
}, | ||
res, | ||
); | ||
}); | ||
} |
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