From f04fd8bea2d6e4d73efb837864fbac91418c0f39 Mon Sep 17 00:00:00 2001 From: Jesulayomy Date: Fri, 11 Jul 2025 11:40:28 -0400 Subject: [PATCH] [PageSpeed]: Merged loading states, used theme spacing, moved Skeleton layout outside of main component render --- client/src/Pages/PageSpeed/Create/index.jsx | 568 ++++++++++---------- 1 file changed, 281 insertions(+), 287 deletions(-) diff --git a/client/src/Pages/PageSpeed/Create/index.jsx b/client/src/Pages/PageSpeed/Create/index.jsx index b0b005b06..78709093a 100644 --- a/client/src/Pages/PageSpeed/Create/index.jsx +++ b/client/src/Pages/PageSpeed/Create/index.jsx @@ -181,322 +181,316 @@ const PageSpeedSetup = () => { await deleteMonitor({ monitor, redirect: "/pagespeed" }); }; + const isBusy = isLoading || isCreating || isDeleting || isUpdating || isPausing; + + if (Object.keys(monitor).length === 0) { + return ; + } + return ( - {Object.keys(monitor).length === 0 ? ( - - ) : ( - <> - - - + + + + - + + {!isCreate ? monitor.name : t("createYour") + " "} + + {isCreate ? ( - - {!isCreate ? monitor.name : t("createYour") + " "} - - {isCreate ? ( - - {t("pageSpeedMonitor")} - - ) : ( - <> - )} + {t("pageSpeedMonitor")} - {!isCreate && ( - - - - - - - - {monitor.url?.replace(/^https?:\/\//, "") || "..."} - - - {t("editing")} - - - )} - - {!isCreate && ( - - - - + ) : ( + <> )} - - - + + {!isCreate && ( + + + + + + - {t("settingsGeneralSettings")} + {monitor.url?.replace(/^https?:\/\//, "") || "..."} - - {t("pageSpeedConfigureSettingsDescription")} + + {t("editing")} - - + )} + + {!isCreate && ( + + + + + )} + + + + + {t("settingsGeneralSettings")} + + + {t("pageSpeedConfigureSettingsDescription")} + + + .Mui-disabled)": { + backgroundColor: theme.palette.tertiary.main, + }, + }} + > + : undefined} + placeholder="random.website.com" + value={monitor.url || ""} + onChange={handleChange} + onBlur={isCreate ? handleBlur : undefined} + error={!!errors["url"]} + helperText={errors["url"]} + disabled={!isCreate} + /> + + + + {isCreate && ( + + + + {t("distributedUptimeCreateChecks")} + + + {t("distributedUptimeCreateChecksDescription")} + + + + + + + + + - - {isCreate && ( - + {errors["type"] ? ( - {t("distributedUptimeCreateChecks")} - - - {t("distributedUptimeCreateChecksDescription")} + {errors["type"]} - - - - - - - - - {errors["type"] ? ( - - - {errors["type"]} - - - ) : ( - "" - )} - - - )} - - - - {t("notificationConfig.title")} - - - {t("notificationConfig.description")} - - - - - - - - {t("distributedUptimeCreateAdvancedSettings")} - - - - - - )} + + + + + {!isCreate && (