From 2f3115117fa2d5a4312a692fdc0a42f8e4a0336d Mon Sep 17 00:00:00 2001 From: m5r Date: Wed, 12 Aug 2026 22:31:14 +0200 Subject: [PATCH] milestone 23 s3: convert features/blocklists/SourceStatusSection.tsx to stylex --- .../blocklists/SourceStatusSection.tsx | 119 ++++++++++++------ 1 file changed, 84 insertions(+), 35 deletions(-) diff --git a/web/src/features/blocklists/SourceStatusSection.tsx b/web/src/features/blocklists/SourceStatusSection.tsx index aadd5c6..b37fc91 100644 --- a/web/src/features/blocklists/SourceStatusSection.tsx +++ b/web/src/features/blocklists/SourceStatusSection.tsx @@ -1,6 +1,8 @@ +import * as stylex from "@stylexjs/stylex"; import { formatTime } from "@/lib/format"; import type { SourceStatus } from "@/lib/types"; -import { tdClass, thClass } from "@/ui/classes"; +import { styles as shared } from "@/ui/styles"; +import { colors } from "@/ui/tokens.stylex"; function formatAttempt(unixSeconds: number): string { return unixSeconds === 0 ? "never" : formatTime(unixSeconds); @@ -11,61 +13,108 @@ interface SourceStatusSectionProps { namesById: ReadonlyMap; } +const styles = stylex.create({ + section: { + marginTop: "2rem", + }, + heading: { + fontSize: "1.125rem", + lineHeight: "1.75rem", + fontWeight: 500, + }, + note: { + marginTop: "0.5rem", + color: colors.textMuted, + }, + tableWrap: { + marginTop: "0.5rem", + overflowX: "auto", + }, + table: { + width: "100%", + minWidth: "max-content", + borderCollapse: "collapse", + fontSize: "0.875rem", + lineHeight: "1.25rem", + }, + name: { + fontWeight: 500, + }, + url: { + marginTop: "0.125rem", + display: "block", + maxWidth: "16rem", + overflow: "hidden", + textOverflow: "ellipsis", + whiteSpace: "nowrap", + fontSize: "0.75rem", + lineHeight: "1rem", + color: colors.textMuted, + }, + /** Green has no token: a loaded source is the only success state in the app. */ + loaded: { + color: { + default: "oklch(52.7% 0.154 150.069)", + "@media (prefers-color-scheme: dark)": "oklch(79.2% 0.209 151.711)", + }, + }, + failed: { + color: colors.danger, + }, + absent: { + color: colors.textMuted, + }, +}); + export default function SourceStatusSection({ sources, namesById }: SourceStatusSectionProps) { return ( -
-

Source status

+
+

Source status

{sources === null ? ( -

+

No status snapshot yet — run “Update now” to fetch status for every enabled source.

) : sources.length === 0 ? ( -

The last update ran against no enabled sources.

+

The last update ran against no enabled sources.

) : ( -
- +
+
- - - - - - - - + + + + + + + + {sources.map((source) => ( - - - - - - - - + + + + +
SourceStateLast attemptLast successDomainsWildcardsSkipped regexLast errorSourceStateLast attemptLast successDomainsWildcardsSkipped regexLast error
- {namesById.get(source.id) ?? source.url} - - {source.url} + + + {namesById.get(source.id) ?? source.url} + {source.url} - + + {source.state} {formatAttempt(source.last_attempt)}{formatAttempt(source.last_success)}{source.domains}{source.wildcards}{source.skipped_regex} + {formatAttempt(source.last_attempt)}{formatAttempt(source.last_success)}{source.domains}{source.wildcards}{source.skipped_regex} {source.last_error === "" ? ( - + ) : ( - {source.last_error} + {source.last_error} )}