From 1819df5117af50da5ed8b7c9b0604d87296544a4 Mon Sep 17 00:00:00 2001 From: Alex Holliday Date: Mon, 26 Jan 2026 20:27:11 +0000 Subject: [PATCH] priority fallback --- .../v2/design-elements/BasePage.tsx | 52 +++++++++++++++++++ client/src/Pages/PageSpeed/Monitors/index.tsx | 2 +- 2 files changed, 53 insertions(+), 1 deletion(-) diff --git a/client/src/Components/v2/design-elements/BasePage.tsx b/client/src/Components/v2/design-elements/BasePage.tsx index c8618fa67..bbe19be07 100644 --- a/client/src/Components/v2/design-elements/BasePage.tsx +++ b/client/src/Components/v2/design-elements/BasePage.tsx @@ -1,8 +1,11 @@ import Stack from "@mui/material/Stack"; +import Alert from "@mui/material/Alert"; +import Link from "@mui/material/Link"; import { ErrorFallback, EmptyFallback, EmptyMonitorFallback, + BaseFallback, } from "@/Components/v2/design-elements/Fallback"; import { Breadcrumb } from "@/Components/v2/design-elements/Breadcrumb"; import CircularProgress from "@mui/material/CircularProgress"; @@ -10,6 +13,41 @@ import CircularProgress from "@mui/material/CircularProgress"; import type { StackProps } from "@mui/material/Stack"; import { useTheme } from "@mui/material/styles"; import { useTranslation } from "react-i18next"; +import { Link as RouterLink } from "react-router-dom"; + +export const PageSpeedKeyPriorityFallback = () => { + const theme = useTheme(); + const { t } = useTranslation(); + + return ( + + + {t("pageSpeedWarning")}{" "} + + {t("pageSpeedLearnMoreLink")} + {" "} + {t("pageSpeedAddApiKey")} + + + ); +}; + interface BasePageProps extends StackProps { loading?: boolean; error?: boolean; @@ -114,6 +152,7 @@ interface MonitorBasePageWithStatesProps extends StackProps { page: string; actionLink?: string; children: React.ReactNode; + priorityFallback?: React.ReactNode; } const isEmpty = (items: any[]) => { @@ -129,12 +168,25 @@ export const MonitorBasePageWithStates = ({ page, actionLink, children, + priorityFallback, ...props }: MonitorBasePageWithStatesProps) => { const { t } = useTranslation(); const showLoading = loading && (!items || items.length === 0); + if (priorityFallback) { + return ( + + {priorityFallback} + + ); + } + if (!loading && isEmpty(items)) { return ( { isLoading: monitorsIsLoading, error: monitorsError, refetch, - } = useGet(monitorsUrl); + } = useGet(monitorsUrl, {}, { refreshInterval: 30000 }); const settingsUrl = "/settings"; const {