From 6db358cec54b5cec0a531826b42f57bcf672516e Mon Sep 17 00:00:00 2001 From: dinesh Date: Wed, 4 Nov 2026 16:27:13 -0700 Subject: [PATCH] project card default view for eao --- .../components/App/Projects/Project.test.tsx | 42 +++++++++++++++++++ .../src/components/App/Projects/Project.tsx | 6 +-- 2 files changed, 43 insertions(+), 5 deletions(-) diff --git a/submit-web/src/components/App/Projects/Project.test.tsx b/submit-web/src/components/App/Projects/Project.test.tsx index 05c9ad8f5..d7c46f3d6 100644 --- a/submit-web/src/components/App/Projects/Project.test.tsx +++ b/submit-web/src/components/App/Projects/Project.test.tsx @@ -194,3 +194,45 @@ describe("Project reports section gating", () => { expect(screen.queryByTestId("reports-card")).not.toBeInTheDocument(); }); }); + +describe("Project management plan section gating", () => { + const makeProjectWithoutManagementPlans = ( + hasApprovedCondition: boolean, + ): AccountProject => ({ + id: 1, + project_id: 1, + account_id: 1, + project: { + id: 1, + name: "Cariboo Gold Project", + proponent_id: 1, + epic_guid: "guid", + has_approved_condition: hasApprovedCondition, + }, + packages: [makePackage(10, SubmissionPackageType.REPORT)], + }); + + it("shows the management plan container for a proponent project with an approved condition and no management plans", () => { + setAccount([roleWith(USER_MANAGEMENT_ROLE.PROJECT_ADMIN)]); + render(); + expect(screen.getByTestId("mp-card")).toBeInTheDocument(); + }); + + it("shows the management plan container for a staff project with an approved condition and no management plans", () => { + setStaffAccount(); + render(); + expect(screen.getByTestId("mp-card")).toBeInTheDocument(); + }); + + it("hides the management plan container for a staff project without an approved condition", () => { + setStaffAccount(); + render(); + expect(screen.queryByTestId("mp-card")).not.toBeInTheDocument(); + }); + + it("hides the management plan container for a proponent project without an approved condition", () => { + setAccount([roleWith(USER_MANAGEMENT_ROLE.PROJECT_ADMIN)]); + render(); + expect(screen.queryByTestId("mp-card")).not.toBeInTheDocument(); + }); +}); diff --git a/submit-web/src/components/App/Projects/Project.tsx b/submit-web/src/components/App/Projects/Project.tsx index bfe887ab6..5347e99ac 100644 --- a/submit-web/src/components/App/Projects/Project.tsx +++ b/submit-web/src/components/App/Projects/Project.tsx @@ -93,11 +93,7 @@ export const Project = ({ accountProject }: ProjectParam) => { /> ); })} - {((is_proponent && accountProject.project.has_approved_condition) || - (!is_proponent && - accountProject.packages.some((pkg) => - MANAGEMENT_PLAN_RELATED_TYPES.includes(pkg.type.name), - ))) && ( + {accountProject.project.has_approved_condition && (