From 38d34453bb8ff0e1403d6156546725561c2e5535 Mon Sep 17 00:00:00 2001 From: m5r Date: Wed, 12 Aug 2026 22:28:01 +0200 Subject: [PATCH] milestone 23 s3: convert features/groups/GroupSourcesEditor.tsx to stylex --- .../features/groups/GroupSourcesEditor.tsx | 59 ++++++++++++++----- 1 file changed, 45 insertions(+), 14 deletions(-) diff --git a/web/src/features/groups/GroupSourcesEditor.tsx b/web/src/features/groups/GroupSourcesEditor.tsx index 56d8ce3..196b4e1 100644 --- a/web/src/features/groups/GroupSourcesEditor.tsx +++ b/web/src/features/groups/GroupSourcesEditor.tsx @@ -1,10 +1,12 @@ import { useState } from "react"; import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; +import * as stylex from "@stylexjs/stylex"; import { groupSourcesPutMutation, groupSourcesQuery } from "@/lib/queries"; import type { Blocklist } from "@/lib/types"; import { sameSet, toggleSource } from "./sourceSet"; import InlineError from "@/lib/InlineError"; -import { buttonClass, focusRing, primaryButtonClass } from "@/ui/classes"; +import { styles as shared } from "@/ui/styles"; +import { colors } from "@/ui/tokens.stylex"; import { READ_ONLY_HINT, useReadOnlyConfig } from "@/features/settings/authority"; interface Props { @@ -12,6 +14,35 @@ interface Props { blocklists: Blocklist[]; } +const styles = stylex.create({ + note: { + marginTop: "0.75rem", + fontSize: "0.875rem", + lineHeight: "1.25rem", + color: colors.textMuted, + }, + root: { + marginTop: "0.75rem", + }, + list: { + display: "flex", + flexDirection: "column", + gap: "0.25rem", + }, + checkboxLabel: { + display: "inline-flex", + alignItems: "center", + gap: "0.5rem", + fontSize: "0.875rem", + lineHeight: "1.25rem", + }, + buttonRow: { + marginTop: "0.75rem", + display: "flex", + gap: "0.5rem", + }, +}); + export default function GroupSourcesEditor({ groupId, blocklists }: Props) { const queryClient = useQueryClient(); const sources = useQuery(groupSourcesQuery(groupId)); @@ -21,7 +52,7 @@ export default function GroupSourcesEditor({ groupId, blocklists }: Props) { if (sources.isPending) { return ( -

+

Loading sources…

); @@ -29,27 +60,23 @@ export default function GroupSourcesEditor({ groupId, blocklists }: Props) { if (sources.isError) return ; if (blocklists.length === 0) { - return ( -

- No blocklist sources exist yet — add them on the Blocklists page. -

- ); + return

No blocklist sources exist yet — add them on the Blocklists page.

; } const current = selected ?? sources.data; const dirty = !sameSet(current, sources.data); return ( -
-
    +
    +
      {blocklists.map((blocklist) => (
    • -
    -
    +
    {dirty && ( - )}