'use client' import { useState, useEffect } from 'react' import { SettingsNav, SettingsSection, SettingToggle, SettingSelect } from '@/components/settings' import { useLanguage } from '@/lib/i18n' import { updateAISettings, getAISettings } from '@/app/actions/ai-settings' export default function GeneralSettingsPage() { const { t } = useLanguage() const [language, setLanguage] = useState('auto') const [emailNotifications, setEmailNotifications] = useState(false) const [desktopNotifications, setDesktopNotifications] = useState(false) const [anonymousAnalytics, setAnonymousAnalytics] = useState(false) // Load settings on mount useEffect(() => { async function loadSettings() { try { const settings = await getAISettings() if (settings.preferredLanguage) setLanguage(settings.preferredLanguage) if (settings.emailNotifications !== undefined) setEmailNotifications(settings.emailNotifications) if (settings.desktopNotifications !== undefined) setDesktopNotifications(settings.desktopNotifications) if (settings.anonymousAnalytics !== undefined) setAnonymousAnalytics(settings.anonymousAnalytics) } catch (error) { console.error('Error loading settings:', error) } } loadSettings() }, []) const handleLanguageChange = async (value: string) => { setLanguage(value) await updateAISettings({ preferredLanguage: value as any }) } const handleEmailNotificationsChange = async (enabled: boolean) => { setEmailNotifications(enabled) await updateAISettings({ emailNotifications: enabled }) } const handleDesktopNotificationsChange = async (enabled: boolean) => { setDesktopNotifications(enabled) await updateAISettings({ desktopNotifications: enabled }) } const handleAnonymousAnalyticsChange = async (enabled: boolean) => { setAnonymousAnalytics(enabled) await updateAISettings({ anonymousAnalytics: enabled }) } return (

General Settings

Configure basic application preferences

🌍} description="Choose your preferred language and regional settings" > 🔔} description="Manage how and when you receive notifications" > 🔒} description="Control your privacy settings" >
) }