diff --git a/frontend/src/containers/map/content/map/layers-toolbox/layers-list/index.tsx b/frontend/src/containers/map/content/map/layers-toolbox/layers-list/index.tsx index df97a68c..e84b9643 100644 --- a/frontend/src/containers/map/content/map/layers-toolbox/layers-list/index.tsx +++ b/frontend/src/containers/map/content/map/layers-toolbox/layers-list/index.tsx @@ -2,6 +2,7 @@ import { ComponentProps, useCallback } from 'react'; import { LuChevronDown, LuChevronUp } from 'react-icons/lu'; +import TooltipButton from '@/components/tooltip-button'; import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '@/components/ui/collapsible'; import { Label } from '@/components/ui/label'; import { Switch } from '@/components/ui/switch'; @@ -25,6 +26,7 @@ const LayersDropdown = (): JSX.Element => { const layersQuery = useGetLayers( { sort: 'title:asc', + populate: 'metadata', }, { query: { @@ -79,17 +81,23 @@ const LayersDropdown = (): JSX.Element => { const onCheckedChange = onToggleLayer.bind(null, layer.id) as ( isActive: boolean ) => void; + const metadata = layer?.attributes?.metadata; return ( -
  • - - +
  • + + + + + {metadata?.description && ( + + )}
  • ); })} diff --git a/frontend/src/containers/map/content/map/layers-toolbox/legend/establishment/index.tsx b/frontend/src/containers/map/content/map/layers-toolbox/legend/establishment/index.tsx index ea9d1819..16a3442d 100644 --- a/frontend/src/containers/map/content/map/layers-toolbox/legend/establishment/index.tsx +++ b/frontend/src/containers/map/content/map/layers-toolbox/legend/establishment/index.tsx @@ -1,3 +1,4 @@ +import TooltipButton from '@/components/tooltip-button'; import Icon from '@/components/ui/icon'; import DesignatedIcon from '@/styles/icons/designated.svg?sprite'; import ImplementedIcon from '@/styles/icons/implemented.svg?sprite'; @@ -14,19 +15,24 @@ const PATTERNS = { implemented: ImplementedIcon, }; -const EEZLayerLegend = (config: { items: { label: string; pattern: string }[] }) => { +const EstablishmentLayerLegend = (config: { + items: { label: string; pattern: string; description?: string }[]; +}) => { const { items } = config; return ( ); }; -export default EEZLayerLegend; +export default EstablishmentLayerLegend; diff --git a/frontend/src/containers/map/content/map/layers-toolbox/legend/item.tsx b/frontend/src/containers/map/content/map/layers-toolbox/legend/item.tsx index fa865111..a99f1374 100644 --- a/frontend/src/containers/map/content/map/layers-toolbox/legend/item.tsx +++ b/frontend/src/containers/map/content/map/layers-toolbox/legend/item.tsx @@ -1,12 +1,26 @@ import { FC, ReactElement, isValidElement, useMemo } from 'react'; +import TooltipButton from '@/components/tooltip-button'; +import Icon from '@/components/ui/icon'; import { parseConfig } from '@/lib/json-converter'; +import EEZIcon from '@/styles/icons/eez.svg?sprite'; +import MPAIcon from '@/styles/icons/mpa.svg?sprite'; +import OECMIcon from '@/styles/icons/oecm.svg?sprite'; +import EEZSelectedIcon from '@/styles/icons/selected-eez.svg?sprite'; +import EEZMultipleIcon from '@/styles/icons/several-eez.svg?sprite'; import { LayerTyped, LegendConfig } from '@/types/layers'; - export interface LegendItemsProps { config: LayerTyped['legend_config']; } +const ICONS_MAPPING = { + eez: EEZIcon, + 'eez-selected': EEZSelectedIcon, + 'eez-multiple': EEZMultipleIcon, + oecm: OECMIcon, + mpa: MPAIcon, +}; + const LegendItem: FC = ({ config }) => { const { type, items } = config; @@ -30,7 +44,7 @@ const LegendItem: FC = ({ config }) => { case 'basic': return ( + ); + + case 'icon': + return ( + diff --git a/frontend/src/styles/icons/mpa.svg b/frontend/src/styles/icons/mpa.svg new file mode 100644 index 00000000..b2095983 --- /dev/null +++ b/frontend/src/styles/icons/mpa.svg @@ -0,0 +1,3 @@ + + + diff --git a/frontend/src/styles/icons/oecm.svg b/frontend/src/styles/icons/oecm.svg new file mode 100644 index 00000000..ed92e609 --- /dev/null +++ b/frontend/src/styles/icons/oecm.svg @@ -0,0 +1,3 @@ + + + diff --git a/frontend/src/types/layers.ts b/frontend/src/types/layers.ts index 6ee8680c..1d9117bd 100644 --- a/frontend/src/types/layers.ts +++ b/frontend/src/types/layers.ts @@ -16,10 +16,12 @@ export type ParamsConfigValue = { export type ParamsConfig = Record[]; export type LegendConfig = { - type: 'basic' | 'gradient' | 'choropleth'; + type: 'basic' | 'icon' | 'gradient' | 'choropleth'; items: { value: string; + icon: string; color: string; + description?: string; }[]; };