fix(client): dashboard hover controls, card widths and font sizes

Reorder controls stayed visible after a click. The reveal used
`:focus-within`, and clicking a button leaves it focused, so that card's
controls stayed pinned open long after the pointer left — Failed checks
being wherever focus happened to land. Now `:has(:focus-visible)`, which
matches keyboard focus only, so a mouse click no longer pins them.

Widths: Currently down was full-width and Recent incidents 8-wide, both
with more whitespace than content. Currently down carries six columns per
row so it is the densest card, but it does not need all twelve; it is now
8. Recent incidents carries four and is now 4, as are Recent errors.

Declaring a narrower width is not enough on its own: a card left alone in
a row gets stretched to fill it, so Currently down at 8 still rendered at
12 while it was the only card in its row. Registry and default order are
now sequenced so widths pair into full rows — 8 beside 4, 6 beside 6 —
which is what actually makes the narrow cards render narrow. Verified
across the full catalogue, the non-admin subset and the defaults: every
mid-page row fills exactly 12 with no gaps.

Fonts: every secondary line used typographyLevels.s, which is 11px —
body2, a de-emphasis size. The theme's body1 is 13px, so all 24 uses are
now typographyLevels.m. Nothing in a card renders below body size any
more; only the large figures differ, at xxl.

Claude-Session: https://claude.ai/code/session_01AbYLvwpEaZFXktHVcqrFRd
This commit is contained in:
gorkem-bwl committed 2026-08-29 09:53:42 -04:00
1 parent 49af07009d
commit c46ead515b
15 files changed
+52 -39

No files matched your search

@@ -79,7 +79,7 @@ export const CardPicker = ({
> >
<Typography <Typography
variant="eyebrow" variant="eyebrow"
fontSize={typographyLevels.s} fontSize={typographyLevels.m}
color={theme.palette.text.disabled} color={theme.palette.text.disabled}
> >
{t(`components.sidebar.menu.${group}`, { defaultValue: group })} {t(`components.sidebar.menu.${group}`, { defaultValue: group })}
@@ -97,7 +97,7 @@ export const CardRowLabel = ({
</Typography> </Typography>
{secondary && ( {secondary && (
<Typography <Typography
fontSize={typographyLevels.s} fontSize={typographyLevels.m}
color={theme.palette.text.secondary} color={theme.palette.text.secondary}
noWrap noWrap
> >
@@ -132,7 +132,7 @@ export const CardFigure = ({
</Typography> </Typography>
{caption && ( {caption && (
<Typography <Typography
fontSize={typographyLevels.s} fontSize={typographyLevels.m}
color={theme.palette.text.secondary} color={theme.palette.text.secondary}
> >
{caption} {caption}
@@ -37,7 +37,7 @@ const StatLine = ({
gap={theme.spacing(LAYOUT.SM)} gap={theme.spacing(LAYOUT.SM)}
> >
<Typography <Typography
fontSize={typographyLevels.s} fontSize={typographyLevels.m}
color={theme.palette.text.secondary} color={theme.palette.text.secondary}
> >
{label} {label}
@@ -96,7 +96,7 @@ export const ChecksOnScheduleCard = () => {
secondary={job.failReason} secondary={job.failReason}
/> />
<Typography <Typography
fontSize={typographyLevels.s} fontSize={typographyLevels.m}
color={theme.palette.error.main} color={theme.palette.error.main}
flexShrink={0} flexShrink={0}
> >
@@ -159,7 +159,7 @@ export const RecentErrorsCard = () => {
action={ action={
errors > 0 ? ( errors > 0 ? (
<Typography <Typography
fontSize={typographyLevels.s} fontSize={typographyLevels.m}
color={theme.palette.error.main} color={theme.palette.error.main}
> >
{t("pages.dashboard.cards.recentErrors.count", { count: errors })} {t("pages.dashboard.cards.recentErrors.count", { count: errors })}
@@ -183,7 +183,7 @@ export const RecentErrorsCard = () => {
secondary={[entry.service, entry.method].filter(Boolean).join(" · ")} secondary={[entry.service, entry.method].filter(Boolean).join(" · ")}
/> />
<Typography <Typography
fontSize={typographyLevels.s} fontSize={typographyLevels.m}
color={ color={
entry.level === "error" entry.level === "error"
? theme.palette.error.main ? theme.palette.error.main
@@ -48,13 +48,13 @@ const Metric = ({ label, value }: { label: string; value: number | null }) => {
gap={theme.spacing(LAYOUT.XS)} gap={theme.spacing(LAYOUT.XS)}
> >
<Typography <Typography
fontSize={typographyLevels.s} fontSize={typographyLevels.m}
color={theme.palette.text.secondary} color={theme.palette.text.secondary}
> >
{label} {label}
</Typography> </Typography>
<Typography <Typography
fontSize={typographyLevels.s} fontSize={typographyLevels.m}
color={color} color={color}
> >
{/* A down server reports nothing — show a dash, never 0%. */} {/* A down server reports nothing — show a dash, never 0%. */}
@@ -40,7 +40,7 @@ const MetricLine = ({
gap={theme.spacing(LAYOUT.SM)} gap={theme.spacing(LAYOUT.SM)}
> >
<Typography <Typography
fontSize={typographyLevels.s} fontSize={typographyLevels.m}
color={theme.palette.text.secondary} color={theme.palette.text.secondary}
> >
{label} {label}
@@ -92,7 +92,7 @@ export const CurrentlyDownCard = () => {
action={ action={
problems.length > 0 ? ( problems.length > 0 ? (
<Typography <Typography
fontSize={typographyLevels.s} fontSize={typographyLevels.m}
color={theme.palette.error.main} color={theme.palette.error.main}
> >
{t("pages.dashboard.cards.currentlyDown.count", { {t("pages.dashboard.cards.currentlyDown.count", {
@@ -120,7 +120,7 @@ export const CurrentlyDownCard = () => {
secondary={monitor.url} secondary={monitor.url}
/> />
<Typography <Typography
fontSize={typographyLevels.s} fontSize={typographyLevels.m}
color={theme.palette.text.secondary} color={theme.palette.text.secondary}
flexShrink={0} flexShrink={0}
> >
@@ -128,7 +128,7 @@ export const CurrentlyDownCard = () => {
</Typography> </Typography>
{since && ( {since && (
<Typography <Typography
fontSize={typographyLevels.s} fontSize={typographyLevels.m}
color={theme.palette.error.main} color={theme.palette.error.main}
flexShrink={0} flexShrink={0}
minWidth={DURATION_COLUMN_WIDTH} minWidth={DURATION_COLUMN_WIDTH}
@@ -154,7 +154,7 @@ export const CurrentlyDownCard = () => {
* the link and activating it navigates away. * the link and activating it navigates away.
*/} */}
<Typography <Typography
fontSize={typographyLevels.s} fontSize={typographyLevels.m}
color={theme.palette.text.secondary} color={theme.palette.text.secondary}
flexShrink={0} flexShrink={0}
minWidth={STATUS_CODE_COLUMN_WIDTH} minWidth={STATUS_CODE_COLUMN_WIDTH}
@@ -79,7 +79,7 @@ export const MonitorStatusCard = () => {
size="md" size="md"
/> />
<Typography <Typography
fontSize={typographyLevels.s} fontSize={typographyLevels.m}
color={theme.palette.text.secondary} color={theme.palette.text.secondary}
> >
{t(`pages.common.monitors.status.${key}`)} {t(`pages.common.monitors.status.${key}`)}
@@ -85,7 +85,7 @@ export const MonitorsByGroupCard = () => {
> >
{bucket.down > 0 && ( {bucket.down > 0 && (
<Typography <Typography
fontSize={typographyLevels.s} fontSize={typographyLevels.m}
color={theme.palette.error.main} color={theme.palette.error.main}
> >
{t("pages.dashboard.cards.monitorsByType.down", { {t("pages.dashboard.cards.monitorsByType.down", {
@@ -85,7 +85,7 @@ export const MonitorsByTypeCard = () => {
> >
{bucket.down > 0 && ( {bucket.down > 0 && (
<Typography <Typography
fontSize={typographyLevels.s} fontSize={typographyLevels.m}
color={theme.palette.error.main} color={theme.palette.error.main}
> >
{t("pages.dashboard.cards.monitorsByType.down", { {t("pages.dashboard.cards.monitorsByType.down", {
@@ -33,7 +33,7 @@ const RankingCount = ({ shown, total }: { shown: number; total: number }) => {
const { t } = useTranslation(); const { t } = useTranslation();
return ( return (
<Typography <Typography
fontSize={typographyLevels.s} fontSize={typographyLevels.m}
color={theme.palette.text.secondary} color={theme.palette.text.secondary}
> >
{t("pages.dashboard.cards.ranking.topOf", { shown, total })} {t("pages.dashboard.cards.ranking.topOf", { shown, total })}
@@ -44,7 +44,7 @@ export const RecentIncidentsCard = () => {
action={ action={
data && data.totalActive > 0 ? ( data && data.totalActive > 0 ? (
<Typography <Typography
fontSize={typographyLevels.s} fontSize={typographyLevels.m}
color={theme.palette.error.main} color={theme.palette.error.main}
> >
{t("pages.dashboard.cards.recentIncidents.active", { {t("pages.dashboard.cards.recentIncidents.active", {
@@ -78,7 +78,7 @@ export const RecentIncidentsCard = () => {
secondary={formatTimestamp(incident.startTime)} secondary={formatTimestamp(incident.startTime)}
/> />
<Typography <Typography
fontSize={typographyLevels.s} fontSize={typographyLevels.m}
color={theme.palette.text.secondary} color={theme.palette.text.secondary}
sx={{ flexShrink: 0 }} sx={{ flexShrink: 0 }}
> >
@@ -88,7 +88,7 @@ export const RecentIncidentsCard = () => {
</Typography> </Typography>
{incident.resolutionType === "manual" && ( {incident.resolutionType === "manual" && (
<Typography <Typography
fontSize={typographyLevels.s} fontSize={typographyLevels.m}
color={theme.palette.warning.main} color={theme.palette.warning.main}
sx={{ flexShrink: 0 }} sx={{ flexShrink: 0 }}
> >
@@ -27,7 +27,7 @@ const StatLine = ({ label, value }: { label: string; value: string }) => {
gap={theme.spacing(LAYOUT.SM)} gap={theme.spacing(LAYOUT.SM)}
> >
<Typography <Typography
fontSize={typographyLevels.s} fontSize={typographyLevels.m}
color={theme.palette.text.secondary} color={theme.palette.text.secondary}
> >
{label} {label}
@@ -218,7 +218,7 @@ export const StatusPagesCard = () => {
})} })}
/> />
<Typography <Typography
fontSize={typographyLevels.s} fontSize={typographyLevels.m}
color={theme.palette.text.secondary} color={theme.palette.text.secondary}
flexShrink={0} flexShrink={0}
> >
@@ -52,9 +52,15 @@ export const DashboardCard = ({
flexDirection: "column", flexDirection: "column",
height: "100%", height: "100%",
overflow: "hidden", overflow: "hidden",
// The header controls stay invisible until the card is hovered or // The header controls stay invisible until the card is hovered, so a
// something inside it takes focus, so a settled dashboard is quiet. // settled dashboard is quiet.
"&:hover .dashboard-card-slot, &:focus-within .dashboard-card-slot": { //
// `:has(:focus-visible)` rather than `:focus-within`: a mouse click
// leaves the button focused, and :focus-within would then pin that
// card's controls open long after the pointer had left. focus-visible
// only matches keyboard focus, which is the case that actually needs
// the controls revealed.
"&:hover .dashboard-card-slot, &:has(:focus-visible) .dashboard-card-slot": {
opacity: 1, opacity: 1,
pointerEvents: "auto", pointerEvents: "auto",
}, },
@@ -158,7 +164,7 @@ export const CardMessage = ({ text, action }: { text: string; action?: ReactNode
gap={theme.spacing(LAYOUT.SM)} gap={theme.spacing(LAYOUT.SM)}
> >
<Typography <Typography
fontSize={typographyLevels.s} fontSize={typographyLevels.m}
color={theme.palette.text.secondary} color={theme.palette.text.secondary}
> >
{text} {text}
+3 -1
View File
@@ -61,12 +61,14 @@ export interface CardDefinition {
// The cards a fresh dashboard starts with. Chosen so a brand new install still // The cards a fresh dashboard starts with. Chosen so a brand new install still
// shows something real: Checkmate server works with zero monitors. // shows something real: Checkmate server works with zero monitors.
// Ordered so the declared widths pair into full rows: a card left alone in a
// row is stretched to fill it, so 8- and 4-wide cards are kept adjacent.
export const DEFAULT_CARD_IDS: CardId[] = [ export const DEFAULT_CARD_IDS: CardId[] = [
"monitorStatus", "monitorStatus",
"currentlyDown", "currentlyDown",
"failedChecks", "failedChecks",
"recentIncidents",
"monitorsByType", "monitorsByType",
"recentIncidents",
"checkmateServer", "checkmateServer",
]; ];
+16 -11
View File
@@ -24,7 +24,10 @@ import type { CardDefinition, CardId } from "./cards";
// Declared width is the minimum number of columns a card needs. The grid may // Declared width is the minimum number of columns a card needs. The grid may
// stretch the last card of a short row; nothing here is a user setting. // stretch the last card of a short row; nothing here is a user setting.
// //
// Order is the order the picker lists them in, grouped by sidebar section. // Order is the render order, and the order the picker lists them in. Cards are
// sequenced so their declared widths pair into full rows: a card left alone in
// a row gets stretched to fill it, so an 8-wide card is kept next to a 4-wide
// one rather than being widened back to 12.
export const CARD_REGISTRY: CardDefinition[] = [ export const CARD_REGISTRY: CardDefinition[] = [
{ {
id: "monitorStatus", id: "monitorStatus",
@@ -37,9 +40,18 @@ export const CARD_REGISTRY: CardDefinition[] = [
id: "currentlyDown", id: "currentlyDown",
key: "currentlyDown", key: "currentlyDown",
group: "uptime", group: "uptime",
width: 12, // Six columns per row — the densest card — but it does not need the
// full width, and 8 leaves room for a 4-wide card beside it.
width: 8,
component: CurrentlyDownCard, component: CurrentlyDownCard,
}, },
{
id: "failedChecks",
key: "failedChecks",
group: "checks",
width: 4,
component: FailedChecksCard,
},
{ {
id: "slowestMonitors", id: "slowestMonitors",
key: "slowestMonitors", key: "slowestMonitors",
@@ -79,7 +91,7 @@ export const CARD_REGISTRY: CardDefinition[] = [
id: "recentIncidents", id: "recentIncidents",
key: "recentIncidents", key: "recentIncidents",
group: "incidents", group: "incidents",
width: 8, width: 4,
component: RecentIncidentsCard, component: RecentIncidentsCard,
}, },
{ {
@@ -110,13 +122,6 @@ export const CARD_REGISTRY: CardDefinition[] = [
width: 4, width: 4,
component: StatusPagesCard, component: StatusPagesCard,
}, },
{
id: "failedChecks",
key: "failedChecks",
group: "checks",
width: 4,
component: FailedChecksCard,
},
{ {
id: "checkmateServer", id: "checkmateServer",
key: "checkmateServer", key: "checkmateServer",
@@ -137,7 +142,7 @@ export const CARD_REGISTRY: CardDefinition[] = [
id: "recentErrors", id: "recentErrors",
key: "recentErrors", key: "recentErrors",
group: "logs", group: "logs",
width: 6, width: 4,
adminOnly: true, adminOnly: true,
component: RecentErrorsCard, component: RecentErrorsCard,
}, },