Added skeletons to pagespeed pages

This commit is contained in:
Daniel Cojocea committed 2024-08-07 17:52:46 -04:00
1 parent 51bfc83903
commit ea4cf6efd3
2 files changed
+487 -350

No files matched your search

+55 -3
View File
@@ -1,4 +1,4 @@
import { Box, Grid, Stack, Typography } from "@mui/material";
import { Box, Grid, Skeleton, Stack, Typography } from "@mui/material";
import { useEffect } from "react";
import { useTheme } from "@emotion/react";
import { formatDate, formatDurationRounded } from "../../Utils/timeUtils";
@@ -63,14 +63,66 @@ const PageSpeed = () => {
const navigate = useNavigate();
const { authToken } = useSelector((state) => state.auth);
const { monitors } = useSelector((state) => state.pageSpeedMonitors);
const { monitors, isLoading } = useSelector(
(state) => state.pageSpeedMonitors
);
useEffect(() => {
dispatch(getPageSpeedByUserId(authToken));
}, []);
return (
<Box className="page-speed">
{monitors?.length !== 0 ? (
{isLoading ? (
<Stack gap={theme.gap.xs}>
<Stack
direction="row"
justifyContent="space-between"
mb={theme.gap.large}
>
<Box width="80%">
<Skeleton variant="rounded" width="25%" height={24} />
<Skeleton
variant="rounded"
width="50%"
height={19.5}
sx={{ mt: theme.gap.xs }}
/>
</Box>
<Skeleton
variant="rounded"
width="20%"
height={34}
sx={{ alignSelf: "flex-end" }}
/>
</Stack>
<Stack direction="row" flexWrap="wrap" gap={theme.gap.large}>
<Skeleton
variant="rounded"
width="100%"
height={120}
sx={{ flex: "35%" }}
/>
<Skeleton
variant="rounded"
width="100%"
height={120}
sx={{ flex: "35%" }}
/>
<Skeleton
variant="rounded"
width="100%"
height={120}
sx={{ flex: "35%" }}
/>
<Skeleton
variant="rounded"
width="100%"
height={120}
sx={{ flex: "35%" }}
/>
</Stack>
</Stack>
) : monitors?.length !== 0 ? (
<Stack gap={theme.gap.xs}>
<Stack
direction="row"