From dfb6f7a45fd275ee6d91cef2c4e1cc4abeeace22 Mon Sep 17 00:00:00 2001 From: anamontiaga Date: Mon, 15 Jan 2024 21:03:26 +0100 Subject: [PATCH] recover print button and hide legend --- src/containers/map/index.tsx | 27 +++++++++++++++++---------- src/containers/widgets/index.tsx | 10 ++++++---- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/src/containers/map/index.tsx b/src/containers/map/index.tsx index 2da2285e0..dad158a1b 100644 --- a/src/containers/map/index.tsx +++ b/src/containers/map/index.tsx @@ -16,6 +16,7 @@ import { interactiveLayerIdsAtom, mapCursorAtom, } from 'store/map'; +import { printModeState } from 'store/print-mode'; import { useQueryClient } from '@tanstack/react-query'; import turfBbox from '@turf/bbox'; @@ -81,6 +82,8 @@ const MapContainer = ({ mapId }: { mapId: string }) => { const [locationBounds, setLocationBounds] = useRecoilState(locationBoundsAtom); const [URLBounds, setURLBounds] = useRecoilState(URLboundsAtom); const [cursor, setCursor] = useRecoilState(mapCursorAtom); + const isPrintingMode = useRecoilValue(printModeState); + console.log({ isPrintingMode }); const [, setAnalysisState] = useRecoilState(analysisAtom); const guideIsActive = useRecoilValue(activeGuideAtom); @@ -416,16 +419,20 @@ const MapContainer = ({ mapId }: { mapId: string }) => { )} - -
- -
-
- -
- -
-
+ {!isPrintingMode && ( + <> + +
+ +
+
+ +
+ +
+
+ + )} ); }; diff --git a/src/containers/widgets/index.tsx b/src/containers/widgets/index.tsx index 904cf4b0c..a12af82a6 100644 --- a/src/containers/widgets/index.tsx +++ b/src/containers/widgets/index.tsx @@ -2,7 +2,7 @@ import { useCallback, useMemo } from 'react'; import cn from 'lib/classnames'; -import { drawingToolAtom } from 'store/drawing-tool'; +import { drawingToolAtom, drawingUploadToolAtom } from 'store/drawing-tool'; import { mapSettingsAtom } from 'store/map-settings'; import { printModeState } from 'store/print-mode'; import { locationToolAtom } from 'store/sidebar'; @@ -39,7 +39,9 @@ const WidgetsContainer: React.FC = () => { const setPrintingMode = useSetRecoilState(printModeState); - const { customGeojson, uploadedGeojson } = useRecoilValue(drawingToolAtom); + const { enabled: drawingToolEnabled } = useRecoilValue(drawingToolAtom); + const { enabled: drawingUploadToolEnabled } = useRecoilValue(drawingUploadToolAtom); + const mapSettings = useRecoilValue(mapSettingsAtom); const locationTool = useRecoilValue(locationToolAtom); @@ -222,9 +224,9 @@ const WidgetsContainer: React.FC = () => { className={cn({ [BUTTON_STYLES]: true, 'm-auto bg-brand-800 text-white': true, - hidden: !customGeojson && !uploadedGeojson, + hidden: drawingToolEnabled || drawingUploadToolEnabled, })} - disabled={!customGeojson && !uploadedGeojson} + disabled={drawingToolEnabled || drawingUploadToolEnabled} onClick={onClickDownload} > Download report as PDF