Moved skeleton to its own file for increased readability
This commit is contained in:
1 parent
4ec51ca886
commit
0025141e9d
2 files changed
+45
-56
No files matched your search
@@ -1,12 +1,5 @@
|
|||||||
import PropTypes from "prop-types";
|
import PropTypes from "prop-types";
|
||||||
import {
|
import { Box, Button, Stack, Tooltip, Typography } from "@mui/material";
|
||||||
Box,
|
|
||||||
Button,
|
|
||||||
Skeleton,
|
|
||||||
Stack,
|
|
||||||
Tooltip,
|
|
||||||
Typography,
|
|
||||||
} from "@mui/material";
|
|
||||||
import { PieChart } from "@mui/x-charts/PieChart";
|
import { PieChart } from "@mui/x-charts/PieChart";
|
||||||
import { useDrawingArea } from "@mui/x-charts";
|
import { useDrawingArea } from "@mui/x-charts";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
@@ -14,13 +7,13 @@ import { useTheme } from "@emotion/react";
|
|||||||
import { useNavigate, useParams } from "react-router-dom";
|
import { useNavigate, useParams } from "react-router-dom";
|
||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
import {
|
import {
|
||||||
formatDuration,
|
|
||||||
formatDurationRounded,
|
formatDurationRounded,
|
||||||
formatDurationSplit,
|
formatDurationSplit,
|
||||||
} from "../../../Utils/timeUtils";
|
} from "../../../Utils/timeUtils";
|
||||||
import { ChartBox, IconBox, StatBox } from "./styled";
|
import { ChartBox, IconBox, StatBox } from "./styled";
|
||||||
import { logger } from "../../../Utils/Logger";
|
import { logger } from "../../../Utils/Logger";
|
||||||
import { networkService } from "../../../main";
|
import { networkService } from "../../../main";
|
||||||
|
import SkeletonLayout from "./skeleton";
|
||||||
import SettingsIcon from "../../../assets/icons/settings-bold.svg?react";
|
import SettingsIcon from "../../../assets/icons/settings-bold.svg?react";
|
||||||
import ScoreIcon from "../../../assets/icons/monitor-graph-line.svg?react";
|
import ScoreIcon from "../../../assets/icons/monitor-graph-line.svg?react";
|
||||||
import PerformanceIcon from "../../../assets/icons/performance-report.svg?react";
|
import PerformanceIcon from "../../../assets/icons/performance-report.svg?react";
|
||||||
@@ -118,53 +111,6 @@ PieValueLabel.propTypes = {
|
|||||||
highlighted: PropTypes.bool,
|
highlighted: PropTypes.bool,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Renders a skeleton layout.
|
|
||||||
*
|
|
||||||
* @returns {JSX.Element}
|
|
||||||
*/
|
|
||||||
const SkeletonLayout = () => {
|
|
||||||
const theme = useTheme();
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<Skeleton variant="rounded" width="15%" height={34} />
|
|
||||||
<Stack direction="row" gap={theme.spacing(4)}>
|
|
||||||
<Skeleton variant="circular" style={{ minWidth: 24, minHeight: 24 }} />
|
|
||||||
<Box width="85%">
|
|
||||||
<Skeleton variant="rounded" width="50%" height={24} />
|
|
||||||
<Skeleton
|
|
||||||
variant="rounded"
|
|
||||||
width="50%"
|
|
||||||
height={18}
|
|
||||||
sx={{ mt: theme.spacing(4) }}
|
|
||||||
/>
|
|
||||||
</Box>
|
|
||||||
<Skeleton
|
|
||||||
variant="rounded"
|
|
||||||
width="15%"
|
|
||||||
height={34}
|
|
||||||
sx={{ alignSelf: "flex-end" }}
|
|
||||||
/>
|
|
||||||
</Stack>
|
|
||||||
<Stack
|
|
||||||
direction="row"
|
|
||||||
justifyContent="space-between"
|
|
||||||
gap={theme.spacing(20)}
|
|
||||||
flexWrap="wrap"
|
|
||||||
>
|
|
||||||
<Skeleton variant="rounded" width="30%" height={90} sx={{ flex: 1 }} />
|
|
||||||
<Skeleton variant="rounded" width="30%" height={90} sx={{ flex: 1 }} />
|
|
||||||
<Skeleton variant="rounded" width="30%" height={90} sx={{ flex: 1 }} />
|
|
||||||
</Stack>
|
|
||||||
<Skeleton variant="rounded" width="25%" height={24} />
|
|
||||||
<Skeleton variant="rounded" width="100%" height={300} />
|
|
||||||
<Skeleton variant="rounded" width="25%" height={24} />
|
|
||||||
<Skeleton variant="rounded" width="100%" height={300} />
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const PageSpeedDetails = () => {
|
const PageSpeedDetails = () => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
import { Box, Skeleton, Stack } from "@mui/material";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renders a skeleton layout.
|
||||||
|
*
|
||||||
|
* @returns {JSX.Element}
|
||||||
|
*/
|
||||||
|
const SkeletonLayout = () => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Skeleton variant="rounded" width="15%" height={34} />
|
||||||
|
<Stack direction="row" gap={4}>
|
||||||
|
<Skeleton variant="circular" style={{ minWidth: 24, minHeight: 24 }} />
|
||||||
|
<Box width="85%">
|
||||||
|
<Skeleton variant="rounded" width="50%" height={24} />
|
||||||
|
<Skeleton variant="rounded" width="50%" height={18} sx={{ mt: 4 }} />
|
||||||
|
</Box>
|
||||||
|
<Skeleton
|
||||||
|
variant="rounded"
|
||||||
|
width="15%"
|
||||||
|
height={34}
|
||||||
|
sx={{ alignSelf: "flex-end" }}
|
||||||
|
/>
|
||||||
|
</Stack>
|
||||||
|
<Stack
|
||||||
|
direction="row"
|
||||||
|
justifyContent="space-between"
|
||||||
|
gap={20}
|
||||||
|
flexWrap="wrap"
|
||||||
|
>
|
||||||
|
<Skeleton variant="rounded" width="30%" height={90} sx={{ flex: 1 }} />
|
||||||
|
<Skeleton variant="rounded" width="30%" height={90} sx={{ flex: 1 }} />
|
||||||
|
<Skeleton variant="rounded" width="30%" height={90} sx={{ flex: 1 }} />
|
||||||
|
</Stack>
|
||||||
|
<Skeleton variant="rounded" width="25%" height={24} />
|
||||||
|
<Skeleton variant="rounded" width="100%" height={300} />
|
||||||
|
<Skeleton variant="rounded" width="25%" height={24} />
|
||||||
|
<Skeleton variant="rounded" width="100%" height={300} />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default SkeletonLayout;
|
||||||
Reference in new issue
Block a user