Skip to content

Commit

Permalink
feat(SKY30-509): Add tooltip to Habitat widget
Browse files Browse the repository at this point in the history
  • Loading branch information
clementprdhomme committed Dec 12, 2024
1 parent 0c4d469 commit f1af0b0
Showing 1 changed file with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,41 @@ const HabitatWidget: FCWithMessages<HabitatWidgetProps> = ({ 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 (
<Widget
title={t('proportion-habitat-within-protected-areas')}
lastUpdated={chartData[0]?.updatedAt}
noData={!chartData.length}
loading={isFetching}
info={metadata?.info}
sources={metadata?.sources}
>
{chartData.map((chartData) => (
<HorizontalBarChart
Expand Down

0 comments on commit f1af0b0

Please sign in to comment.