Skip to content

Commit

Permalink
[TM-1425] add loading to analysis and date of analysis (#737)
Browse files Browse the repository at this point in the history
  • Loading branch information
LimberHope authored Dec 12, 2024
1 parent 1bf04ff commit 015613f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down Expand Up @@ -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: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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(
Expand Down Expand Up @@ -76,6 +78,11 @@ graphs and tables below by clicking update analysis button to your right. `}
Polygon Overview
<Icon name={IconNames.IC_INFO} className="h-4 w-4 text-darkCustom" />
</Text>
<div className="flex items-center gap-1">
{loadingAnalysis ? (
<Icon name={IconNames.IC_LOADING} className="h-4 w-4 animate-spin text-success-600" />
) : null}
</div>
</div>
<div className="w-[35vw] pt-2">
<LinearProgressBarMonitored data={headerBarPolygonStatus} />
Expand Down

0 comments on commit 015613f

Please sign in to comment.