Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TM-1425] add loading to analysis and date of analysis #737

Merged
merged 1 commit into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading