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

@@ -15,12 +15,9 @@ export type BarKind = "up" | "down" | "empty";
interface Props {
checks: CheckSnapshot[];
/** sx-based API — preferred. */
containerSx?: SxProps<Theme>;
barSx?: (kind: BarKind, heightPct: number) => SxProps<Theme>;
statsSx?: SxProps<Theme>;
/** Legacy className-based API. Will be removed once all themes move to sx. */
classPrefix?: string;
containerSx: SxProps<Theme>;
barSx: (kind: BarKind, heightPct: number) => SxProps<Theme>;
statsSx: SxProps<Theme>;
statsGap?: number;
}
@@ -32,11 +29,9 @@ export const ThemedHistogram = ({
containerSx,
barSx,
statsSx,
classPrefix,
statsGap = 1,
}: Props) => {
const { t } = useTranslation();
const useSxApi = Boolean(containerSx && barSx && statsSx);
const { padded, max, avg, peak } = useMemo(() => {
const source = checks.slice(0, CELLS).reverse();
@@ -52,29 +47,15 @@ export const ThemedHistogram = ({
return { padded: out, max: maxRt, avg: avgRt, peak: valid.length ? maxRt : 0 };
}, [checks]);
const containerProps = useSxApi
? { sx: containerSx }
: { className: `${classPrefix}-histogram` };
const statsProps = useSxApi
? { sx: statsSx }
: { className: `${classPrefix}-chart-stats` };
return (
<Stack gap={statsGap}>
<Box {...containerProps}>
<Box sx={containerSx}>
{padded.map((check, i) => {
if (!check) {
return useSxApi ? (
return (
<Box
key={`empty-${i}`}
sx={barSx!("empty", MIN_HEIGHT_PCT)}
/>
) : (
<Box
key={`empty-${i}`}
className={`${classPrefix}-bar ${classPrefix}-empty`}
style={{ height: `${MIN_HEIGHT_PCT}%` }}
sx={barSx("empty", MIN_HEIGHT_PCT)}
/>
);
}
@@ -107,18 +88,10 @@ export const ThemedHistogram = ({
arrow
placement="top"
>
{useSxApi ? (
<Box
sx={barSx!(tone(check), height)}
aria-label={`${check.responseTime} ms`}
/>
) : (
<Box
className={`${classPrefix}-bar ${classPrefix}-${tone(check)}`}
style={{ height: `${height}%` }}
aria-label={`${check.responseTime} ms`}
/>
)}
<Box
sx={barSx(tone(check), height)}
aria-label={`${check.responseTime} ms`}
/>
</Tooltip>
);
})}
@@ -126,7 +99,7 @@ export const ThemedHistogram = ({
<Stack
direction="row"
justifyContent="space-between"
{...statsProps}
sx={statsSx}
>
<span>{t("pages.statusPages.monitorsList.chart.avg", { value: avg })}</span>
<span>{t("pages.statusPages.monitorsList.chart.max", { value: peak })}</span>