🎨 fix(web): align UI and charts with theme tokens and presets
Improve theme switching fidelity (including system preference), extend design tokens so color presets tint real surfaces—not only primary/chrome—and refactor shared badges, tables, and dashboard visuals to semantic colors. Wire VChart series colors to `--chart-*` with safe fallbacks. **Changes** - **Theme runtime** (`theme-provider.tsx`): Validate stored theme cookie; keep `resolvedTheme` in sync with DOM + `(prefers-color-scheme)`; `resetTheme` respects `defaultTheme`; memoized context value. - **Tokens** (`theme.css`): Add `--success|warning|info|neutral` (+ foregrounds) and map them under `@theme inline` for Tailwind utilities. - **Presets** (`theme-presets.css`): For non-`default` presets, derive `card`, `popover`, `muted`, `accent`, `border`, `input`, and sidebar tokens from `--primary`/`--background`; map semantic status colors to preset chart variables. - **Components**: `status-badge`, `colors` (avatars, announcements), `copy-button`, `group-badge`, `data-table` row styles, `sidebar` outline shadow (fix `var(--sidebar-border)` usage), ai-elements tool/web-preview status colors. - **Dashboard**: Latency/API helpers and overview fragments use semantic tokens; `charts.ts` reads `--chart-1`…`--chart-5` from computed styles with fallbacks; `processChartData` / `processUserChartData` accept optional `themeKey` for preset churn; chart components pass `customization.preset` and bump `VChart` keys. **Verification** - `bun run typecheck`
This commit is contained in:
+40
-40
@@ -6,51 +6,51 @@ import { cn } from '@/lib/utils'
|
||||
import { useCopyToClipboard } from '@/hooks/use-copy-to-clipboard'
|
||||
|
||||
export const dotColorMap = {
|
||||
success: 'bg-emerald-500',
|
||||
warning: 'bg-amber-500',
|
||||
danger: 'bg-rose-500',
|
||||
info: 'bg-sky-500',
|
||||
neutral: 'bg-slate-400',
|
||||
purple: 'bg-purple-500',
|
||||
amber: 'bg-amber-500',
|
||||
blue: 'bg-blue-500',
|
||||
cyan: 'bg-cyan-500',
|
||||
green: 'bg-green-500',
|
||||
grey: 'bg-gray-500',
|
||||
indigo: 'bg-indigo-500',
|
||||
'light-blue': 'bg-sky-500',
|
||||
'light-green': 'bg-green-500',
|
||||
lime: 'bg-lime-500',
|
||||
orange: 'bg-orange-500',
|
||||
pink: 'bg-pink-500',
|
||||
red: 'bg-red-500',
|
||||
teal: 'bg-teal-500',
|
||||
violet: 'bg-violet-500',
|
||||
yellow: 'bg-yellow-500',
|
||||
success: 'bg-success',
|
||||
warning: 'bg-warning',
|
||||
danger: 'bg-destructive',
|
||||
info: 'bg-info',
|
||||
neutral: 'bg-neutral',
|
||||
purple: 'bg-chart-4',
|
||||
amber: 'bg-warning',
|
||||
blue: 'bg-chart-1',
|
||||
cyan: 'bg-chart-2',
|
||||
green: 'bg-success',
|
||||
grey: 'bg-neutral',
|
||||
indigo: 'bg-chart-1',
|
||||
'light-blue': 'bg-info',
|
||||
'light-green': 'bg-success',
|
||||
lime: 'bg-chart-3',
|
||||
orange: 'bg-warning',
|
||||
pink: 'bg-chart-5',
|
||||
red: 'bg-destructive',
|
||||
teal: 'bg-chart-2',
|
||||
violet: 'bg-chart-4',
|
||||
yellow: 'bg-warning',
|
||||
} as const
|
||||
|
||||
export const textColorMap = {
|
||||
success: 'text-emerald-700 dark:text-emerald-400',
|
||||
warning: 'text-amber-700 dark:text-amber-400',
|
||||
danger: 'text-rose-700 dark:text-rose-400',
|
||||
info: 'text-sky-700 dark:text-sky-400',
|
||||
success: 'text-success',
|
||||
warning: 'text-warning',
|
||||
danger: 'text-destructive',
|
||||
info: 'text-info',
|
||||
neutral: 'text-muted-foreground',
|
||||
purple: 'text-purple-700 dark:text-purple-400',
|
||||
amber: 'text-amber-700 dark:text-amber-400',
|
||||
blue: 'text-blue-700 dark:text-blue-400',
|
||||
cyan: 'text-cyan-700 dark:text-cyan-400',
|
||||
green: 'text-green-700 dark:text-green-400',
|
||||
purple: 'text-chart-4',
|
||||
amber: 'text-warning',
|
||||
blue: 'text-chart-1',
|
||||
cyan: 'text-chart-2',
|
||||
green: 'text-success',
|
||||
grey: 'text-muted-foreground',
|
||||
indigo: 'text-indigo-700 dark:text-indigo-400',
|
||||
'light-blue': 'text-sky-700 dark:text-sky-400',
|
||||
'light-green': 'text-green-600 dark:text-green-400',
|
||||
lime: 'text-lime-700 dark:text-lime-400',
|
||||
orange: 'text-orange-700 dark:text-orange-400',
|
||||
pink: 'text-pink-700 dark:text-pink-400',
|
||||
red: 'text-red-700 dark:text-red-400',
|
||||
teal: 'text-teal-700 dark:text-teal-400',
|
||||
violet: 'text-violet-700 dark:text-violet-400',
|
||||
yellow: 'text-yellow-700 dark:text-yellow-400',
|
||||
indigo: 'text-chart-1',
|
||||
'light-blue': 'text-info',
|
||||
'light-green': 'text-success',
|
||||
lime: 'text-chart-3',
|
||||
orange: 'text-warning',
|
||||
pink: 'text-chart-5',
|
||||
red: 'text-destructive',
|
||||
teal: 'text-chart-2',
|
||||
violet: 'text-chart-4',
|
||||
yellow: 'text-warning',
|
||||
} as const
|
||||
|
||||
export type StatusVariant = keyof typeof dotColorMap
|
||||
|
||||
Reference in New Issue
Block a user