From 20eef5cd2dcaa13c3b7cc6f2b636b7ca8270f9ed Mon Sep 17 00:00:00 2001 From: catlog22 Date: Fri, 27 Feb 2026 13:39:08 +0800 Subject: [PATCH] feat: update styles and improve Chinese localization in CLI manager --- ccw/frontend/src/components/hook/HookCard.tsx | 26 ++++++++++++++++ .../components/specs/InjectionControlTab.tsx | 2 ++ ccw/frontend/src/components/ui/Progress.tsx | 2 +- ccw/frontend/src/locales/zh/cli-manager.json | 30 +++++++++---------- 4 files changed, 44 insertions(+), 16 deletions(-) diff --git a/ccw/frontend/src/components/hook/HookCard.tsx b/ccw/frontend/src/components/hook/HookCard.tsx index bdecd2c6..42cac274 100644 --- a/ccw/frontend/src/components/hook/HookCard.tsx +++ b/ccw/frontend/src/components/hook/HookCard.tsx @@ -98,6 +98,29 @@ function getTriggerVariant(trigger: HookTriggerType): 'default' | 'secondary' | // ========== Component ========== +// ========== Hook Name Translation ========== + +/** + * Get translated hook name if available + * Falls back to original name if no translation exists + */ +function getHookDisplayName(name: string, formatMessage: (msg: { id: string }) => string): string { + const translationKey = `cliHooks.templates.templates.${name}.name`; + // Try to get translation, fallback to original name + try { + const translated = formatMessage({ id: translationKey }); + // If translation returns the key itself, no translation exists + if (translated && !translated.includes('cliHooks.templates.templates')) { + return translated; + } + } catch { + // Translation not found + } + return name; +} + +// ========== Component ========== + export function HookCard({ hook, isExpanded, @@ -108,6 +131,9 @@ export function HookCard({ }: HookCardProps) { const { formatMessage } = useIntl(); + // Get translated hook name + const displayName = getHookDisplayName(hook.name, formatMessage); + const handleToggle = () => { onToggle(hook.name, !hook.enabled); }; diff --git a/ccw/frontend/src/components/specs/InjectionControlTab.tsx b/ccw/frontend/src/components/specs/InjectionControlTab.tsx index 7d70a516..a9148fea 100644 --- a/ccw/frontend/src/components/specs/InjectionControlTab.tsx +++ b/ccw/frontend/src/components/specs/InjectionControlTab.tsx @@ -603,6 +603,8 @@ export function InjectionControlTab({ className }: InjectionControlTabProps) { !isOverLimit && isOverWarning && 'bg-yellow-100 dark:bg-yellow-900/30' )} indicatorClassName={cn( + // Default: use a distinct blue color + !isOverLimit && !isOverWarning && 'bg-sky-500 dark:bg-sky-400', isOverLimit && 'bg-destructive', !isOverLimit && isOverWarning && 'bg-yellow-500' )} diff --git a/ccw/frontend/src/components/ui/Progress.tsx b/ccw/frontend/src/components/ui/Progress.tsx index a77bd5f1..6a273469 100644 --- a/ccw/frontend/src/components/ui/Progress.tsx +++ b/ccw/frontend/src/components/ui/Progress.tsx @@ -15,7 +15,7 @@ const Progress = React.forwardRef<