[PageSpeed]: Merged loading states, used theme spacing, moved Skeleton layout outside of main component render
This commit is contained in:
1 parent
2d587a7d1b
commit
f04fd8bea2
1 file changed
+13
-19
@@ -181,16 +181,18 @@ const PageSpeedSetup = () => {
|
||||
await deleteMonitor({ monitor, redirect: "/pagespeed" });
|
||||
};
|
||||
|
||||
const isBusy = isLoading || isCreating || isDeleting || isUpdating || isPausing;
|
||||
|
||||
if (Object.keys(monitor).length === 0) {
|
||||
return <SkeletonLayout />;
|
||||
}
|
||||
|
||||
return (
|
||||
<Box
|
||||
sx={{
|
||||
"& h1": { color: theme.palette.primary.contrastText },
|
||||
}}
|
||||
>
|
||||
{Object.keys(monitor).length === 0 ? (
|
||||
<SkeletonLayout />
|
||||
) : (
|
||||
<>
|
||||
<Breadcrumbs list={CRUMBS} />
|
||||
<Stack
|
||||
component="form"
|
||||
@@ -271,12 +273,12 @@ const PageSpeedSetup = () => {
|
||||
"&:before": {
|
||||
position: "absolute",
|
||||
content: `""`,
|
||||
width: 4,
|
||||
height: 4,
|
||||
width: theme.spacing(2),
|
||||
height: theme.spacing(2),
|
||||
borderRadius: "50%",
|
||||
backgroundColor: theme.palette.primary.contrastTextTertiary,
|
||||
opacity: 0.8,
|
||||
left: -10,
|
||||
left: theme.spacing(-5),
|
||||
top: "50%",
|
||||
transform: "translateY(-50%)",
|
||||
},
|
||||
@@ -294,9 +296,7 @@ const PageSpeedSetup = () => {
|
||||
>
|
||||
<Button
|
||||
onClick={handlePause}
|
||||
loading={
|
||||
isLoading || isCreating || isDeleting || isUpdating || isPausing
|
||||
}
|
||||
loading={isBusy}
|
||||
variant="contained"
|
||||
color="secondary"
|
||||
sx={{
|
||||
@@ -324,9 +324,7 @@ const PageSpeedSetup = () => {
|
||||
)}
|
||||
</Button>
|
||||
<Button
|
||||
loading={
|
||||
isLoading || isCreating || isDeleting || isUpdating || isPausing
|
||||
}
|
||||
loading={isBusy}
|
||||
variant="contained"
|
||||
color="error"
|
||||
onClick={() => setIsOpen(true)}
|
||||
@@ -448,9 +446,7 @@ const PageSpeedSetup = () => {
|
||||
>
|
||||
{t("notificationConfig.title")}
|
||||
</Typography>
|
||||
<Typography component="p">
|
||||
{t("notificationConfig.description")}
|
||||
</Typography>
|
||||
<Typography component="p">{t("notificationConfig.description")}</Typography>
|
||||
</Box>
|
||||
<NotificationsConfig
|
||||
notifications={notifications}
|
||||
@@ -487,7 +483,7 @@ const PageSpeedSetup = () => {
|
||||
type="submit"
|
||||
variant="contained"
|
||||
color="accent"
|
||||
loading={isLoading || isCreating || isDeleting || isUpdating || isPausing}
|
||||
loading={isBusy}
|
||||
disabled={!Object.values(errors).every((value) => value === undefined)}
|
||||
sx={isCreate ? undefined : { px: theme.spacing(12) }}
|
||||
>
|
||||
@@ -495,8 +491,6 @@ const PageSpeedSetup = () => {
|
||||
</Button>
|
||||
</Stack>
|
||||
</Stack>
|
||||
</>
|
||||
)}
|
||||
{!isCreate && (
|
||||
<Dialog
|
||||
open={isOpen}
|
||||
|
||||
Reference in new issue
Block a user