From 3b33d7afee7bc4ed5e744b4d1f20bc01f133a4f7 Mon Sep 17 00:00:00 2001 From: m5r Date: Wed, 12 Aug 2026 22:38:15 +0200 Subject: [PATCH] milestone 23 s3: convert features/dashboard/UpstreamHealthTable.tsx to stylex --- .../dashboard/UpstreamHealthTable.tsx | 134 ++++++++++++++---- 1 file changed, 110 insertions(+), 24 deletions(-) diff --git a/web/src/features/dashboard/UpstreamHealthTable.tsx b/web/src/features/dashboard/UpstreamHealthTable.tsx index 199689a..b79688e 100644 --- a/web/src/features/dashboard/UpstreamHealthTable.tsx +++ b/web/src/features/dashboard/UpstreamHealthTable.tsx @@ -1,64 +1,150 @@ +import * as stylex from "@stylexjs/stylex"; import type { UpstreamHealth } from "@/lib/types"; +import { styles as shared } from "@/ui/styles"; +import { colors } from "@/ui/tokens.stylex"; + +const styles = stylex.create({ + card: { + borderRadius: "0.25rem", + borderWidth: 1, + borderStyle: "solid", + borderColor: colors.border, + backgroundColor: colors.surfaceRaised, + }, + heading: { + display: "flex", + alignItems: "baseline", + justifyContent: "space-between", + paddingInline: "1rem", + paddingTop: "0.75rem", + fontSize: "0.875rem", + lineHeight: "1.25rem", + fontWeight: 600, + }, + count: { + fontSize: "0.75rem", + lineHeight: "1rem", + fontWeight: 400, + color: colors.textMuted, + }, + empty: { + paddingInline: "1rem", + paddingBlock: "0.75rem", + fontSize: "0.875rem", + lineHeight: "1.25rem", + color: colors.textMuted, + }, + tableWrap: { + overflowX: "auto", + }, + table: { + marginTop: "0.5rem", + width: "100%", + fontSize: "0.875rem", + lineHeight: "1.25rem", + }, + headRow: { + borderBottomWidth: 1, + borderBottomStyle: "solid", + borderBottomColor: colors.border, + textAlign: "left", + fontSize: "0.75rem", + lineHeight: "1rem", + color: colors.textMuted, + }, + th: { + paddingInline: "1rem", + paddingBlock: "0.5rem", + fontWeight: 500, + }, + thRight: { + textAlign: "right", + }, + /** No hairline under the last row: the card border already closes the table. */ + row: { + borderBottomWidth: { default: 1, ":last-child": 0 }, + borderBottomStyle: "solid", + borderBottomColor: colors.border, + }, + cell: { + paddingInline: "1rem", + paddingBlock: "0.5rem", + }, + cellRight: { + textAlign: "right", + }, + small: { + fontSize: "0.75rem", + lineHeight: "1rem", + }, + muted: { + color: colors.textMuted, + }, + bad: { + color: colors.danger, + }, +}); function YesNo({ value, badValue }: { value: boolean; badValue: boolean }) { const bad = value === badValue; - return {value ? "yes" : "no"}; + return {value ? "yes" : "no"}; } export default function UpstreamHealthTable({ health }: { health: UpstreamHealth }) { return ( -
-

+
+

Upstreams - + {health.available}/{health.total} available

{health.upstreams.length === 0 ? ( -

No upstreams configured.

+

No upstreams configured.

) : ( -
- +
+
- - + - - - - - {health.upstreams.map((upstream) => ( - - - + + - - - + - + ))}
+
URL + Enabled + Available + Failures + Success rate + Last error
{upstream.url} +
{upstream.url} + {upstream.total_failures} + + {upstream.total_failures} + {(upstream.success_rate * 100).toFixed(1)}% {upstream.last_error || "—"} + {upstream.last_error || "—"} +