diff --git a/frontend/src/components/map/index.tsx b/frontend/src/components/map/index.tsx index 2eb48172..c935dcec 100644 --- a/frontend/src/components/map/index.tsx +++ b/frontend/src/components/map/index.tsx @@ -54,16 +54,19 @@ export const Map: FC = ({ const handleFitBounds = useCallback(() => { if (mapRef && bounds) { const { bbox, options } = bounds; - // enabling fly mode avoids the map to be interrupted during the bounds transition - setFlying(true); - - mapRef.fitBounds( - [ - [bbox[0], bbox[1]], - [bbox[2], bbox[3]], - ], - options - ); + + if (bbox) { + // enabling fly mode avoids the map to be interrupted during the bounds transition + setFlying(true); + + mapRef.fitBounds( + [ + [bbox[0], bbox[1]], + [bbox[2], bbox[3]], + ], + options + ); + } } }, [bounds, mapRef]); diff --git a/frontend/src/containers/map/content/details/tables/global-regional/hooks.tsx b/frontend/src/containers/map/content/details/tables/global-regional/hooks.tsx index 06416c2a..08344ab2 100644 --- a/frontend/src/containers/map/content/details/tables/global-regional/hooks.tsx +++ b/frontend/src/containers/map/content/details/tables/global-regional/hooks.tsx @@ -272,6 +272,10 @@ export const useColumns = ( const { location } = row.original; const value = location.mpaa_protection_level_stats.percentage; + if (value === null || value === undefined) { + return {t('no-data-available')}; + } + const formattedValue = cellFormatter.percentage(locale, value ?? 0); return ( diff --git a/frontend/src/containers/map/sidebar/main-panel/panels/details/widgets/habitat/index.tsx b/frontend/src/containers/map/sidebar/main-panel/panels/details/widgets/habitat/index.tsx index 5aed116a..9651ed1e 100644 --- a/frontend/src/containers/map/sidebar/main-panel/panels/details/widgets/habitat/index.tsx +++ b/frontend/src/containers/map/sidebar/main-panel/panels/details/widgets/habitat/index.tsx @@ -143,12 +143,41 @@ const HabitatWidget: FCWithMessages = ({ location }) => { } ); + const { data: metadata } = useGetDataInfos( + { + locale, + filters: { + slug: 'habitat-widget', + }, + populate: 'data_sources', + }, + { + query: { + select: ({ data }) => + data[0] + ? { + info: data[0].attributes.content, + sources: data[0].attributes?.data_sources?.data?.map( + ({ id, attributes: { title, url } }) => ({ + id, + title, + url, + }) + ), + } + : undefined, + }, + } + ); + return ( {chartData.map((chartData) => ( { @@ -46,8 +46,7 @@ const TerrestrialWidgets: FCWithMessages = () => { })} > - {/* Temporarily hidden due to overestimations caused by the calculation methodology */} - {/* */} + ); };