/** * Theme Selector Component * Simplified theme selector for switching between themes */ import React, { useState } from 'react'; import { Button } from '@/components/ui/button'; import { Badge } from '@/components/ui/badge'; import { Label } from '@/components/ui/label'; import { Input } from '@/components/ui/input'; import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, DialogTrigger, } from '@/components/ui/dialog'; import { Tabs, TabsContent, TabsList, TabsTrigger, } from '@/components/ui/tabs'; import { Card, CardContent, CardHeader, CardTitle, } from '@/components/ui/card'; import { Palette, Paintbrush, Settings, RefreshCw } from 'lucide-react'; import { themes, type ThemeId } from '@/config/themes'; import { updateTheme } from '@/utils/theme-fix'; import { useTheme } from '@/hooks/useTheme'; interface ThemeSelectorProps { className?: string; } export function ThemeSelector({ className }: ThemeSelectorProps) { const { theme, themeId, setTheme, availableThemes, customizeTheme, resetTheme } = useTheme(); const [isOpen, setIsOpen] = useState(false); const [customColors, setCustomColors] = useState({ primary: theme.colors.primary[500], secondary: theme.colors.secondary[500], background: theme.colors.background, foreground: theme.colors.foreground, }); const handleThemeChange = (newThemeId: string) => { setTheme(newThemeId as ThemeId); }; const handleColorCustomization = () => { customizeTheme({ colors: { ...theme.colors, primary: { ...theme.colors.primary, 500: customColors.primary, }, secondary: { ...theme.colors.secondary, 500: customColors.secondary, }, background: customColors.background, foreground: customColors.foreground, }, }); }; const handleReset = () => { resetTheme(); setCustomColors({ primary: theme.colors.primary[500], secondary: theme.colors.secondary[500], background: theme.colors.background, foreground: theme.colors.foreground, }); }; return ( Theme Customization Choose from pre-built themes or customize your own color scheme Theme Presets Custom Colors
{Object.entries(availableThemes).map(([id, themeOption]) => ( handleThemeChange(id)} > {themeOption.name} {themeId === id && Current}
{/* Color preview */}
{/* Theme sample */}
Sample Card
This is how your content will look
))}

Color Customization

setCustomColors(prev => ({ ...prev, primary: e.target.value })) } className="w-20 h-10 p-1 border-0" /> setCustomColors(prev => ({ ...prev, primary: e.target.value })) } placeholder="#000000" className="flex-1" />
setCustomColors(prev => ({ ...prev, secondary: e.target.value })) } className="w-20 h-10 p-1 border-0" /> setCustomColors(prev => ({ ...prev, secondary: e.target.value })) } placeholder="#000000" className="flex-1" />
setCustomColors(prev => ({ ...prev, background: e.target.value })) } className="w-20 h-10 p-1 border-0" /> setCustomColors(prev => ({ ...prev, background: e.target.value })) } placeholder="hsl(222, 23%, 4%)" className="flex-1" />
setCustomColors(prev => ({ ...prev, foreground: e.target.value })) } className="w-20 h-10 p-1 border-0" /> setCustomColors(prev => ({ ...prev, foreground: e.target.value })) } placeholder="hsl(210, 40%, 98%)" className="flex-1" />

Preview

{/* Live preview */}
Preview Title
This is how your customized theme will look with the new colors.
Primary Button
Secondary Button
Sample Memory Card
This shows how memory cards will appear with your custom colors.
personal L2
); }