import { ScrollView, View, Text, Pressable, Switch } from 'react-native'; import { SafeAreaView } from 'react-native-safe-area-context'; import { useRouter } from 'expo-router'; import { Ionicons } from '@expo/vector-icons'; import { useState } from 'react'; import { useTranslation } from 'react-i18next'; import { useAuthStore } from '../stores/auth'; import { Card } from '../components/Card'; import { Button } from '../components/Button'; import { colors } from '../lib/theme'; type SettingRow = { label: string; sublabel?: string; icon: React.ComponentProps['name']; iconColor: string; onPress?: () => void; right?: React.ReactNode; }; export default function SettingsScreen() { const router = useRouter(); const { t } = useTranslation(); const { user, signOut } = useAuthStore(); const [notifPush, setNotifPush] = useState(true); const [notifStreak, setNotifStreak] = useState(true); const email = user?.email ?? ''; const initials = email.slice(0, 2).toUpperCase(); async function handleSignOut() { await signOut(); router.replace('/'); } const accountRows: SettingRow[] = [ { label: t('settings.edit_profile'), icon: 'pencil-outline', iconColor: '#6366f1', onPress: () => {}, }, { label: t('settings.devices'), sublabel: t('settings.devices_desc'), icon: 'phone-portrait-outline', iconColor: '#16a34a', onPress: () => {}, }, { label: t('settings.subscription'), sublabel: t('settings.plan_free'), icon: 'star-outline', iconColor: colors.brandOrange, onPress: () => {}, }, ]; const prefRows: SettingRow[] = [ { label: t('settings.push_notifications'), icon: 'notifications-outline', iconColor: '#2563eb', right: ( ), }, { label: t('settings.streak_reminders'), icon: 'flame-outline', iconColor: '#f97316', right: ( ), }, { label: t('settings.language'), sublabel: t('settings.language_current'), icon: 'language-outline', iconColor: '#a78bfa', onPress: () => {}, }, ]; return ( router.replace('/(app)' as never)} hitSlop={8} className="w-10 h-10 items-center justify-center" style={({ pressed }) => ({ opacity: pressed ? 0.6 : 1 })} > {t('settings.title')} {/* Account Card */} {initials} {email} {t('settings.plan_free')} {/* Account Section */} {t('settings.account_section')} {accountRows.map((row, i) => ( ({ opacity: pressed ? 0.7 : 1 })} > {row.label} {row.sublabel ? ( {row.sublabel} ) : null} {row.right ?? ( )} ))} {/* Preferences Section */} {t('settings.prefs_section')} {prefRows.map((row, i) => ( {row.label} {row.sublabel ? ( {row.sublabel} ) : null} {row.right ?? ( )} ))} {/* Danger Zone */} {t('settings.danger_section')} {t('settings.delete_desc')} ); }