From 327f6bc8065a43df3f1a252f1eaa0ff029ecbbc5 Mon Sep 17 00:00:00 2001 From: Limber Mamani <154026979+LimberHope@users.noreply.github.com> Date: Tue, 21 Jan 2025 14:14:43 -0400 Subject: [PATCH] [TM-1626] add conditional to show trees to be planted (#816) * [TM-1626] add conditional to show trees to be planted * [TM-1626] update snapshot --- .../Inputs/TreeSpeciesInput/TreeSpeciesInput.tsx | 9 +++++++-- .../__snapshots__/TreeSpeciesInput.stories.storyshot | 8 ++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/components/elements/Inputs/TreeSpeciesInput/TreeSpeciesInput.tsx b/src/components/elements/Inputs/TreeSpeciesInput/TreeSpeciesInput.tsx index 4187c8b11..cb9b7aed2 100644 --- a/src/components/elements/Inputs/TreeSpeciesInput/TreeSpeciesInput.tsx +++ b/src/components/elements/Inputs/TreeSpeciesInput/TreeSpeciesInput.tsx @@ -77,6 +77,7 @@ const TreeSpeciesInput = (props: TreeSpeciesInputProps) => { const handleBaseEntityTrees = props.withPreviousCounts && (isReport || (isEntity && ["sites", "nurseries"].includes(entityName))); const displayPreviousCounts = props.withPreviousCounts && isReport; + const hasCountActive = props.withNumbers; const entity = (handleBaseEntityTrees ? entityName : undefined) as EstablishmentEntityType; const uuid = handleBaseEntityTrees ? entityUuid : undefined; @@ -303,10 +304,14 @@ const TreeSpeciesInput = (props: TreeSpeciesInputProps) => {
- {isReport ? t("TOTAL PLANTED THIS REPORT:") : t("TREES TO BE PLANTED:")} + {isReport ? t("TOTAL PLANTED THIS REPORT:") : hasCountActive ? t("TREES TO BE PLANTED:") : ""} - {props.withNumbers ? props.value.reduce((total, v) => total + (v.amount || 0), 0).toLocaleString() : "0"} + {hasCountActive + ? props.value.reduce((total, v) => total + (v.amount || 0), 0).toLocaleString() + : isReport + ? "0" + : ""}
diff --git a/src/components/elements/Inputs/TreeSpeciesInput/__snapshots__/TreeSpeciesInput.stories.storyshot b/src/components/elements/Inputs/TreeSpeciesInput/__snapshots__/TreeSpeciesInput.stories.storyshot index bd502d0a0..30e4e7fb6 100644 --- a/src/components/elements/Inputs/TreeSpeciesInput/__snapshots__/TreeSpeciesInput.stories.storyshot +++ b/src/components/elements/Inputs/TreeSpeciesInput/__snapshots__/TreeSpeciesInput.stories.storyshot @@ -105,15 +105,11 @@ exports[`Storyshots Components/Elements/Inputs/TreeSpeciesInput Default 1`] = `

- TREES TO BE PLANTED: -

+ />

- 0 -

+ />