From 3ce84af39c2677c91fba9e5a069a7ed0cc2b378e Mon Sep 17 00:00:00 2001 From: kang Date: Thu, 21 May 2026 16:33:22 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E6=9B=B4=E6=96=B0=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E6=A8=A1=E5=9D=97=E7=9A=84=E6=A0=B7=E5=BC=8F=E4=B8=8E?= =?UTF-8?q?=E5=B8=83=E5=B1=80=EF=BC=8C=E4=BC=98=E5=8C=96=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E7=BB=93=E6=9E=84=EF=BC=8C=E5=A2=9E=E5=BC=BA=E5=8F=AF=E8=AF=BB?= =?UTF-8?q?=E6=80=A7=E4=B8=8E=E4=B8=80=E8=87=B4=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/config/config-chip-group.tsx | 43 +++++ src/modules/config/config-context-banner.tsx | 39 ++++ src/modules/config/config-doc-page.tsx | 75 ++++++++ src/modules/config/config-readonly-value.tsx | 2 +- src/modules/config/config-section.tsx | 34 ++++ src/modules/config/config-status-badge.tsx | 13 +- src/modules/config/config-subnav.tsx | 11 +- src/modules/config/config-version-actions.tsx | 27 +-- .../config/config-version-switcher.tsx | 48 ++--- src/modules/config/config-workspace-shell.tsx | 6 +- .../config/doc/odds-config-doc-screen.tsx | 180 ++++++++---------- .../config/doc/play-config-doc-screen.tsx | 177 +++++++++-------- .../config/doc/rebate-config-doc-screen.tsx | 115 +++++------ .../config/doc/risk-cap-doc-screen.tsx | 139 +++++++------- .../config/doc/wallet-config-doc-screen.tsx | 9 +- 15 files changed, 541 insertions(+), 377 deletions(-) create mode 100644 src/modules/config/config-chip-group.tsx create mode 100644 src/modules/config/config-context-banner.tsx create mode 100644 src/modules/config/config-doc-page.tsx create mode 100644 src/modules/config/config-section.tsx diff --git a/src/modules/config/config-chip-group.tsx b/src/modules/config/config-chip-group.tsx new file mode 100644 index 0000000..9373722 --- /dev/null +++ b/src/modules/config/config-chip-group.tsx @@ -0,0 +1,43 @@ +"use client"; + +import type { ReactNode } from "react"; + +import { Button } from "@/components/ui/button"; +import { cn } from "@/lib/utils"; + +type ConfigChipGroupProps = { + label?: string; + children: ReactNode; + className?: string; +}; + +export function ConfigChipGroup({ label, children, className }: ConfigChipGroupProps) { + return ( +
+ {label ?

{label}

: null} +
{children}
+
+ ); +} + +type ConfigChipProps = { + active: boolean; + onClick: () => void; + children: ReactNode; + disabled?: boolean; +}; + +export function ConfigChip({ active, onClick, children, disabled }: ConfigChipProps) { + return ( + + ); +} diff --git a/src/modules/config/config-context-banner.tsx b/src/modules/config/config-context-banner.tsx new file mode 100644 index 0000000..90def19 --- /dev/null +++ b/src/modules/config/config-context-banner.tsx @@ -0,0 +1,39 @@ +import type { ReactNode } from "react"; + +import { cn } from "@/lib/utils"; + +type ConfigContextBannerProps = { + children: ReactNode; + className?: string; + /** Highlights read-only or draft-only hints. */ + emphasis?: boolean; +}; + +export function ConfigContextBanner({ + children, + className, + emphasis = false, +}: ConfigContextBannerProps) { + return ( +
+ {children} +
+ ); +} + +export function ConfigContextEmphasis({ children, className }: { children: ReactNode; className?: string }) { + return ( + + {children} + + ); +} diff --git a/src/modules/config/config-doc-page.tsx b/src/modules/config/config-doc-page.tsx new file mode 100644 index 0000000..3878249 --- /dev/null +++ b/src/modules/config/config-doc-page.tsx @@ -0,0 +1,75 @@ +"use client"; + +import type { ReactNode } from "react"; + +import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; +import { cn } from "@/lib/utils"; + +type ConfigDocPageProps = { + title: string; + titleSuffix?: ReactNode; + description?: string; + /** Category / play-type chips etc., rendered above the version toolbar. */ + filters?: ReactNode; + toolbar?: ReactNode; + context?: ReactNode; + children: ReactNode; + className?: string; + contentClassName?: string; +}; + +export function ConfigDocToolbar({ + switcher, + actions, + className, +}: { + switcher: ReactNode; + actions: ReactNode; + className?: string; +}) { + return ( +
+
+
{switcher}
+
{actions}
+
+
+ ); +} + +export function ConfigDocPage({ + title, + titleSuffix, + description, + filters, + toolbar, + context, + children, + className, + contentClassName, +}: ConfigDocPageProps) { + return ( + + + + {title} + {titleSuffix ? ( + {titleSuffix} + ) : null} + + {description ? {description} : null} + + + {filters} + {toolbar} + {context} + {children} + + + ); +} diff --git a/src/modules/config/config-readonly-value.tsx b/src/modules/config/config-readonly-value.tsx index 078eeff..6a01d9d 100644 --- a/src/modules/config/config-readonly-value.tsx +++ b/src/modules/config/config-readonly-value.tsx @@ -16,7 +16,7 @@ export function ConfigReadonlyValue({ return ( +
+
+

{title}

+ {description ? ( +

{description}

+ ) : null} +
+ {actions ?
{actions}
: null} +
+ {children} + + ); +} diff --git a/src/modules/config/config-status-badge.tsx b/src/modules/config/config-status-badge.tsx index f81fe41..2300606 100644 --- a/src/modules/config/config-status-badge.tsx +++ b/src/modules/config/config-status-badge.tsx @@ -1,15 +1,20 @@ import { useTranslation } from "react-i18next"; import { Badge } from "@/components/ui/badge"; +import { cn } from "@/lib/utils"; export function ConfigStatusBadge({ status }: { status: string }) { const { t } = useTranslation("config"); const label = t(`versionStatus.${status}`, { defaultValue: status }); const className = status === "active" - ? "border-emerald-500/20 bg-emerald-500/12 text-emerald-700 dark:text-emerald-300" + ? "border-primary/30 bg-primary/10 text-primary" : status === "draft" - ? "border-amber-500/20 bg-amber-500/12 text-amber-700 dark:text-amber-300" - : "border-slate-300 bg-slate-100 text-slate-600 dark:border-slate-700 dark:bg-slate-800/80 dark:text-slate-300"; + ? "border-border bg-secondary text-secondary-foreground" + : "border-border/80 bg-muted text-muted-foreground"; - return {label}; + return ( + + {label} + + ); } diff --git a/src/modules/config/config-subnav.tsx b/src/modules/config/config-subnav.tsx index 15343c4..3a65c51 100644 --- a/src/modules/config/config-subnav.tsx +++ b/src/modules/config/config-subnav.tsx @@ -13,7 +13,10 @@ export function ConfigSubNav() { const links = CONFIG_NAV_GROUPS.flatMap((group) => group.items); return ( -