update pagespeed
This commit is contained in:
1 parent
7a6b0d5da4
commit
25d1039376
204 files changed
+977
-343
No files matched your search
@@ -0,0 +1,98 @@
|
||||
// Components
|
||||
import { useState } from "react";
|
||||
import Breadcrumbs from "@/Components/v1/Breadcrumbs/index.jsx";
|
||||
import { Stack } from "@mui/material";
|
||||
import CreateMonitorHeader from "@/Components/v1/MonitorCreateHeader/index.jsx";
|
||||
import MonitorCountHeader from "@/Components/v1/MonitorCountHeader/index.jsx";
|
||||
import MonitorGrid from "./Components/MonitorGrid/index.jsx";
|
||||
import PageStateWrapper from "@/Components/v1/PageStateWrapper/index.jsx";
|
||||
import FallbackPageSpeedWarning from "@/Components/v1/Fallback/FallbackPageSpeedWarning.jsx";
|
||||
|
||||
// Utils
|
||||
import { useTheme } from "@emotion/react";
|
||||
import { useIsAdmin } from "@/Hooks/useIsAdmin.js";
|
||||
import {
|
||||
useFetchMonitorsByTeamId,
|
||||
useFetchMonitorsWithChecks,
|
||||
} from "@/Hooks/monitorHooks.js";
|
||||
import { useFetchSettings } from "@/Hooks/settingsHooks.js";
|
||||
// Constants
|
||||
const BREADCRUMBS = [{ name: `pagespeed`, path: "/pagespeed" }];
|
||||
const TYPES = ["pagespeed"];
|
||||
const PageSpeed = () => {
|
||||
const theme = useTheme();
|
||||
const isAdmin = useIsAdmin();
|
||||
|
||||
// const [monitors, monitorsSummary, isLoading, networkError] = useFetchMonitorsByTeamId({
|
||||
// limit: 10,
|
||||
// types: TYPES,
|
||||
// page: null,
|
||||
// rowsPerPage: null,
|
||||
// filter: null,
|
||||
// field: null,
|
||||
// order: null,
|
||||
// });
|
||||
|
||||
const [
|
||||
monitorsWithChecks,
|
||||
monitorsWithChecksCount,
|
||||
monitorsWithChecksIsLoading,
|
||||
monitorsWithChecksNetworkError,
|
||||
] = useFetchMonitorsWithChecks({
|
||||
types: TYPES,
|
||||
limit: 10,
|
||||
page: null,
|
||||
rowsPerPage: null,
|
||||
filter: null,
|
||||
field: null,
|
||||
order: null,
|
||||
monitorUpdateTrigger: null,
|
||||
});
|
||||
|
||||
const [settingsData, setSettingsData] = useState(undefined);
|
||||
const [isSettingsLoading, settingsError] = useFetchSettings({
|
||||
setSettingsData,
|
||||
setIsApiKeySet: () => {},
|
||||
setIsEmailPasswordSet: () => {},
|
||||
});
|
||||
|
||||
return (
|
||||
<>
|
||||
<PageStateWrapper
|
||||
networkError={monitorsWithChecksNetworkError}
|
||||
isLoading={monitorsWithChecksIsLoading}
|
||||
items={monitorsWithChecks}
|
||||
type="pageSpeed"
|
||||
fallbackLink="/pagespeed/create"
|
||||
fallbackChildren={
|
||||
isAdmin &&
|
||||
settingsData &&
|
||||
!settingsData.pagespeedApiKey && (
|
||||
<FallbackPageSpeedWarning settingsData={settingsData} />
|
||||
)
|
||||
}
|
||||
>
|
||||
<Stack gap={theme.spacing(10)}>
|
||||
<Breadcrumbs list={BREADCRUMBS} />
|
||||
<CreateMonitorHeader
|
||||
isAdmin={isAdmin}
|
||||
isLoading={monitorsWithChecksIsLoading}
|
||||
path="/pagespeed/create"
|
||||
/>
|
||||
<MonitorCountHeader
|
||||
isLoading={monitorsWithChecksIsLoading}
|
||||
monitorCount={monitorsWithChecksCount}
|
||||
sx={{ mb: theme.spacing(8) }}
|
||||
/>
|
||||
<MonitorGrid
|
||||
size={6}
|
||||
shouldRender={!monitorsWithChecksIsLoading}
|
||||
monitors={monitorsWithChecks}
|
||||
/>
|
||||
</Stack>
|
||||
</PageStateWrapper>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default PageSpeed;
|
||||
Reference in new issue
Block a user