diff --git a/src/admin/components/ResourceTabs/MonitoredTab/components/DataCard.tsx b/src/admin/components/ResourceTabs/MonitoredTab/components/DataCard.tsx index f51a80836..bb523eaee 100644 --- a/src/admin/components/ResourceTabs/MonitoredTab/components/DataCard.tsx +++ b/src/admin/components/ResourceTabs/MonitoredTab/components/DataCard.tsx @@ -644,7 +644,7 @@ const DataCard = ({ -
+
{ + const [hasNoData, setHasNoData] = useState(false); + + useEffect(() => { + const noData = selected.some(chartId => { + switch (chartId) { + case "1": + case "2": + return !parsedData?.length; + case "3": + return !ecoRegionData?.chartData?.length; + case "4": + return !strategiesData?.length; + case "5": + return !landUseData?.graphicTargetLandUseTypes?.length; + default: + return false; + } + }); + setHasNoData(noData); + }, [selected, parsedData, ecoRegionData, strategiesData, landUseData]); + const renderChart = (chartId: React.Key) => { switch (chartId) { case "1": @@ -124,7 +146,11 @@ const MonitoredCharts = ({ }; return ( -
+
{selected.map( (id: React.Key | null | undefined) => id != null && ( diff --git a/src/admin/components/ResourceTabs/MonitoredTab/components/NoDataState.tsx b/src/admin/components/ResourceTabs/MonitoredTab/components/NoDataState.tsx index c4125b03c..fdac5578f 100644 --- a/src/admin/components/ResourceTabs/MonitoredTab/components/NoDataState.tsx +++ b/src/admin/components/ResourceTabs/MonitoredTab/components/NoDataState.tsx @@ -6,7 +6,7 @@ import Icon from "@/components/extensive/Icon/Icon"; import { IconNames } from "@/components/extensive/Icon/Icon"; export const NoDataState = () => ( -
+
No Data to Display