diff --git a/client/src/Components/v2/design-elements/BasePage.tsx b/client/src/Components/v2/design-elements/BasePage.tsx index bbe19be07..de20fc005 100644 --- a/client/src/Components/v2/design-elements/BasePage.tsx +++ b/client/src/Components/v2/design-elements/BasePage.tsx @@ -12,13 +12,11 @@ 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 { Trans, useTranslation } from "react-i18next"; import { Link as RouterLink } from "react-router-dom"; +import { Typography } from "@mui/material"; export const PageSpeedKeyPriorityFallback = () => { - const theme = useTheme(); - const { t } = useTranslation(); - return ( { sx={{ width: "100%", maxWidth: 600, - backgroundColor: theme.palette.warning.light, - color: theme.palette.warning.contrastText, - "& .MuiAlert-icon": { - color: theme.palette.warning.contrastText, - }, }} > - {t("pageSpeedWarning")}{" "} - - {t("pageSpeedLearnMoreLink")} - {" "} - {t("pageSpeedAddApiKey")} + + + ), + }} + /> + ); @@ -178,8 +176,8 @@ export const MonitorBasePageWithStates = ({ if (priorityFallback) { return ( {priorityFallback} diff --git a/client/src/Pages/PageSpeed/Monitors/index.tsx b/client/src/Pages/PageSpeed/Monitors/index.tsx index 811859d41..d15e09e70 100644 --- a/client/src/Pages/PageSpeed/Monitors/index.tsx +++ b/client/src/Pages/PageSpeed/Monitors/index.tsx @@ -3,6 +3,7 @@ import { UpStatusBox, DownStatusBox, PausedStatusBox, + PageSpeedKeyPriorityFallback, } from "@/Components/v2/design-elements"; import { Dialog } from "@/Components/v2/inputs"; import { HeaderCreate } from "@/Components/v2/common"; @@ -52,6 +53,9 @@ const PageSpeedMonitorsPage = () => { const isLoading = monitorsIsLoading || settingsIsLoading; + const showApiKeyWarning = + isAdmin && settingsData && !settingsData.pagespeedKeySet; + const handleConfirm = async () => { if (!selectedMonitor) return; await deleteFn(`/monitors/${selectedMonitor.id}`); @@ -70,6 +74,7 @@ const PageSpeedMonitorsPage = () => { items={monitors || []} page="pageSpeed" actionLink="/pagespeed/create" + priorityFallback={showApiKeyWarning ? : undefined} > Settings to add one. Without it, the PageSpeed monitor won't function." + } + }, "dialogs": { "delete": { "description": "This action cannot be undone.",