2025-12-22 06:39:00 +00:00
|
|
|
import { BasePage, BaseBox } from "@/components/design-elements";
|
|
|
|
|
import { TimingsChart, CheckDetailsCard } from "@/components/checks/";
|
|
|
|
|
import Stack from "@mui/material/Stack";
|
2025-12-19 15:12:30 -08:00
|
|
|
|
|
|
|
|
import { useParams } from "react-router";
|
|
|
|
|
import { useGet } from "@/hooks/UseApi";
|
|
|
|
|
import type { ICheck } from "@/types/check";
|
2025-12-22 06:39:00 +00:00
|
|
|
import useMediaQuery from "@mui/material/useMediaQuery";
|
2025-12-19 15:12:30 -08:00
|
|
|
import type { ApiResponse } from "@/types/api";
|
2025-12-22 06:39:00 +00:00
|
|
|
import { useTheme } from "@mui/material/styles";
|
2025-12-19 15:12:30 -08:00
|
|
|
const CheckDetails = () => {
|
|
|
|
|
const { id } = useParams();
|
2025-12-22 06:39:00 +00:00
|
|
|
const theme = useTheme();
|
|
|
|
|
const isSmall = useMediaQuery(theme.breakpoints.down("md"));
|
|
|
|
|
|
2025-12-19 15:12:30 -08:00
|
|
|
const { response, loading, error } = useGet<ApiResponse<ICheck>>(
|
|
|
|
|
`/checks/${id}`
|
|
|
|
|
);
|
|
|
|
|
|
2025-12-22 06:39:00 +00:00
|
|
|
const check = response?.data || null;
|
2025-12-19 15:12:30 -08:00
|
|
|
return (
|
|
|
|
|
<BasePage loading={loading} error={error}>
|
2025-12-22 06:39:00 +00:00
|
|
|
<Stack direction={isSmall ? "column" : "row"} spacing={4}>
|
|
|
|
|
<BaseBox p={4} flex={1}>
|
|
|
|
|
<CheckDetailsCard check={check!} />
|
|
|
|
|
</BaseBox>
|
|
|
|
|
<BaseBox p={4} flex={1}>
|
|
|
|
|
<TimingsChart check={check} />
|
|
|
|
|
</BaseBox>
|
|
|
|
|
</Stack>
|
2025-12-19 15:12:30 -08:00
|
|
|
</BasePage>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default CheckDetails;
|