// apps/mobile/app/(tabs)/settings.tsx // Settings tab — account, backend, preferences // Design ref: docs/v3/designs/settings.html import { View, ScrollView, StyleSheet, Alert, Switch } from 'react-native' import { useSafeAreaInsets } from 'react-native-safe-area-context' import { MetalCard, PhosphorText, PhysicalButton, Led, AppStatusBar, d3roNativePalette } from '@d3ro/ui-native' import { useI18n } from '@d3ro/i18n' import { useAuth } from '../../lib/auth-context' import { supabase } from '../../lib/supabase' export default function SettingsScreen(): React.ReactElement { const insets = useSafeAreaInsets() const { t } = useI18n() const { user } = useAuth() async function handleLogout(): Promise { Alert.alert(t('mobile.set.logout'), t('mobile.set.logoutConfirm'), [ { text: t('mobile.rec.cancel'), style: 'cancel' }, { text: t('mobile.set.logout'), style: 'destructive', onPress: async () => { await supabase.auth.signOut() } } ]) } const initials = user?.email ? user.email.substring(0, 2).toUpperCase() : 'US' return ( {t('mobile.set.title')} {/* Account Section */} {t('mobile.set.accountPlan')} {initials} {user?.email?.split('@')[0] ?? 'User'} {user?.email ?? '\u2014'} {t('mobile.dash.tier')} {t('mobile.dash.free')} {/* Backend Section */} {t('mobile.set.backendConfig')} {t('mobile.set.llmModel')} {t('mobile.set.llmDesc')} CLAUDE {t('mobile.set.cloudStt')} {t('mobile.set.cloudSttDesc')} {/* Preferences Section */} {t('mobile.set.preferences')} {t('mobile.set.language')} Korean {t('mobile.set.autoPolish')} {t('mobile.set.haptic')} {/* Logout */} void handleLogout()} /> {/* Status Footer */} ) } const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: d3roNativePalette.bg.app }, content: { paddingBottom: 120 }, title: { paddingHorizontal: 20, paddingBottom: 12, borderBottomWidth: 1, borderBottomColor: d3roNativePalette.border.subtle }, sectionLabel: { paddingHorizontal: 24, paddingTop: 20, paddingBottom: 8, letterSpacing: 3 }, section: { marginHorizontal: 20, padding: 0, overflow: 'hidden' }, profileRow: { flexDirection: 'row', alignItems: 'center', padding: 16, gap: 12, borderBottomWidth: 1, borderBottomColor: d3roNativePalette.border.subtle }, avatar: { width: 40, height: 40, borderRadius: 20, backgroundColor: d3roNativePalette.bg.inset, borderWidth: 1, borderColor: d3roNativePalette.border.default, justifyContent: 'center', alignItems: 'center' }, profileInfo: { gap: 2 }, row: { flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', padding: 16 }, rowInset: { backgroundColor: d3roNativePalette.bg.inset }, rowBorder: { borderTopWidth: 1, borderTopColor: d3roNativePalette.border.subtle }, rowRight: { flexDirection: 'row', alignItems: 'center' }, rowValue: { marginLeft: 8 }, logoutWrap: { margin: 20 } })