Skip to content

Commit 83b5e35

Browse files
egrojMonroycesarLima1dottyydiego-morales-flores-1996LimberHope
authored
[TM-3058] upload ANR plots (#2120)
* [TM-3058] upload ANR plots (#2107) * [TM-3058] start up connection for ANR plot geometry * [TM-3058] add new ANR tab in polygon sidebar * [TM-3058] add workflow with buttons * [TM-3058] Refactor PolygonDrawer and AnrMonitoringPlots components for improved layout and button styling * [TM-3058] add commentary box * [TM-3058] Implement AnrMonitoringPlots component with visibility toggle and delete confirmation modal * [TM-3058] update ANR icon * [TM-3058] use anr connection in component related * [TM-3058] remove comment * [TM-3058] changes null, uuids --------- Co-authored-by: JORGE <egrojmonroy@gmail.com> Co-authored-by: Dotty <dottykurmi123@gmail.com> Co-authored-by: diego-morales-flores-1996 <diego@vizonomy.com> * [TM-3059] ANR rendering (#2111) * [TM-3058] start up connection for ANR plot geometry * [TM-3058] add new ANR tab in polygon sidebar * [TM-3058] add workflow with buttons * [TM-3058] Refactor PolygonDrawer and AnrMonitoringPlots components for improved layout and button styling * [TM-3058] add commentary box * [TM-3058] Implement AnrMonitoringPlots component with visibility toggle and delete confirmation modal * [TM-3058] update ANR icon * [TM-3058] use anr connection in component related * [TM-3059] add layer on map with geojson data * [TM-3059] fix error when opening ANR option * [TM-3156] Add ButtonGroups (#2097) * [TM-3058] implement ButtonGroups * [TM-3156] implement ButtonGroups * [TM-3077] add panel component (#2093) * [TM-3077] add panel component * [TM-3077] fix breadcrumb * [TM-3077] Add FilterPanel component and associated Storybook stories for data display * [TM-3077] fix build --------- Co-authored-by: Dotty <dottykurmi123@gmail.com> * [TM-3077] tm design components panel (#2098) * [TM-3077] add panel component * [TM-3077] fix breadcrumb * [TM-3077] Add FilterPanel component and associated Storybook stories for data display * [TM-3077] fix build * [TM-3077] fix commentaries --------- Co-authored-by: Dotty <dottykurmi123@gmail.com> * [TM-3143] update the tree species title (#2100) * [TM-3172] Update cancel button functionality in ReportingTaskHeader to use MODALS_MAPPING * [TM-3150] remove save changes button (#2103) * [TM-3153] Modal content card (#2101) * [TM-3153] Modal content card * [TM-3153] Fix build * [TM-3153] fix on hover * Release/Zesty Zircon Hotfix 2026-03-23 (#2108) (#2109) * [TM-3176] Enhance edit entity handler to use singular entity name in confirmation messages * add new nursery types * [TM-3150] fix bottom nav buttons (#2105) --------- Co-authored-by: Marcolr-dev <marc.antoni.lr@gmail.com> Co-authored-by: Marcolr-dev <80992287+Marcolr-dev@users.noreply.github.com> * [TM-3130] Refactor icon imports and add new icons for Restoration & Land (#2110) * [TM-3058] remove comment * [TM-3059] remove comments * [TM-3058] changes null, uuids * [TM-3059] share mutable state and change some methods * [TM-3059] change mount effect --------- Co-authored-by: JORGE <egrojmonroy@gmail.com> Co-authored-by: Dotty <dottykurmi123@gmail.com> Co-authored-by: diego-morales-flores-1996 <diego@vizonomy.com> Co-authored-by: diego-morales-flores-1996 <139272044+diego-morales-flores-1996@users.noreply.github.com> Co-authored-by: Limber Mamani <154026979+LimberHope@users.noreply.github.com> Co-authored-by: Marcolr-dev <marc.antoni.lr@gmail.com> Co-authored-by: Marcolr-dev <80992287+Marcolr-dev@users.noreply.github.com> * [TM-3122] ANR plots as Project Developer (#2112) * [TM-3058] start up connection for ANR plot geometry * [TM-3058] add new ANR tab in polygon sidebar * [TM-3058] add workflow with buttons * [TM-3058] Refactor PolygonDrawer and AnrMonitoringPlots components for improved layout and button styling * [TM-3058] add commentary box * [TM-3058] Implement AnrMonitoringPlots component with visibility toggle and delete confirmation modal * [TM-3058] update ANR icon * [TM-3058] use anr connection in component related * [TM-3059] add layer on map with geojson data * [TM-3059] fix error when opening ANR option * [TM-3122] start adding anr plots in PD * [TM-3122] update overview side map are style * [TM-3122] update overview side map are style * [TM-3122] update overview side map are style * [TM-3122] disable buttons for non approved * [TM-3122] Enhance AttributeInformation component with new download button and icon * [TM-3156] Add ButtonGroups (#2097) * [TM-3058] implement ButtonGroups * [TM-3156] implement ButtonGroups * [TM-3077] add panel component (#2093) * [TM-3077] add panel component * [TM-3077] fix breadcrumb * [TM-3077] Add FilterPanel component and associated Storybook stories for data display * [TM-3077] fix build --------- Co-authored-by: Dotty <dottykurmi123@gmail.com> * [TM-3077] tm design components panel (#2098) * [TM-3077] add panel component * [TM-3077] fix breadcrumb * [TM-3077] Add FilterPanel component and associated Storybook stories for data display * [TM-3077] fix build * [TM-3077] fix commentaries --------- Co-authored-by: Dotty <dottykurmi123@gmail.com> * [TM-3143] update the tree species title (#2100) * [TM-3172] Update cancel button functionality in ReportingTaskHeader to use MODALS_MAPPING * [TM-3150] remove save changes button (#2103) * [TM-3153] Modal content card (#2101) * [TM-3153] Modal content card * [TM-3153] Fix build * [TM-3153] fix on hover * Release/Zesty Zircon Hotfix 2026-03-23 (#2108) (#2109) * [TM-3176] Enhance edit entity handler to use singular entity name in confirmation messages * add new nursery types * [TM-3150] fix bottom nav buttons (#2105) --------- Co-authored-by: Marcolr-dev <marc.antoni.lr@gmail.com> Co-authored-by: Marcolr-dev <80992287+Marcolr-dev@users.noreply.github.com> * [TM-3130] Refactor icon imports and add new icons for Restoration & Land (#2110) * [TM-3122] Restore ANRIcon.tsx (required by merged icon barrel) * [TM-3122] set grey color to layer * [TM-3058] remove comment * [TM-3059] remove comments * [TM-3122] change styles * [TM-3122] code improvements * [TM-3058] changes null, uuids * [TM-3059] share mutable state and change some methods * [TM-3122] Merge branch 'feat/TM-3059-ANR-rendering' into feat/TM-3122-anr-plots-pd * [TM-3122] fix the null check --------- Co-authored-by: cesarLima1 <cesmaulim@gmail.com> Co-authored-by: Dotty <dottykurmi123@gmail.com> Co-authored-by: diego-morales-flores-1996 <diego@vizonomy.com> Co-authored-by: diego-morales-flores-1996 <139272044+diego-morales-flores-1996@users.noreply.github.com> Co-authored-by: Limber Mamani <154026979+LimberHope@users.noreply.github.com> Co-authored-by: Marcolr-dev <marc.antoni.lr@gmail.com> Co-authored-by: Marcolr-dev <80992287+Marcolr-dev@users.noreply.github.com> * [TM-3061] clean cache for delete correct (#2123) * [TM-3058] start up connection for ANR plot geometry * [TM-3058] add new ANR tab in polygon sidebar * [TM-3058] add workflow with buttons * [TM-3058] Refactor PolygonDrawer and AnrMonitoringPlots components for improved layout and button styling * [TM-3058] add commentary box * [TM-3058] Implement AnrMonitoringPlots component with visibility toggle and delete confirmation modal * [TM-3058] update ANR icon * [TM-3058] use anr connection in component related * [TM-3059] add layer on map with geojson data * [TM-3059] fix error when opening ANR option * [TM-3122] start adding anr plots in PD * [TM-3122] update overview side map are style * [TM-3122] update overview side map are style * [TM-3122] update overview side map are style * [TM-3122] disable buttons for non approved * [TM-3122] Enhance AttributeInformation component with new download button and icon * [TM-3156] Add ButtonGroups (#2097) * [TM-3058] implement ButtonGroups * [TM-3156] implement ButtonGroups * [TM-3077] add panel component (#2093) * [TM-3077] add panel component * [TM-3077] fix breadcrumb * [TM-3077] Add FilterPanel component and associated Storybook stories for data display * [TM-3077] fix build --------- Co-authored-by: Dotty <dottykurmi123@gmail.com> * [TM-3077] tm design components panel (#2098) * [TM-3077] add panel component * [TM-3077] fix breadcrumb * [TM-3077] Add FilterPanel component and associated Storybook stories for data display * [TM-3077] fix build * [TM-3077] fix commentaries --------- Co-authored-by: Dotty <dottykurmi123@gmail.com> * [TM-3143] update the tree species title (#2100) * [TM-3172] Update cancel button functionality in ReportingTaskHeader to use MODALS_MAPPING * [TM-3150] remove save changes button (#2103) * [TM-3153] Modal content card (#2101) * [TM-3153] Modal content card * [TM-3153] Fix build * [TM-3153] fix on hover * Release/Zesty Zircon Hotfix 2026-03-23 (#2108) (#2109) * [TM-3176] Enhance edit entity handler to use singular entity name in confirmation messages * add new nursery types * [TM-3150] fix bottom nav buttons (#2105) --------- Co-authored-by: Marcolr-dev <marc.antoni.lr@gmail.com> Co-authored-by: Marcolr-dev <80992287+Marcolr-dev@users.noreply.github.com> * [TM-3130] Refactor icon imports and add new icons for Restoration & Land (#2110) * [TM-3122] Restore ANRIcon.tsx (required by merged icon barrel) * [TM-3122] set grey color to layer * [TM-3058] remove comment * [TM-3059] remove comments * [TM-3122] change styles * [TM-3122] code improvements * [TM-3058] changes null, uuids * [TM-3059] share mutable state and change some methods * [TM-3122] Merge branch 'feat/TM-3059-ANR-rendering' into feat/TM-3122-anr-plots-pd * [TM-3122] fix the null check * [TM-3061] clean cache for delete correct --------- Co-authored-by: cesarLima1 <cesmaulim@gmail.com> Co-authored-by: Dotty <dottykurmi123@gmail.com> Co-authored-by: diego-morales-flores-1996 <diego@vizonomy.com> Co-authored-by: diego-morales-flores-1996 <139272044+diego-morales-flores-1996@users.noreply.github.com> Co-authored-by: Limber Mamani <154026979+LimberHope@users.noreply.github.com> Co-authored-by: Marcolr-dev <marc.antoni.lr@gmail.com> Co-authored-by: Marcolr-dev <80992287+Marcolr-dev@users.noreply.github.com> --------- Co-authored-by: cesarLima1 <105736261+cesarLima1@users.noreply.github.com> Co-authored-by: Dotty <dottykurmi123@gmail.com> Co-authored-by: diego-morales-flores-1996 <diego@vizonomy.com> Co-authored-by: diego-morales-flores-1996 <139272044+diego-morales-flores-1996@users.noreply.github.com> Co-authored-by: Limber Mamani <154026979+LimberHope@users.noreply.github.com> Co-authored-by: Marcolr-dev <marc.antoni.lr@gmail.com> Co-authored-by: Marcolr-dev <80992287+Marcolr-dev@users.noreply.github.com> Co-authored-by: cesarLima1 <cesmaulim@gmail.com>
1 parent 2447e31 commit 83b5e35

28 files changed

Lines changed: 1899 additions & 362 deletions

File tree

src/admin/components/ResourceTabs/PolygonReviewTab/components/PolygonDrawer/PolygonDrawer.tsx

Lines changed: 199 additions & 104 deletions
Large diffs are not rendered by default.
Lines changed: 265 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,265 @@
1+
import Visibility from "@mui/icons-material/Visibility";
2+
import VisibilityOff from "@mui/icons-material/VisibilityOff";
3+
import { useT } from "@transifex/react";
4+
import { ChangeEvent, FC, useCallback, useEffect, useRef, useState } from "react";
5+
6+
import Button from "@/components/elements/Button/Button";
7+
import Text from "@/components/elements/Text/Text";
8+
import { IconNames } from "@/components/extensive/Icon/Icon";
9+
import ModalConfirm from "@/components/extensive/Modal/ModalConfirm";
10+
import { ModalId } from "@/components/extensive/Modal/ModalConst";
11+
import {
12+
deleteAnrPlotGeometry,
13+
upsertAnrPlotGeometryResource,
14+
useAnrPlotGeometry
15+
} from "@/connections/AnrPlotGeometry";
16+
import { useAnrMapOverlayOptional } from "@/context/anrMapOverlay.provider";
17+
import { useModalContext } from "@/context/modal.provider";
18+
import { useNotificationContext } from "@/context/notification.provider";
19+
import ApiSlice from "@/store/apiSlice";
20+
import Log from "@/utils/log";
21+
function getAnrPlotGeometryErrorMessage(error: unknown, fallback: string): string {
22+
if (error != null && typeof error === "object" && "message" in error) {
23+
try {
24+
const parsedMessage = JSON.parse((error as any).message as string);
25+
if (parsedMessage != null && typeof parsedMessage === "object" && "message" in parsedMessage) {
26+
return parsedMessage.message as string;
27+
}
28+
} catch {
29+
return (error as any).message as string;
30+
}
31+
}
32+
return fallback;
33+
}
34+
35+
const AnrMonitoringPlots: FC<{
36+
sitePolygonUuid: string;
37+
dataFetchEnabled?: boolean;
38+
}> = ({ sitePolygonUuid, dataFetchEnabled = true }) => {
39+
const t = useT();
40+
const { openModal, closeModal } = useModalContext();
41+
const { openNotification } = useNotificationContext();
42+
const uploadInputRef = useRef<HTMLInputElement>(null);
43+
const prevSitePolygonUuidRef = useRef<string | null>(null);
44+
const [plotsVisible, setPlotsVisible] = useState(true);
45+
const anrMapOverlay = useAnrMapOverlayOptional();
46+
const [isDeleting, setIsDeleting] = useState(false);
47+
const [isUploading, setIsUploading] = useState(false);
48+
49+
const [, { data: anrPlotGeometry, isLoading }] = useAnrPlotGeometry({
50+
sitePolygonUuid,
51+
enabled: sitePolygonUuid !== "" && dataFetchEnabled
52+
});
53+
54+
const hasAnrPlotGeometry = anrPlotGeometry?.geojson?.features != null;
55+
56+
useEffect(() => {
57+
if (sitePolygonUuid === "") {
58+
prevSitePolygonUuidRef.current = "";
59+
return;
60+
}
61+
const prev = prevSitePolygonUuidRef.current;
62+
if (prev != null && prev !== "" && prev !== sitePolygonUuid) {
63+
setPlotsVisible(false);
64+
}
65+
prevSitePolygonUuidRef.current = sitePolygonUuid ?? null;
66+
}, [sitePolygonUuid]);
67+
68+
useEffect(() => {
69+
if (anrMapOverlay == null) {
70+
return;
71+
}
72+
anrMapOverlay.setShowPlotsOnMap(plotsVisible);
73+
}, [anrMapOverlay, plotsVisible]);
74+
75+
const refreshAnrPlotGeometryAfterUpload = useCallback(() => {
76+
if (sitePolygonUuid == null) return;
77+
ApiSlice.pruneCache("anrPlotGeometries", [sitePolygonUuid]);
78+
ApiSlice.pruneCache("geojsonExports", [sitePolygonUuid]);
79+
}, [sitePolygonUuid]);
80+
81+
const refreshAnrPlotGeometryAfterDelete = useCallback(() => {
82+
if (sitePolygonUuid == null) return;
83+
ApiSlice.pruneCache("anrPlotGeometries", [sitePolygonUuid]);
84+
ApiSlice.pruneCache("geojsonExports", [sitePolygonUuid]);
85+
}, [sitePolygonUuid]);
86+
87+
const uploadAnrPlotGeometry = useCallback(async () => {
88+
if (sitePolygonUuid == null) {
89+
setIsUploading(false);
90+
return;
91+
}
92+
try {
93+
const file = uploadInputRef.current?.files?.[0];
94+
if (file == null) {
95+
setIsUploading(false);
96+
return;
97+
}
98+
await upsertAnrPlotGeometryResource(sitePolygonUuid, file);
99+
refreshAnrPlotGeometryAfterUpload();
100+
openNotification("success", t("Success!"), t("ANR monitoring plots uploaded successfully"));
101+
} catch (error) {
102+
refreshAnrPlotGeometryAfterUpload();
103+
const errorMessage = getAnrPlotGeometryErrorMessage(error, t("Error uploading ANR monitoring plots"));
104+
openNotification("error", t("Error!"), errorMessage);
105+
Log.error("Error uploading ANR monitoring plots", error);
106+
} finally {
107+
setIsUploading(false);
108+
if (uploadInputRef.current != null) {
109+
uploadInputRef.current.value = "";
110+
}
111+
}
112+
}, [openNotification, refreshAnrPlotGeometryAfterUpload, sitePolygonUuid, t]);
113+
114+
const onSelectGeoJsonFile = useCallback(
115+
async (event: ChangeEvent<HTMLInputElement>) => {
116+
const file = event.target.files?.[0];
117+
if (file == null) return;
118+
const hasGeoJsonExtension = file.name.toLowerCase().endsWith(".geojson");
119+
if (!hasGeoJsonExtension) {
120+
openNotification("error", t("Invalid file"), t("Please upload a .geojson file."));
121+
event.target.value = "";
122+
return;
123+
}
124+
setIsUploading(true);
125+
await uploadAnrPlotGeometry();
126+
},
127+
[openNotification, t, uploadAnrPlotGeometry]
128+
);
129+
130+
const openDeleteConfirmModal = useCallback(() => {
131+
openModal(
132+
ModalId.CONFIRM_ANR_MONITORING_PLOTS_DELETION,
133+
<ModalConfirm
134+
title={t("Delete ANR Monitoring Plots")}
135+
content={t("Are you sure you want to delete ANR monitoring plots for this polygon? This cannot be undone.")}
136+
onClose={() => closeModal(ModalId.CONFIRM_ANR_MONITORING_PLOTS_DELETION)}
137+
onConfirm={async () => {
138+
if (sitePolygonUuid == null) {
139+
closeModal(ModalId.CONFIRM_ANR_MONITORING_PLOTS_DELETION);
140+
return;
141+
}
142+
try {
143+
setIsDeleting(true);
144+
await deleteAnrPlotGeometry(sitePolygonUuid);
145+
refreshAnrPlotGeometryAfterDelete();
146+
openNotification("success", t("Success!"), t("ANR monitoring plots deleted successfully"));
147+
} catch (error) {
148+
refreshAnrPlotGeometryAfterDelete();
149+
const errorMessage = getAnrPlotGeometryErrorMessage(error, t("Error deleting ANR monitoring plots"));
150+
openNotification("error", t("Error!"), errorMessage);
151+
Log.error("Error deleting ANR monitoring plots", error);
152+
} finally {
153+
setIsDeleting(false);
154+
closeModal(ModalId.CONFIRM_ANR_MONITORING_PLOTS_DELETION);
155+
}
156+
}}
157+
/>
158+
);
159+
}, [closeModal, openModal, openNotification, refreshAnrPlotGeometryAfterDelete, sitePolygonUuid, t]);
160+
161+
const openUploadDialog = useCallback(() => {
162+
uploadInputRef.current?.click();
163+
}, []);
164+
165+
const geoJsonInput = (
166+
<input ref={uploadInputRef} type="file" accept=".geojson" className="hidden" onChange={onSelectGeoJsonFile} />
167+
);
168+
169+
if (sitePolygonUuid == null) {
170+
return (
171+
<div className="flex flex-col gap-3">
172+
<Text variant="text-14" className="text-gray-500">
173+
{t("ANR Monitoring Plots")}
174+
</Text>
175+
<Text variant="text-12" className="text-gray-400">
176+
{t("Select a polygon to view ANR monitoring plots.")}
177+
</Text>
178+
{geoJsonInput}
179+
</div>
180+
);
181+
}
182+
183+
if (!dataFetchEnabled) {
184+
return (
185+
<div className="flex flex-col gap-3">
186+
<Text variant="text-14" className="text-darkCustom">
187+
{t("ANR Monitoring Plots")}
188+
</Text>
189+
<Text variant="text-12" className="text-gray-500">
190+
{t(
191+
"ANR monitoring plots are only available for approved polygons that include Assisted Natural Regeneration as a restoration practice."
192+
)}
193+
</Text>
194+
</div>
195+
);
196+
}
197+
198+
if (isLoading || isUploading) {
199+
return (
200+
<div className="flex items-center justify-center p-4">
201+
<Text variant="text-14-light">{t("Loading ANR monitoring plots...")}</Text>
202+
</div>
203+
);
204+
}
205+
206+
if (hasAnrPlotGeometry) {
207+
return (
208+
<div className="flex flex-col gap-4">
209+
<div className="flex items-baseline justify-between gap-1.5">
210+
<Text variant="text-14-semibold" className="text-darkCustom">
211+
{t("Assisted Natural Regeneration Monitoring Plots")}
212+
</Text>
213+
<button
214+
type="button"
215+
className="group text-darkCustom"
216+
onClick={() => setPlotsVisible(prev => !prev)}
217+
aria-label={plotsVisible ? t("Hide ANR monitoring plots") : t("Show ANR monitoring plots")}
218+
>
219+
{plotsVisible ? (
220+
<Visibility sx={{ fontSize: 22 }} className="group-hover:text-primary-500" />
221+
) : (
222+
<VisibilityOff sx={{ fontSize: 22 }} className="group-hover:text-primary-500" />
223+
)}
224+
</button>
225+
</div>
226+
<Button
227+
onClick={openUploadDialog}
228+
variant="semi-black"
229+
iconProps={{ name: IconNames.UPLOAD_CLOUD_CUSTOM }}
230+
className="border-[1px]"
231+
disabled={isUploading}
232+
>
233+
<span className="text-12-bold normal-case text-darkCustom">{t("Replace ANR Monitoring Plots")}</span>
234+
</Button>
235+
<Button
236+
onClick={openDeleteConfirmModal}
237+
variant="semi-red"
238+
iconProps={{ name: IconNames.TRASH_PA }}
239+
className="border-[1px]"
240+
disabled={isDeleting}
241+
>
242+
<span className="text-12-bold normal-case text-darkCustom">{t("Delete ANR Monitoring Plots")}</span>
243+
</Button>
244+
{geoJsonInput}
245+
</div>
246+
);
247+
}
248+
249+
return (
250+
<div className="flex flex-col gap-4">
251+
<Text variant="text-14-semibold" className="text-darkCustom">
252+
{t("Assisted Natural Regeneration Monitoring Plots")}
253+
</Text>
254+
<Text variant="text-12-semibold" className="text-gray-500">
255+
{t("Upload ANR Monitoring Plots")}
256+
</Text>
257+
<Button onClick={openUploadDialog} variant="semi-black" iconProps={{ name: IconNames.UPLOAD_CLOUD_CUSTOM }}>
258+
<span className="text-12-bold normal-case text-darkCustom">{t("Upload")}</span>
259+
</Button>
260+
{geoJsonInput}
261+
</div>
262+
);
263+
};
264+
265+
export default AnrMonitoringPlots;

src/admin/components/ResourceTabs/PolygonReviewTab/components/PolygonDrawer/components/AttributeInformation.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ interface AttributeInformationProps {
2828
isLoadingVersions?: boolean;
2929
setSelectedPolygonToDrawer?: Dispatch<SetStateAction<{ id: string; status: string; label: string; uuid: string }>>;
3030
selectedPolygonIndex?: string;
31-
setPolygonFromMap: Dispatch<SetStateAction<{ isOpen: boolean; uuid: string }>>;
31+
setPolygonFromMap: Dispatch<SetStateAction<{ isOpen: boolean; uuid: string; source?: string }>>;
3232
setIsLoadingDropdownVersions: Dispatch<SetStateAction<boolean>>;
3333
setIsOpenPolygonDrawer: Dispatch<SetStateAction<boolean>>;
3434
}
@@ -155,7 +155,7 @@ const AttributeInformation = ({
155155
label: polygonActive?.name as string,
156156
uuid: polygonActive?.polygonUuid as string
157157
});
158-
setPolygonFromMap({ isOpen: true, uuid: polygonActive?.polygonUuid ?? "" });
158+
setPolygonFromMap({ isOpen: true, uuid: polygonActive?.polygonUuid ?? "", source: "drawer" });
159159
setStatusSelectedPolygon(polygonActive?.status ?? "");
160160
}
161161
setIsLoadingDropdownVersions(false);

src/admin/components/ResourceTabs/PolygonReviewTab/components/PolygonDrawer/components/VersionHistory.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ const VersionHistory = ({
5050
setStatusSelectedPolygon?: any;
5151
isLoadingDropdown: boolean;
5252
setIsLoadingDropdown: Dispatch<SetStateAction<boolean>>;
53-
setPolygonFromMap: Dispatch<SetStateAction<{ isOpen: boolean; uuid: string }>>;
53+
setPolygonFromMap: Dispatch<SetStateAction<{ isOpen: boolean; uuid: string; source?: string }>>;
5454
setSelectedPolygonToDrawer?: Dispatch<SetStateAction<{ id: string; status: string; label: string; uuid: string }>>;
5555
selectedPolygonIndex?: string;
5656
polygonFromMap?: { isOpen: boolean; uuid: string };
@@ -104,7 +104,7 @@ const VersionHistory = ({
104104
uuid: polygonData?.poly_id as string
105105
});
106106
}
107-
setPolygonFromMap({ isOpen: true, uuid: polygonData?.poly_id ?? "" });
107+
setPolygonFromMap({ isOpen: true, uuid: polygonData?.poly_id ?? "", source: "drawer" });
108108
if (setStatusSelectedPolygon != null) {
109109
setStatusSelectedPolygon(polygonData?.status ?? "");
110110
}
@@ -273,7 +273,7 @@ const VersionHistory = ({
273273
setStatusSelectedPolygon(newlyActiveVersion.status ?? "");
274274
}
275275

276-
setPolygonFromMap({ isOpen: true, uuid: polygonUuid ?? "" });
276+
setPolygonFromMap({ isOpen: true, uuid: polygonUuid ?? "", source: "drawer" });
277277
openNotification("success", "Success!", "Polygon version made active successfully");
278278
} catch (error) {
279279
openNotification("error", "Error!", "Error making polygon version active");

0 commit comments

Comments
 (0)