Skip to content

Commit

Permalink
feat: add salary summary content
Browse files Browse the repository at this point in the history
  • Loading branch information
2nthony committed Apr 2, 2024
1 parent 5cc9cad commit 13d8e97
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/next-common/components/fellowship/salary/common.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import ListLayout from "next-common/components/layout/ListLayout";
import FellowshipSalarySummary from "./summary";
import FellowshipSummaryActions from "../core/summary/actions";

export default function FellowshipSalaryCommon({ children, ...props }) {
const title = "Fellowship Salary";
Expand All @@ -11,6 +13,8 @@ export default function FellowshipSalaryCommon({ children, ...props }) {
seoInfo={seoInfo}
title={title}
description={seoInfo.desc}
summary={<FellowshipSalarySummary />}
summaryFooter={<FellowshipSummaryActions />}
tabs={[
{
label: "Cycles",
Expand Down
34 changes: 34 additions & 0 deletions packages/next-common/components/fellowship/salary/summary.jsx
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} />;
}

0 comments on commit 13d8e97

Please sign in to comment.