import React from 'react'; import { useAdaptiveTheme } from '@/context/AdaptiveThemeContext'; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'; import { Button } from '@/components/ui/button'; import { Switch } from '@/components/ui/switch'; import { Label } from '@/components/ui/label'; import { Progress } from '@/components/ui/progress'; import { Slider } from '@/components/ui/slider'; import { Badge } from '@/components/ui/badge'; import { Separator } from '@/components/ui/separator'; import { useTranslation } from 'react-i18next'; import { Palette, Brain, Zap, Target, AlertTriangle, Sparkles, Clock, Sun, Moon, Sunset, Sunrise } from 'lucide-react'; export function ThemeControlPanel() { const { currentTheme, mood, updateMood, timeOfDay, isAdaptiveMode, toggleAdaptiveMode, manualOverride, setManualOverride, availableThemes, } = useAdaptiveTheme(); const { t } = useTranslation(); const getTimeIcon = (time: string) => { switch (time) { case 'morning': return ; case 'midday': return ; case 'afternoon': return ; case 'evening': return ; case 'night': return ; default: return ; } }; const getMoodColor = (value: number) => { if (value >= 80) return 'text-green-500'; if (value >= 60) return 'text-blue-500'; if (value >= 40) return 'text-yellow-500'; return 'text-red-500'; }; const handleThemeSelect = (themeName: string) => { if (manualOverride === themeName) { setManualOverride(null); } else { setManualOverride(themeName); } }; return (
{/* Header */}

{t('theme.adaptiveTitle', 'Adaptive Theme Control')}

{getTimeIcon(timeOfDay)} {timeOfDay}
{/* Adaptive Mode Toggle */} {t('theme.adaptiveMode', 'Adaptive Mode')} {t('theme.adaptiveModeDesc', 'Automatically adjust colors based on your mood and time of day')}
{/* Current Mood Display */} {isAdaptiveMode && ( {t('theme.currentMood', 'Current Mood Analysis')} {t('theme.moodDesc', 'Detected from your activity patterns and time of day')}
{mood.energy}%
{mood.focus}%
{mood.stress}%
{mood.creativity}%
)} {/* Manual Mood Adjustment */} {isAdaptiveMode && ( {t('theme.manualAdjustment', 'Manual Mood Adjustment')} {t('theme.manualAdjustmentDesc', 'Override automatic detection with manual settings')}
updateMood({ energy: value[0] || 0 })} max={100} step={1} className="w-full" />
updateMood({ focus: value[0] })} max={100} step={1} className="w-full" />
updateMood({ stress: value[0] })} max={100} step={1} className="w-full" />
updateMood({ creativity: value[0] })} max={100} step={1} className="w-full" />
)} {/* Theme Presets */} {t('theme.presets', 'Theme Presets')} {t('theme.presetsDesc', 'Override adaptive mode with predefined themes')}
{Object.entries(availableThemes).map(([name, theme]) => ( ))}
{manualOverride && ( )}
{/* Current Theme Preview */} {t('theme.currentTheme', 'Current Theme')} {manualOverride ? t('theme.manualTheme', `Manual: ${manualOverride}`) : t('theme.adaptiveTheme', 'Adaptive based on mood and time') }

{t('theme.primary', 'Primary')}

{t('theme.secondary', 'Secondary')}

{t('theme.accent', 'Accent')}

{t('theme.background', 'Background')}

{t('theme.foreground', 'Foreground')}

); }