From fb34809b2f88deb3735884d98e8e5b739c55dfd5 Mon Sep 17 00:00:00 2001 From: Willie Date: Wed, 11 Mar 2026 17:49:24 +0800 Subject: [PATCH] =?UTF-8?q?refactor(ui):=20rename=20HandButton=E2=86=92But?= =?UTF-8?q?ton,=20HandInput=E2=86=92Input=20+=20remove=20deprecated=20alia?= =?UTF-8?q?ses?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Rename HandButton.tsx → Button.tsx, export default function Button - Rename HandInput.tsx → Input.tsx, rename exports: HandInput→Input, HandTextarea→Textarea, HandSelect→Select, HandCheckbox→Checkbox - Rename internal interface names (ButtonProps, InputProps, etc.) - Update all 21 import sites across components/ and pages/ - Remove deprecated `wobbly` and `colors` exports from design.ts --- .../components/{HandButton.tsx => Button.tsx} | 6 +- ui/src/components/ConfirmDialog.tsx | 10 ++-- ui/src/components/ErrorBoundary.tsx | 6 +- ui/src/components/FileViewerModal.tsx | 6 +- ui/src/components/HubManagerModal.tsx | 24 ++++---- .../components/{HandInput.tsx => Input.tsx} | 16 ++--- ui/src/components/InstallForm.tsx | 22 +++---- ui/src/components/SkillPickerModal.tsx | 16 ++--- ui/src/design.ts | 27 --------- ui/src/pages/AuditPage.tsx | 22 +++---- ui/src/pages/AuditRulesPage.tsx | 22 +++---- ui/src/pages/BackupPage.tsx | 18 +++--- ui/src/pages/CollectPage.tsx | 24 ++++---- ui/src/pages/ConfigPage.tsx | 6 +- ui/src/pages/DashboardPage.tsx | 4 +- ui/src/pages/ExtrasPage.tsx | 42 ++++++------- ui/src/pages/GitSyncPage.tsx | 18 +++--- ui/src/pages/LogPage.tsx | 16 ++--- ui/src/pages/SearchPage.tsx | 40 ++++++------- ui/src/pages/SkillDetailPage.tsx | 12 ++-- ui/src/pages/SkillsPage.tsx | 6 +- ui/src/pages/SyncPage.tsx | 8 +-- ui/src/pages/TargetsPage.tsx | 60 +++++++++---------- ui/src/pages/TrashPage.tsx | 14 ++--- ui/src/pages/UpdatePage.tsx | 32 +++++----- 25 files changed, 225 insertions(+), 252 deletions(-) rename ui/src/components/{HandButton.tsx => Button.tsx} (90%) rename ui/src/components/{HandInput.tsx => Input.tsx} (92%) diff --git a/ui/src/components/HandButton.tsx b/ui/src/components/Button.tsx similarity index 90% rename from ui/src/components/HandButton.tsx rename to ui/src/components/Button.tsx index 8bfdd9efa..4a63539bd 100644 --- a/ui/src/components/HandButton.tsx +++ b/ui/src/components/Button.tsx @@ -1,7 +1,7 @@ import type { ReactNode, ButtonHTMLAttributes } from 'react'; import { radius } from '../design'; -interface HandButtonProps extends ButtonHTMLAttributes { +interface ButtonProps extends ButtonHTMLAttributes { children: ReactNode; variant?: 'primary' | 'secondary' | 'danger' | 'ghost'; size?: 'sm' | 'md' | 'lg'; @@ -20,7 +20,7 @@ const sizeClasses = { lg: 'px-8 py-3.5 text-lg', }; -export default function HandButton({ +export default function Button({ children, variant = 'primary', size = 'md', @@ -28,7 +28,7 @@ export default function HandButton({ disabled, style, ...props -}: HandButtonProps) { +}: ButtonProps) { return ( )} - {loading ? 'Working...' : confirmText} - + diff --git a/ui/src/components/ErrorBoundary.tsx b/ui/src/components/ErrorBoundary.tsx index fc883aba3..2c1bf1aa6 100644 --- a/ui/src/components/ErrorBoundary.tsx +++ b/ui/src/components/ErrorBoundary.tsx @@ -1,7 +1,7 @@ import { Component, type ReactNode } from 'react'; import { AlertTriangle } from 'lucide-react'; import Card from './Card'; -import HandButton from './HandButton'; +import Button from './Button'; interface Props { children: ReactNode; @@ -36,9 +36,9 @@ export class ErrorBoundary extends Component { > {this.state.error?.message || 'An unexpected error occurred.'}

- window.location.reload()}> + diff --git a/ui/src/components/FileViewerModal.tsx b/ui/src/components/FileViewerModal.tsx index a2c595e8b..403ea86ae 100644 --- a/ui/src/components/FileViewerModal.tsx +++ b/ui/src/components/FileViewerModal.tsx @@ -10,7 +10,7 @@ import { javascript } from '@codemirror/lang-javascript'; import { EditorView } from '@codemirror/view'; import Card from './Card'; import CopyButton from './CopyButton'; -import HandButton from './HandButton'; +import Button from './Button'; import { api, type SkillFileContent } from '../api/client'; import { handTheme } from '../lib/codemirror-theme'; import { radius } from '../design'; @@ -91,9 +91,9 @@ export default function FileViewerModal({ skillName, filepath, sourcePath, onClo copiedLabelClassName="text-xs font-normal" /> - + {/* Content */} diff --git a/ui/src/components/HubManagerModal.tsx b/ui/src/components/HubManagerModal.tsx index e60c218d1..9476a808b 100644 --- a/ui/src/components/HubManagerModal.tsx +++ b/ui/src/components/HubManagerModal.tsx @@ -1,8 +1,8 @@ import { useState, useEffect } from 'react'; import { Plus, Trash2, Server } from 'lucide-react'; import Card from './Card'; -import HandButton from './HandButton'; -import { HandInput } from './HandInput'; +import Button from './Button'; +import { Input } from './Input'; import { radius } from '../design'; export interface SavedHub { @@ -138,20 +138,20 @@ export default function HubManagerModal({ Built-in ) : confirmDelete === hub.url ? (
- handleDelete(hub.url)} > Confirm - - +
) : ( + diff --git a/ui/src/components/HandInput.tsx b/ui/src/components/Input.tsx similarity index 92% rename from ui/src/components/HandInput.tsx rename to ui/src/components/Input.tsx index 966970ff3..25f95ded3 100644 --- a/ui/src/components/HandInput.tsx +++ b/ui/src/components/Input.tsx @@ -3,11 +3,11 @@ import type { InputHTMLAttributes, TextareaHTMLAttributes } from 'react'; import { Check, ChevronDown } from 'lucide-react'; import { radius, shadows } from '../design'; -interface HandInputProps extends InputHTMLAttributes { +interface InputProps extends InputHTMLAttributes { label?: string; } -export function HandInput({ label, className = '', style, id, ...props }: HandInputProps) { +export function Input({ label, className = '', style, id, ...props }: InputProps) { const autoId = useId(); const inputId = id ?? autoId; @@ -41,11 +41,11 @@ export function HandInput({ label, className = '', style, id, ...props }: HandIn ); } -interface HandTextareaProps extends TextareaHTMLAttributes { +interface TextareaProps extends TextareaHTMLAttributes { label?: string; } -export function HandTextarea({ label, className = '', style, id, ...props }: HandTextareaProps) { +export function Textarea({ label, className = '', style, id, ...props }: TextareaProps) { const autoId = useId(); const inputId = id ?? autoId; @@ -85,7 +85,7 @@ export interface SelectOption { description?: string; } -interface HandSelectProps { +interface SelectProps { label?: string; value: string; onChange: (value: string) => void; @@ -93,7 +93,7 @@ interface HandSelectProps { className?: string; } -export function HandSelect({ label, value, onChange, options, className = '' }: HandSelectProps) { +export function Select({ label, value, onChange, options, className = '' }: SelectProps) { const [open, setOpen] = useState(false); const [focusIdx, setFocusIdx] = useState(-1); const containerRef = useRef(null); @@ -238,14 +238,14 @@ export function HandSelect({ label, value, onChange, options, className = '' }: ); } -interface HandCheckboxProps { +interface CheckboxProps { label: string; checked: boolean; onChange: (checked: boolean) => void; className?: string; } -export function HandCheckbox({ label, checked, onChange, className = '' }: HandCheckboxProps) { +export function Checkbox({ label, checked, onChange, className = '' }: CheckboxProps) { return (