From c6c50063d848914b2a7bd0831e65d0f6def2dd3e Mon Sep 17 00:00:00 2001 From: gorkem-bwl Date: Mon, 27 Apr 2026 18:39:42 -0400 Subject: [PATCH] refactor(status-page): convert bold, modern and editorial themes to MUI sx Finishes the migration started for refined. Each theme now consumes the same pattern: - A typed *Styles interface that names every entry the page consumes (no `as Function` casts at the call site) - A *Styles factory that takes (tokens, isDark) and returns sx recipes derived from existing tokens.ts plus the shared toneColor/toneSoft helpers in shared/overallStatus - A useMemo around the factory call so MUI's sx processor sees referential equality across renders that don't change tokens - modern.css's keyframes (pulse + staggered fade-in + reduced-motion guard) ported via @mui/system keyframes inside the modern styles factory - bold.css's hero glow + conic logo + pseudo-elements ported as inline sx via "&::before" / "& > *" selectors - editorial.css's serif typography + hairline dividers + flat rectangular badges ported as plain sx with the serif/sans family stacks named at module scope Drop the four .css files (~1789 lines) along with the className= attributes and the import "./*.css" lines in each StatusPage component. The shared themed components (ThemedHeatmap, ThemedHistogram, ThemedInfrastructure) lose their legacy classPrefix branch entirely now that no theme uses it. The dual-API gate is gone; there is one path. Verified: tsc --noEmit clean, prettier clean. Note: theme-overrides.css remains for the legacy non-themed status page components (StatusBar, MonitorsList, HeaderStatusPageControls). That's separate scope from the four-theme work the reviewer flagged; can be migrated in a follow-up. --- .../Status/themes/bold/BoldStatusPage.tsx | 124 +++-- .../StatusPage/Status/themes/bold/bold.css | 497 ----------------- .../StatusPage/Status/themes/bold/styles.ts | 408 ++++++++++++++ .../themes/editorial/EditorialStatusPage.tsx | 121 ++-- .../Status/themes/editorial/editorial.css | 353 ------------ .../Status/themes/editorial/styles.ts | 335 +++++++++++ .../Status/themes/modern/ModernStatusPage.tsx | 121 ++-- .../Status/themes/modern/modern.css | 519 ------------------ .../StatusPage/Status/themes/modern/styles.ts | 431 +++++++++++++++ .../Status/themes/shared/ThemedHeatmap.tsx | 25 +- .../Status/themes/shared/ThemedHistogram.tsx | 49 +- .../themes/shared/ThemedInfrastructure.tsx | 75 +-- 12 files changed, 1442 insertions(+), 1616 deletions(-) delete mode 100644 client/src/Pages/StatusPage/Status/themes/bold/bold.css create mode 100644 client/src/Pages/StatusPage/Status/themes/bold/styles.ts delete mode 100644 client/src/Pages/StatusPage/Status/themes/editorial/editorial.css create mode 100644 client/src/Pages/StatusPage/Status/themes/editorial/styles.ts delete mode 100644 client/src/Pages/StatusPage/Status/themes/modern/modern.css create mode 100644 client/src/Pages/StatusPage/Status/themes/modern/styles.ts diff --git a/client/src/Pages/StatusPage/Status/themes/bold/BoldStatusPage.tsx b/client/src/Pages/StatusPage/Status/themes/bold/BoldStatusPage.tsx index ad777dbff..feb17d917 100644 --- a/client/src/Pages/StatusPage/Status/themes/bold/BoldStatusPage.tsx +++ b/client/src/Pages/StatusPage/Status/themes/bold/BoldStatusPage.tsx @@ -1,4 +1,4 @@ -import { useState } from "react"; +import { useMemo, useState } from "react"; import Box from "@mui/material/Box"; import Stack from "@mui/material/Stack"; import { useTranslation } from "react-i18next"; @@ -14,7 +14,8 @@ import { resolveOverallStatus, statusBadgeKey, } from "../shared/overallStatus"; -import "./bold.css"; +import { useStatusPageTheme } from "../StatusPageThemeProvider"; +import { boldStyles } from "./styles"; type StatusPageMonitor = Monitor & { checks?: Monitor["recentChecks"] }; @@ -23,85 +24,99 @@ interface Props { monitors: StatusPageMonitor[]; } -const PREFIX = "bo"; - export const BoldStatusPage = ({ statusPage, monitors }: Props) => { const { t } = useTranslation(); + const { tokens, mode } = useStatusPageTheme(); + const styles = useMemo(() => boldStyles(tokens, mode === "dark"), [tokens, mode]); const [chartMode, setChartMode] = useState<"heatmap" | "histogram">("heatmap"); - // Bold uses a dedicated check-disc treatment next to the title; its - // icon is scaled differently but the semantic resolution is shared. const overall = resolveOverallStatus(monitors, t, { iconSize: 18 }); const logoSrc = statusPage.logo?.data ? `data:${statusPage.logo.contentType};base64,${statusPage.logo.data}` : null; return ( - + - + {logoSrc ? ( ) : ( - - {monoFirstChar(statusPage.companyName)} - + {monoFirstChar(statusPage.companyName)} )} - {statusPage.companyName} + + {statusPage.companyName} + - - - {overall.icon} + + + + {overall.icon} + {overall.message} - - + + {t("pages.statusPages.statusBar.monitoringSummary", { count: monitors.length, })} -
+
- + + {overall.message} -
+ + + + + {overall.message} + + {t("pages.statusPages.statusBar.monitoringSummary", { count: monitors.length, })} -