From b29ae6e664bae8c5de379d578d750773db4f10a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Prod=27homme?= Date: Fri, 22 Nov 2024 09:03:45 +0100 Subject: [PATCH 1/2] feat(client): Add year chart for temporal layers --- client/package.json | 7 + client/src/components/dataset-card/index.tsx | 8 +- client/src/components/year-chart/index.tsx | 272 +++++++++++ client/src/hooks/use-year-chart-data.ts | 102 +++++ client/yarn.lock | 451 ++++++++++++++++++- 5 files changed, 838 insertions(+), 2 deletions(-) create mode 100644 client/src/components/year-chart/index.tsx create mode 100644 client/src/hooks/use-year-chart-data.ts diff --git a/client/package.json b/client/package.json index f94aba9..4f64393 100644 --- a/client/package.json +++ b/client/package.json @@ -43,6 +43,13 @@ "@turf/helpers": "7.1.0", "@turf/meta": "7.1.0", "@types/mapbox-gl": "3.4.0", + "@visx/axis": "3.12.0", + "@visx/gradient": "3.12.0", + "@visx/grid": "3.12.0", + "@visx/responsive": "3.12.0", + "@visx/scale": "3.12.0", + "@visx/shape": "3.12.0", + "@visx/text": "3.12.0", "apng-js": "1.1.4", "axios": "1.7.7", "class-variance-authority": "0.7.0", diff --git a/client/src/components/dataset-card/index.tsx b/client/src/components/dataset-card/index.tsx index f811411..47740ef 100644 --- a/client/src/components/dataset-card/index.tsx +++ b/client/src/components/dataset-card/index.tsx @@ -21,6 +21,7 @@ import { } from "@/components/ui/select"; import { Switch } from "@/components/ui/switch"; import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip"; +import YearChart from "@/components/year-chart"; import useMapLayers from "@/hooks/use-map-layers"; import { cn } from "@/lib/utils"; import CalendarDaysIcon from "@/svgs/calendar-days.svg"; @@ -315,8 +316,13 @@ const DatasetCard = ({ id, name, defaultLayerId, layers, metadata }: DatasetCard )} + {selectedDate !== undefined && selectedLayerId !== undefined && ( +
+ +
+ )} {selectedDate !== undefined && dateRange !== undefined && isDatasetActive && ( -
+