From 68cedfa6a9765ce1457f016c52f2820167d4dd31 Mon Sep 17 00:00:00 2001 From: Tara Epp <102187683+taraepp@users.noreply.github.com> Date: Fri, 25 Oct 2024 19:28:37 +0000 Subject: [PATCH] simplify logic on enabling button --- .../dashboard/mine/projects/ProjectStagesTable.tsx | 12 ++++++------ .../__snapshots__/ProjectOverviewTab.spec.tsx.snap | 1 - 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/services/minespace-web/src/components/dashboard/mine/projects/ProjectStagesTable.tsx b/services/minespace-web/src/components/dashboard/mine/projects/ProjectStagesTable.tsx index 75b3476989..fea4496677 100644 --- a/services/minespace-web/src/components/dashboard/mine/projects/ProjectStagesTable.tsx +++ b/services/minespace-web/src/components/dashboard/mine/projects/ProjectStagesTable.tsx @@ -93,10 +93,10 @@ export const ProjectStagesTable: FC = ({ projectStages } if (record.project_stage === "IRT") { let buttonLabel: string; - let disableButton = Boolean(record.stage_status); + let enableButton = Boolean(record.stage_status); if (!record.stage_status) { buttonLabel = "Start"; - disableButton = !isProjectSummarySubmitted; + enableButton = isProjectSummarySubmitted; } else if (record.stage_status === "APV") { buttonLabel = "View"; } else { @@ -107,7 +107,7 @@ export const ProjectStagesTable: FC = ({ projectStages @@ -115,10 +115,10 @@ export const ProjectStagesTable: FC = ({ projectStages } if (record.project_stage === "Application") { let buttonLabel: string; - let disableButton = Boolean(record.stage_status); + let enableButton = Boolean(record.stage_status); if (!record.stage_status) { buttonLabel = "Start"; - disableButton = !isProjectSummarySubmitted; + enableButton = isProjectSummarySubmitted; } else if (["SUB", "UNR", "APV"].includes(record.stage_status)) { buttonLabel = "View"; } else { @@ -129,7 +129,7 @@ export const ProjectStagesTable: FC = ({ projectStages diff --git a/services/minespace-web/src/tests/components/project/projectOverviewTab/__snapshots__/ProjectOverviewTab.spec.tsx.snap b/services/minespace-web/src/tests/components/project/projectOverviewTab/__snapshots__/ProjectOverviewTab.spec.tsx.snap index a3f04e0d9c..c5139f0c55 100644 --- a/services/minespace-web/src/tests/components/project/projectOverviewTab/__snapshots__/ProjectOverviewTab.spec.tsx.snap +++ b/services/minespace-web/src/tests/components/project/projectOverviewTab/__snapshots__/ProjectOverviewTab.spec.tsx.snap @@ -338,7 +338,6 @@ exports[`ProjectOverviewTab renders properly 1`] = ` >