diff --git a/apps/rebreak-native/app/settings.tsx b/apps/rebreak-native/app/settings.tsx index c37be78..68b43c7 100644 --- a/apps/rebreak-native/app/settings.tsx +++ b/apps/rebreak-native/app/settings.tsx @@ -1,15 +1,20 @@ -import { ScrollView, View, Text, Pressable, Platform } from 'react-native'; -import { SafeAreaView } from 'react-native-safe-area-context'; +import { Alert, Platform, Pressable, ScrollView, Text, View } from 'react-native'; +import { useSafeAreaInsets } from 'react-native-safe-area-context'; import { useRouter } from 'expo-router'; import { Ionicons } from '@expo/vector-icons'; import { useTranslation } from 'react-i18next'; import { colors } from '../lib/theme'; +import { useAuthStore } from '../stores/auth'; +import { AppHeader } from '../components/AppHeader'; type SectionRow = { icon: React.ComponentProps['name']; iconColor: string; label: string; sublabel: string; + soon?: boolean; + destructive?: boolean; + onPress?: () => void; }; type Section = { @@ -20,7 +25,27 @@ type Section = { export default function SettingsScreen() { const router = useRouter(); + const insets = useSafeAreaInsets(); const { t } = useTranslation(); + const { signOut } = useAuthStore(); + + async function handleSignOut() { + Alert.alert( + t('auth.signOut'), + '', + [ + { text: t('common.cancel'), style: 'cancel' }, + { + text: t('auth.signOut'), + style: 'destructive', + onPress: async () => { + await signOut(); + router.replace('/'); + }, + }, + ], + ); + } const sections: Section[] = [ { @@ -32,12 +57,14 @@ export default function SettingsScreen() { iconColor: '#6366f1', label: t('settings.profile_edit'), sublabel: t('settings.profile_edit_desc'), + soon: true, }, { icon: 'image-outline', iconColor: '#6366f1', label: t('settings.profile_avatar'), sublabel: t('settings.profile_avatar_desc'), + soon: true, }, ], }, @@ -50,12 +77,14 @@ export default function SettingsScreen() { iconColor: '#a78bfa', label: t('settings.theme'), sublabel: t('settings.theme_desc'), + soon: true, }, { icon: 'language-outline', iconColor: '#a78bfa', label: t('settings.language'), sublabel: t('settings.language_desc'), + soon: true, }, ], }, @@ -68,12 +97,14 @@ export default function SettingsScreen() { iconColor: '#2563eb', label: t('settings.notifications_push'), sublabel: t('settings.notifications_push_desc'), + soon: true, }, { icon: 'flame-outline', iconColor: '#f97316', label: t('settings.notifications_streak'), sublabel: t('settings.notifications_streak_desc'), + soon: true, }, ], }, @@ -86,12 +117,14 @@ export default function SettingsScreen() { iconColor: '#16a34a', label: t('settings.devices'), sublabel: t('settings.devices_desc'), + soon: true, }, { icon: 'star-outline', iconColor: colors.brandOrange, label: t('settings.subscription'), sublabel: t('settings.subscription_desc'), + soon: true, }, ], }, @@ -104,6 +137,28 @@ export default function SettingsScreen() { iconColor: '#ec4899', label: t('settings.lyra_voice'), sublabel: t('settings.lyra_voice_desc'), + soon: true, + }, + ], + }, + { + key: 'account', + title: t('settings.danger_section'), + rows: [ + { + icon: 'log-out-outline', + iconColor: colors.textMuted, + label: t('settings.sign_out'), + sublabel: '', + onPress: handleSignOut, + }, + { + icon: 'trash-outline', + iconColor: colors.error, + label: t('settings.delete_account'), + sublabel: t('settings.delete_desc'), + destructive: true, + soon: true, }, ], }, @@ -119,52 +174,30 @@ export default function SettingsScreen() { iconColor: '#737373', label: t('settings.debug_llm'), sublabel: t('settings.debug_llm_desc'), + soon: true, }, { icon: 'volume-high-outline', iconColor: '#737373', label: t('settings.debug_tts'), sublabel: t('settings.debug_tts_desc'), + soon: true, }, ], }); } return ( - - - router.back()} - hitSlop={8} - style={({ pressed }) => ({ - width: 40, - height: 40, - alignItems: 'center', - justifyContent: 'center', - opacity: pressed ? 0.6 : 1, - })} - > - - - - {t('settings.title')} - - + + - + {t('settings.coming_soon_title')} @@ -200,7 +233,7 @@ export default function SettingsScreen() { {sections.map((section) => ( - + {section.rows.map((row, i) => ( - ({ flexDirection: 'row', alignItems: 'center', gap: 12, paddingHorizontal: 14, - paddingVertical: 14, + minHeight: 56, borderBottomWidth: i < section.rows.length - 1 ? 1 : 0, borderBottomColor: 'rgba(0,0,0,0.04)', - opacity: 0.5, - }} + opacity: row.soon ? 0.5 : pressed ? 0.7 : 1, + backgroundColor: pressed && !row.soon ? '#f5f5f5' : 'transparent', + })} > - + - - {row.label} - - {row.sublabel} + {row.label} + {row.sublabel ? ( + + {row.sublabel} + + ) : null} - - {t('settings.soon_badge')} - - + {row.soon ? ( + + {t('settings.soon_badge')} + + ) : ( + + )} + ))} @@ -306,6 +365,6 @@ export default function SettingsScreen() { {Platform.OS} - + ); }