Skip to content

Commit

Permalink
recover print button and hide legend
Browse files Browse the repository at this point in the history
  • Loading branch information
anamontiaga committed Jan 15, 2024
1 parent e52cf5c commit dfb6f7a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 14 deletions.
27 changes: 17 additions & 10 deletions src/containers/map/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -416,16 +419,20 @@ const MapContainer = ({ mapId }: { mapId: string }) => {
</>
)}
</Map>
<Media lessThan="md">
<div className="absolute top-20">
<MobileLegend />
</div>
</Media>
<Media greaterThanOrEqual="md">
<div className="absolute bottom-9 right-18 z-50 mr-0.5 print:hidden">
<Legend />
</div>
</Media>
{!isPrintingMode && (
<>
<Media lessThan="md">
<div className="absolute top-20">
<MobileLegend />
</div>
</Media>
<Media greaterThanOrEqual="md">
<div className="absolute bottom-9 right-18 z-50 mr-0.5">
<Legend />
</div>
</Media>
</>
)}
</div>
);
};
Expand Down
10 changes: 6 additions & 4 deletions src/containers/widgets/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit dfb6f7a

Please sign in to comment.