diff --git a/src/admin/components/ResourceTabs/MonitoredTab/components/DataCard.tsx b/src/admin/components/ResourceTabs/MonitoredTab/components/DataCard.tsx index 09471889..2ed6ba14 100644 --- a/src/admin/components/ResourceTabs/MonitoredTab/components/DataCard.tsx +++ b/src/admin/components/ResourceTabs/MonitoredTab/components/DataCard.tsx @@ -422,14 +422,7 @@ const DataCard = ({ const [topHeaderFirstTable, setTopHeaderFirstTable] = useState("102px"); const [topHeaderSecondTable, setTopHeaderSecondTable] = useState("70px"); - - useEffect(() => { - if (typeof window !== "undefined") { - const width = window.innerWidth; - setTopHeaderFirstTable(width > 1900 ? "110px" : "106px"); - setTopHeaderSecondTable(width > 1900 ? "77px" : "72px"); - } - }, []); + const totalElemIndicator = polygonsIndicator?.length ? polygonsIndicator?.length - 1 : null; useEffect(() => { if (typeof window !== "undefined") { @@ -486,7 +479,9 @@ const DataCard = ({ }, { id: "analysis2024", - header: "Analysis: April 25, 2024", + header: totalElemIndicator + ? `Analysis: ${format(new Date(polygonsIndicator?.[totalElemIndicator]?.created_at!), "MMMM d, yyyy")}` + : "Analysis:", meta: { style: { top: `${topHeaderSecondTable}`, borderBottomWidth: 0 } }, columns: [ { diff --git a/src/admin/components/ResourceTabs/MonitoredTab/components/HeaderMonitoredTab.tsx b/src/admin/components/ResourceTabs/MonitoredTab/components/HeaderMonitoredTab.tsx index 5c0440fe..bd157344 100644 --- a/src/admin/components/ResourceTabs/MonitoredTab/components/HeaderMonitoredTab.tsx +++ b/src/admin/components/ResourceTabs/MonitoredTab/components/HeaderMonitoredTab.tsx @@ -9,6 +9,7 @@ import { ModalId } from "@/components/extensive/Modal/ModalConst"; import ModalNotes from "@/components/extensive/Modal/ModalNotes"; import ModalRunAnalysis from "@/components/extensive/Modal/ModalRunAnalysis"; import { useModalContext } from "@/context/modal.provider"; +import { useMonitoredDataContext } from "@/context/monitoredData.provider"; import { EntityName } from "@/types/common"; import { useMonitoredData } from "../hooks/useMonitoredData"; @@ -17,6 +18,7 @@ const HeaderMonitoredTab = ({ type }: { type?: EntityName }) => { const { openModal, closeModal } = useModalContext(); const { record } = useShowContext(); const { headerBarPolygonStatus, totalPolygonsStatus, polygonMissingAnalysis } = useMonitoredData(type, record?.uuid); + const { loadingAnalysis } = useMonitoredDataContext(); const openRunAnalysis = () => { openModal( @@ -76,6 +78,11 @@ graphs and tables below by clicking update analysis button to your right. `} Polygon Overview +
+ {loadingAnalysis ? ( + + ) : null} +