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.
This commit is contained in:
gorkem-bwl committed 2026-04-27 18:39:42 -04:00
1 parent b95d8886b9
commit c6c50063d8
12 files changed
+1442 -1616

No files matched your search

@@ -6,7 +6,7 @@ import type { Monitor } from "@/Types/Monitor";
export type GaugeFillLevel = "ok" | "warm" | "hot";
interface InfraSx {
export interface InfraSx {
containerSx: SxProps<Theme>;
emptySx: SxProps<Theme>;
gaugeSx: SxProps<Theme>;
@@ -19,10 +19,7 @@ interface InfraSx {
interface Props {
monitor: Monitor & { checks?: Monitor["recentChecks"] };
/** sx-based API — preferred. */
sxApi?: InfraSx;
/** Legacy className-based API. Will be removed once all themes move to sx. */
classPrefix?: string;
sxApi: InfraSx;
}
interface Gauge {
@@ -37,19 +34,13 @@ const PCT = 100;
const heatLevel = (value: number): GaugeFillLevel =>
value > 85 ? "hot" : value > 70 ? "warm" : "ok";
export const ThemedInfrastructure = ({ monitor, sxApi, classPrefix }: Props) => {
export const ThemedInfrastructure = ({ monitor, sxApi }: Props) => {
const { t } = useTranslation();
const useSxApi = Boolean(sxApi);
const latest = monitor.recentChecks?.[0] ?? monitor.checks?.[0];
const renderEmpty = () => {
const message = t("pages.statusPages.monitorsList.noData");
return useSxApi ? (
<Box sx={sxApi!.emptySx}>{message}</Box>
) : (
<Box className={`${classPrefix}-infra-empty`}>{message}</Box>
);
};
const renderEmpty = () => (
<Box sx={sxApi.emptySx}>{t("pages.statusPages.monitorsList.noData")}</Box>
);
if (!latest) return renderEmpty();
@@ -94,49 +85,21 @@ export const ThemedInfrastructure = ({ monitor, sxApi, classPrefix }: Props) =>
if (gauges.length === 0) return renderEmpty();
if (useSxApi) {
const s = sxApi!;
return (
<Box sx={s.containerSx}>
{gauges.map((g) => (
<Box
key={g.key}
sx={s.gaugeSx}
>
<Box sx={s.gaugeLabelSx}>{g.label}</Box>
<Box sx={s.gaugeValueSx}>{g.value.toFixed(0)}%</Box>
<Box sx={s.gaugeBarSx}>
<Box sx={s.gaugeFillSx(heatLevel(g.value), Math.min(100, g.value))} />
</Box>
<Box sx={s.gaugeSubSx}>{g.sub}</Box>
</Box>
))}
</Box>
);
}
return (
<Box className={`${classPrefix}-infra`}>
{gauges.map((g) => {
const level = heatLevel(g.value);
const heatClass = level === "ok" ? "" : `${classPrefix}-${level}`;
return (
<Box
key={g.key}
className={`${classPrefix}-gauge`}
>
<Box className={`${classPrefix}-gauge-label`}>{g.label}</Box>
<Box className={`${classPrefix}-gauge-value`}>{g.value.toFixed(0)}%</Box>
<Box className={`${classPrefix}-gauge-bar`}>
<Box
className={`${classPrefix}-gauge-fill ${heatClass}`}
style={{ width: `${Math.min(100, g.value)}%` }}
/>
</Box>
<Box className={`${classPrefix}-gauge-sub`}>{g.sub}</Box>
<Box sx={sxApi.containerSx}>
{gauges.map((g) => (
<Box
key={g.key}
sx={sxApi.gaugeSx}
>
<Box sx={sxApi.gaugeLabelSx}>{g.label}</Box>
<Box sx={sxApi.gaugeValueSx}>{g.value.toFixed(0)}%</Box>
<Box sx={sxApi.gaugeBarSx}>
<Box sx={sxApi.gaugeFillSx(heatLevel(g.value), Math.min(100, g.value))} />
</Box>
);
})}
<Box sx={sxApi.gaugeSubSx}>{g.sub}</Box>
</Box>
))}
</Box>
);
};