From c639e5dc808e83b0f8afb99b9acc63b4f4e37376 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Gonz=C3=A1lez?= Date: Mon, 11 Mar 2024 15:54:30 +0100 Subject: [PATCH] adds scroll to PU form in small viewports --- .../planning-unit-status/actions/index.tsx | 47 +++---- .../grid-setup/planning-unit-status/index.tsx | 119 ++++++++---------- 2 files changed, 78 insertions(+), 88 deletions(-) diff --git a/app/layout/project/sidebar/scenario/grid-setup/planning-unit-status/actions/index.tsx b/app/layout/project/sidebar/scenario/grid-setup/planning-unit-status/actions/index.tsx index 94213c0c67..6f6ae20877 100644 --- a/app/layout/project/sidebar/scenario/grid-setup/planning-unit-status/actions/index.tsx +++ b/app/layout/project/sidebar/scenario/grid-setup/planning-unit-status/actions/index.tsx @@ -11,6 +11,7 @@ import { useSaveScenarioPU } from 'hooks/scenarios'; import { useToasts } from 'hooks/toast'; import Select from 'components/forms/select'; +import { ScrollArea } from 'components/scroll-area'; import ActionsSummary from 'layout/project/sidebar/scenario/grid-setup/planning-unit-status/actions-summary'; import DrawPUMethod from './draw'; @@ -107,8 +108,8 @@ export const PlanningUnitMethods = () => { }, }, { - onSuccess: ({ data: { meta } }) => { - dispatch(setJob(new Date(meta.isoDate).getTime())); + onSuccess: ({ data }) => { + dispatch(setJob(new Date(data.meta.isoDate).getTime())); dispatch(setTmpPuExcludedValue([])); dispatch(setTmpPuIncludedValue([])); @@ -186,26 +187,30 @@ export const PlanningUnitMethods = () => {
- - {(fprops) => ( - { + form.change('pu-method', value); + }} + /> + )} + + {values['pu-method'] === 'select' && } + {values['pu-method'] === 'draw' && } + {values['pu-method'] === 'upload' && } + + + ); }} diff --git a/app/layout/project/sidebar/scenario/grid-setup/planning-unit-status/index.tsx b/app/layout/project/sidebar/scenario/grid-setup/planning-unit-status/index.tsx index bb3da904a3..22ba5b7ad6 100644 --- a/app/layout/project/sidebar/scenario/grid-setup/planning-unit-status/index.tsx +++ b/app/layout/project/sidebar/scenario/grid-setup/planning-unit-status/index.tsx @@ -6,8 +6,6 @@ import { useAppDispatch, useAppSelector } from 'store/hooks'; import { getScenarioEditSlice } from 'store/slices/scenarios/edit'; import { PUAction } from 'store/slices/scenarios/types'; -import { motion } from 'framer-motion'; - import { useCanEditScenario } from 'hooks/permissions'; import { useScenarioPU } from 'hooks/scenarios'; @@ -70,73 +68,60 @@ export const GridSetupPlanningUnits = (): JSX.Element => { }, [dispatch, setLayerSettings]); return ( - -
-
- Grid Setup -
-

Planning Unit Status

- - <> -

- Locked-in and locked-out planning units -

-
-

- You can force Marxan to include or exclude some planning units from your - analysis. -

-

- Manually including or excluding individual planning units is useful when a - real-world issue affects where new protected areas can be designated. For - example, if you know that a particular planning unit contains a restricted - military area and cannot be designated, then you could manually exclude that - planning unit from the project. -

-

- You can see the example below where a city is marked as locked-out and a - protected area is marked as locked-in: -

- Feature-Range -

- The areas selected to be included will be locked in - to your conservation plan and will appear in all of the solutions. -

-

- The areas selected to be excluded will be locked out - of your conservation plan and will never appear in the solutions -

-
- -
-
-
- -
- -
- -
-
- {editable && } - {/* // todo: I think this part should be updated in terms of UI */} - {!editable && ( -
- {(puAction as PUAction) === 'include' &&

{PUData.included.length} PU

} - {(puAction as PUAction) === 'exclude' &&

{PUData.excluded.length} PU

} - {(puAction as PUAction) === 'available' &&

{PUData.available.length} PU

} +
+
+ Grid Setup +
+

Planning Unit Status

+ + <> +

+ Locked-in and locked-out planning units +

+
+

+ You can force Marxan to include or exclude some planning units from your analysis. +

+

+ Manually including or excluding individual planning units is useful when a + real-world issue affects where new protected areas can be designated. For example, + if you know that a particular planning unit contains a restricted military area + and cannot be designated, then you could manually exclude that planning unit from + the project. +

+

+ You can see the example below where a city is marked as locked-out and a protected + area is marked as locked-in: +

+ Feature-Range +

+ The areas selected to be included will be locked in + to your conservation plan and will appear in all of the solutions. +

+

+ The areas selected to be excluded will be locked out + of your conservation plan and will never appear in the solutions +

- )} -
+ + +
+
+ +
+ +
+ + {editable && } + {/* // todo: I think this part should be updated in terms of UI */} + {!editable && ( +
+ {(puAction as PUAction) === 'include' &&

{PUData.included.length} PU

} + {(puAction as PUAction) === 'exclude' &&

{PUData.excluded.length} PU

} + {(puAction as PUAction) === 'available' &&

{PUData.available.length} PU

}
-
-
+ )} + ); };