From 2243643cd338f450d2cc68b67db78ededd6f239a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Gonz=C3=A1lez?= Date: Fri, 15 Mar 2024 12:00:46 +0100 Subject: [PATCH] adds info buttons to charts --- client/src/components/legend/item/info-modal.tsx | 2 +- .../deforestation-alerts/index.tsx | 12 +++++++++++- .../sourcing-info/chart/index.tsx | 13 ++++++++++++- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/client/src/components/legend/item/info-modal.tsx b/client/src/components/legend/item/info-modal.tsx index 24e11e5ec..8a193da17 100644 --- a/client/src/components/legend/item/info-modal.tsx +++ b/client/src/components/legend/item/info-modal.tsx @@ -4,7 +4,7 @@ import { useState } from 'react'; import Modal from 'components/modal/component'; export type InfoModalProps = { - info: { title: string; description: string; source: string | string[] }; + info: { title: string; description: string; source?: string | string[] }; }; const NO_DATA = 'No data available'; diff --git a/client/src/containers/analysis-eudr-detail/deforestation-alerts/index.tsx b/client/src/containers/analysis-eudr-detail/deforestation-alerts/index.tsx index c1e2257cc..c314aa1ad 100644 --- a/client/src/containers/analysis-eudr-detail/deforestation-alerts/index.tsx +++ b/client/src/containers/analysis-eudr-detail/deforestation-alerts/index.tsx @@ -8,6 +8,7 @@ import DeforestationAlertsChart from './chart'; import { useEUDRSupplier } from '@/hooks/eudr'; import { eudrDetail } from '@/store/features/eudr-detail'; import { useAppSelector } from '@/store/hooks'; +import InfoModal from '@/components/legend/item/info-modal'; const dateFormatter = (date: string) => format(new UTCDate(date), "do 'of' MMMM yyyy"); @@ -29,7 +30,16 @@ const DeforestationAlerts = (): JSX.Element => { return (
-

Deforestation alerts detected within the smallholders

+
+

Deforestation alerts detected within the smallholders

+ +
{data?.totalAlerts && (
There were {data?.totalAlerts} deforestation alerts diff --git a/client/src/containers/analysis-eudr-detail/sourcing-info/chart/index.tsx b/client/src/containers/analysis-eudr-detail/sourcing-info/chart/index.tsx index 7ab89f74a..7c9ec6892 100644 --- a/client/src/containers/analysis-eudr-detail/sourcing-info/chart/index.tsx +++ b/client/src/containers/analysis-eudr-detail/sourcing-info/chart/index.tsx @@ -20,6 +20,8 @@ import { useAppSelector } from '@/store/hooks'; import { eudrDetail } from '@/store/features/eudr-detail'; import { EUDR_COLOR_RAMP } from '@/utils/colors'; import { Badge } from '@/components/ui/badge'; +import InfoModal from '@/components/legend/item/info-modal'; +import InfoTooltip from '@/components/info-tooltip'; const SupplierSourcingInfoChart = (): JSX.Element => { const [showBy, setShowBy] = useState<'byVolume' | 'byArea'>('byVolume'); @@ -82,7 +84,16 @@ const SupplierSourcingInfoChart = (): JSX.Element => { return (
-

Individual plot contributions to volume accumulation

+
+

Individual plot contributions to volume accumulation

+ +
Show by