import React from 'react';
import { useTranslation } from 'react-i18next';
import { usePersonalizationStore } from '../../store/personalizationStore';
import { Sparkles, Sliders, Type, Palette, Zap, Info } from 'lucide-react';
const ARCHETYPES = [
"shonen_hero", "seinen_mystery", "cyberpunk", "tsundere", "kuudere", "yandere",
"shonen", "seinen", "mahou_shoujo", "isekai", "slice_of_life", "mecha",
"horror", "fantasy", "romance", "psychological", "sports"
];
export const PersonalizationPanel: React.FC = () => {
const { t } = useTranslation();
const { settings, updateSettings, isPersonalizationEnabled, setPersonalizationEnabled } = usePersonalizationStore();
if (!isPersonalizationEnabled) {
return (
{t('personalization.disabled_text', 'Hyper-Personalization is currently disabled.')}
setPersonalizationEnabled(true)}
className="w-full py-3 bg-blue-500 text-white text-xs font-black italic uppercase tracking-widest rounded-xl hover:bg-blue-600 transition shadow-lg"
>
{t('personalization.enable_button', 'Enable System')}
);
}
return (
{/* Mode Selection */}
{t('personalization.mode_title', 'Personalization Mode')}
{settings.mode === 'auto' ? t('personalization.mode_auto', 'Autonomous Evolution') : t('personalization.mode_manual', 'Manual Selection')}
updateSettings({ mode: 'auto' })}
className={`flex-1 px-2 py-1.5 text-[10px] font-black uppercase rounded-lg transition-all ${settings.mode === 'auto' ? 'bg-white dark:bg-white/10 shadow-md text-blue-500' : 'text-gray-400 hover:text-gray-600 dark:hover:text-gray-300'}`}
>
{t('personalization.btn_auto', 'Auto')}
updateSettings({ mode: 'manual' })}
className={`flex-1 px-2 py-1.5 text-[10px] font-black uppercase rounded-lg transition-all ${settings.mode === 'manual' ? 'bg-white dark:bg-white/10 shadow-md text-orange-500' : 'text-gray-400 hover:text-gray-600 dark:hover:text-gray-300'}`}
>
{t('personalization.btn_manual', 'Manual')}
{/* Manual Selection Grid */}
{settings.mode === 'manual' && (
{ARCHETYPES.map(arch => (
updateSettings({ manual_archetype: arch })}
className={`p-2 text-[9px] font-black uppercase tracking-widest rounded-lg border-2 transition-all ${settings.manual_archetype === arch ? 'bg-orange-500/10 border-orange-500 text-orange-500' : 'bg-gray-50 dark:bg-black/20 border-transparent text-gray-400 hover:bg-gray-100 dark:hover:bg-white/5'}`}
>
{arch.replace('_', ' ')}
))}
)}
{/* Intensity Slider */}
{t('personalization.intensity_title', 'Aura Intensity')}
{Math.round(settings.intensity_multiplier * 100)}%
updateSettings({ intensity_multiplier: parseFloat(e.target.value) })}
aria-label={t('personalization.intensity_title', 'Aura Intensity')}
className="w-full h-2 bg-gray-200 dark:bg-black/40 rounded-full appearance-none cursor-pointer accent-blue-500"
/>
{t('personalization.intensity_subtle', 'Subtle')}
{t('personalization.intensity_normal', 'Normal')}
{t('personalization.intensity_overdrive', 'Overdrive')}
{/* Feature Toggles */}
updateSettings({ features: { ...settings.features, aura: !settings.features.aura } })}
className={`flex flex-col items-center gap-2 p-4 rounded-2xl border-2 transition-all ${settings.features.aura ? 'bg-brand-accent/10 border-brand-accent text-brand-accent shadow-lg shadow-brand-accent/5' : 'bg-gray-50 dark:bg-black/20 border-transparent text-gray-400 opacity-50 hover:opacity-80'}`}
>
{t('personalization.feature_aura', 'Aura')}
updateSettings({ features: { ...settings.features, font: !settings.features.font } })}
className={`flex flex-col items-center gap-2 p-4 rounded-2xl border-2 transition-all ${settings.features.font ? 'bg-blue-500/10 border-blue-500 text-blue-500 shadow-lg shadow-blue-500/5' : 'bg-gray-50 dark:bg-black/20 border-transparent text-gray-400 opacity-50 hover:opacity-80'}`}
>
{t('personalization.feature_fonts', 'Fonts')}
updateSettings({ features: { ...settings.features, accent: !settings.features.accent } })}
className={`flex flex-col items-center gap-2 p-4 rounded-2xl border-2 transition-all ${settings.features.accent ? 'bg-purple-500/10 border-purple-500 text-purple-500 shadow-lg shadow-purple-500/5' : 'bg-gray-50 dark:bg-black/20 border-transparent text-gray-400 opacity-50 hover:opacity-80'}`}
>
{t('personalization.feature_accent', 'Accent')}
{t('personalization.info_text', 'Your UI evolves dynamically based on your behavior. Manual mode allows you to "lock" a specific archetype, while Auto mode lets the system drift naturally.')}
);
};