From 13684d498bf4c184e6fcf9b694c055e11ef75bc8 Mon Sep 17 00:00:00 2001 From: Xin Wang Date: Tue, 10 Mar 2026 16:21:58 +0800 Subject: [PATCH] feat/fix(frontend): update shadcn compnents, fix debug drawer layout and font sizes --- web/components.json | 25 + web/components/UI.tsx | 329 +- web/components/ui/badge.tsx | 52 + web/components/ui/button.tsx | 58 + web/components/ui/card.tsx | 103 + web/components/ui/dialog.tsx | 157 + web/components/ui/input.tsx | 20 + web/components/ui/select.tsx | 201 ++ web/components/ui/sheet.tsx | 133 + web/components/ui/switch.tsx | 30 + web/components/ui/table.tsx | 116 + web/index.css | 158 + web/index.html | 113 +- web/index.tsx | 1 + web/lib/utils.ts | 6 + web/old_ui.txt | Bin 0 -> 21882 bytes web/package-lock.json | 4398 ++++++++++++++++++++++- web/package.json | 21 +- web/pages/Assistants.tsx | 6431 +++++++++++++++++----------------- web/vite.config.ts | 33 +- 20 files changed, 8700 insertions(+), 3685 deletions(-) create mode 100644 web/components.json create mode 100644 web/components/ui/badge.tsx create mode 100644 web/components/ui/button.tsx create mode 100644 web/components/ui/card.tsx create mode 100644 web/components/ui/dialog.tsx create mode 100644 web/components/ui/input.tsx create mode 100644 web/components/ui/select.tsx create mode 100644 web/components/ui/sheet.tsx create mode 100644 web/components/ui/switch.tsx create mode 100644 web/components/ui/table.tsx create mode 100644 web/index.css create mode 100644 web/lib/utils.ts create mode 100644 web/old_ui.txt diff --git a/web/components.json b/web/components.json new file mode 100644 index 0000000..46aa2f0 --- /dev/null +++ b/web/components.json @@ -0,0 +1,25 @@ +{ + "$schema": "https://ui.shadcn.com/schema.json", + "style": "base-nova", + "rsc": false, + "tsx": true, + "tailwind": { + "config": "", + "css": "index.css", + "baseColor": "neutral", + "cssVariables": true, + "prefix": "" + }, + "iconLibrary": "lucide", + "rtl": false, + "aliases": { + "components": "@/components", + "utils": "@/lib/utils", + "ui": "@/components/ui", + "lib": "@/lib", + "hooks": "@/hooks" + }, + "menuColor": "default", + "menuAccent": "subtle", + "registries": {} +} diff --git a/web/components/UI.tsx b/web/components/UI.tsx index ad9390d..15b77bc 100644 --- a/web/components/UI.tsx +++ b/web/components/UI.tsx @@ -1,63 +1,37 @@ - import React from 'react'; import { X } from 'lucide-react'; -// Button +// Shadcn UI Imports +import { Button as ShadcnButton } from './ui/button'; +import { Input as ShadcnInput } from './ui/input'; +import { Switch as ShadcnSwitch } from './ui/switch'; +import { Card as ShadcnCard } from './ui/card'; +import { Badge as ShadcnBadge } from './ui/badge'; +import { TableHeader as ShadcnTableHeader, TableRow as ShadcnTableRow, TableHead as ShadcnTableHead, TableCell as ShadcnTableCell } from './ui/table'; +import { Sheet, SheetContent, SheetHeader, SheetTitle } from './ui/sheet'; +import { Dialog as ShadcnDialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from './ui/dialog'; + +// Button Wrapper to match old API interface ButtonProps extends React.ButtonHTMLAttributes { variant?: 'primary' | 'secondary' | 'outline' | 'ghost' | 'destructive'; size?: 'sm' | 'md' | 'lg' | 'icon'; } +export const Button: React.FC = ({ variant = 'primary', size = 'md', className, ...props }) => { + const vMap: any = { primary: 'default', secondary: 'secondary', outline: 'outline', ghost: 'ghost', destructive: 'destructive' }; + const sMap: any = { sm: 'sm', md: 'default', lg: 'lg', icon: 'icon' }; + return ; +} -export const Button: React.FC = ({ - className = '', - variant = 'primary', - size = 'md', - children, - ...props -}) => { - const baseStyles = "inline-flex items-center justify-center rounded-md text-sm font-medium transition-all focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 active:scale-95"; - - const variants = { - // Primary: Glow effect - primary: "bg-primary text-primary-foreground shadow-[0_0_10px_rgba(6,182,212,0.5)] hover:bg-primary/90 hover:shadow-[0_0_15px_rgba(6,182,212,0.6)]", - secondary: "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80", - outline: "border border-input bg-transparent shadow-sm hover:bg-accent hover:text-accent-foreground hover:border-primary/50", - ghost: "hover:bg-accent hover:text-accent-foreground", - destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90", - }; - - const sizes = { - sm: "h-8 px-3 text-xs", - md: "h-9 px-4 py-2", - lg: "h-10 px-8", - icon: "h-9 w-9", - }; - - return ( - - ); -}; - -// Input - Removed border, added subtle background -interface InputProps extends React.InputHTMLAttributes {} - -export const Input: React.FC = ({ className = '', ...props }) => { - return ( - - ); -}; - -interface SelectProps extends React.SelectHTMLAttributes {} +// Input and Switch match seamlessly +export const Input = ShadcnInput; +export const Switch = ShadcnSwitch; +// Native Select Wrapper to avoid breaking consumers expecting +interface SelectProps extends React.SelectHTMLAttributes { } export const Select: React.FC = ({ className = '', children, ...props }) => { return (