import type { CSSProperties, ReactNode, Ref } from 'react' import { IconCircleCheckFilled } from '@tabler/icons-react' import { AgentBlobatar } from '@/client/components/shared/agent-blobatar' import { useWorkspaceLayoutCtx } from '@/client/features/workspace/workspace-layout-context' import { BottomPanel } from '@/client/components/shared/bottom-panel' import { cn } from '@/client/lib/cn' import { getWorkspaceThemeStyle, usePreloadWorkspaceFonts } from '@/client/runtime/workspace-theme' import { AGENT_THEMES, type AgentThemeConfig, COLOR_THEMES, type ColorThemeConfig, FONT_THEMES, RADIUS_THEMES, type RadiusThemeConfig, resolveWorkspaceTheme } from '@/lib/themes' import type { AgentTheme, ColorTheme, FontTheme, RadiusTheme, WorkspaceTheme } from '@/lib/types' const FONT_OPTIONS = Object.entries(FONT_THEMES) as [FontTheme, (typeof FONT_THEMES)[FontTheme]][] const COLOR_OPTIONS = Object.entries(COLOR_THEMES) as [ColorTheme, ColorThemeConfig][] const RADIUS_OPTIONS = Object.entries(RADIUS_THEMES) as [RadiusTheme, RadiusThemeConfig][] const AGENT_OPTIONS = Object.entries(AGENT_THEMES) as [AgentTheme, AgentThemeConfig][] const THEME_OPTION_CLASS = 'relative w-full rounded-lg text-left ring-1 ring-border transition-opacity outline-none focus-visible:ring-3 focus-visible:ring-ring/50' type ThemeOptionGroupProps = { children: ReactNode className?: string gridClassName?: string label: string } function ThemeOptionGroup({ children, className, gridClassName, label }: ThemeOptionGroupProps) { return (

{label}

{children}
) } type ThemeOptionProps = { active: boolean children: ReactNode className?: string onSelect: () => void style?: CSSProperties } function ThemeOption({ active, children, className, onSelect, style }: ThemeOptionProps) { return ( ) } type ThemePanelProps = { onClose: () => void ref?: Ref } export function ThemePanel({ onClose, ref }: ThemePanelProps) { usePreloadWorkspaceFonts() const { layout, setLayout } = useWorkspaceLayoutCtx() const theme = resolveWorkspaceTheme(layout.theme) function setTheme(update: Partial) { setLayout({ theme: { ...theme, ...update } }) } return (
{FONT_OPTIONS.map(([key, config]) => ( setTheme({ font: key })} style={{ fontFamily: config.sans }} > {config.label} ))} {COLOR_OPTIONS.map(([key, preset]) => ( setTheme({ color: key })} style={getWorkspaceThemeStyle({ ...theme, color: key })} >
Aa {preset.label}
))}
{RADIUS_OPTIONS.map(([key, preset]) => ( setTheme({ radius: key })} style={getWorkspaceThemeStyle({ ...theme, radius: key })} >
))}
{AGENT_OPTIONS.map(([key, preset]) => ( setTheme({ agent: key })} >
{preset.label}
))}
) }