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..ef7c5c3 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";
@@ -100,6 +101,18 @@ const DatasetCard = ({ id, name, defaultLayerId, layers, metadata }: DatasetCard
[layers, selectedLayerId],
);
+ const onToggleAnimation = useCallback(() => {
+ const newIsAnimated = !isAnimated;
+
+ if (newIsAnimated) {
+ dateBeforeAnimationRef.current = selectedDate !== undefined ? selectedDate : null;
+ } else {
+ dateBeforeAnimationRef.current = null;
+ }
+
+ setIsAnimated(newIsAnimated);
+ }, [selectedDate, isAnimated, setIsAnimated]);
+
const onToggleDataset = useCallback(
(active: boolean) => {
if (selectedLayerId === undefined) {
@@ -108,11 +121,22 @@ const DatasetCard = ({ id, name, defaultLayerId, layers, metadata }: DatasetCard
if (!active) {
removeLayer(selectedLayerId);
+ if (isAnimated) {
+ onToggleAnimation();
+ }
} else {
addLayer(selectedLayerId, { ["return-period"]: selectedReturnPeriod, date: selectedDate });
}
},
- [selectedLayerId, addLayer, removeLayer, selectedReturnPeriod, selectedDate],
+ [
+ selectedLayerId,
+ addLayer,
+ removeLayer,
+ selectedReturnPeriod,
+ selectedDate,
+ isAnimated,
+ onToggleAnimation,
+ ],
);
const onChangeSelectedLayer = useCallback(
@@ -183,18 +207,6 @@ const DatasetCard = ({ id, name, defaultLayerId, layers, metadata }: DatasetCard
[selectedLayerId, isDatasetActive, addLayer, updateLayer, layers, layersConfiguration],
);
- const onToggleAnimation = useCallback(() => {
- const newIsAnimated = !isAnimated;
-
- if (newIsAnimated) {
- dateBeforeAnimationRef.current = selectedDate !== undefined ? selectedDate : null;
- } else {
- dateBeforeAnimationRef.current = null;
- }
-
- setIsAnimated(newIsAnimated);
- }, [selectedDate, isAnimated, setIsAnimated]);
-
// When the layer is animated, show each month of the year in a loop
useEffect(() => {
if (isAnimated && selectedDate !== undefined && selectedLayerId !== undefined) {
@@ -315,8 +327,13 @@ const DatasetCard = ({ id, name, defaultLayerId, layers, metadata }: DatasetCard
)}
+ {selectedDate !== undefined && selectedLayerId !== undefined && (
+
+
+
+ )}
{selectedDate !== undefined && dateRange !== undefined && isDatasetActive && (
-
+