import React, { useCallback } from 'react'; import { View, Text, StyleSheet, ScrollView, TouchableOpacity, useColorScheme, Alert, Linking, } from 'react-native'; import { Ionicons } from '@expo/vector-icons'; import { Colors } from '../../constants/Colors'; import { getEnvironment } from '../../lib/api'; import { useAuthStore } from '../../stores/authStore'; import { config } from '../../lib/config'; interface SettingsRowProps { icon: keyof typeof Ionicons.glyphMap; title: string; value?: string; onPress?: () => void; showChevron?: boolean; } function SettingsRow({ icon, title, value, onPress, showChevron = true, }: SettingsRowProps) { const colorScheme = useColorScheme() ?? 'light'; const colors = Colors[colorScheme]; const content = ( {title} {value && ( {value} )} {showChevron && onPress && ( )} ); if (onPress) { return ( {content} ); } return content; } export default function SettingsScreen() { const colorScheme = useColorScheme() ?? 'light'; const colors = Colors[colorScheme]; const signOut = useAuthStore((state) => state.signOut); const isLoading = useAuthStore((state) => state.isLoading); const environment = getEnvironment(); const handleSignOut = useCallback(() => { Alert.alert( 'Sign Out', 'Are you sure you want to sign out?', [ { text: 'Cancel', style: 'cancel' }, { text: 'Sign Out', style: 'destructive', onPress: () => signOut(), }, ] ); }, [signOut]); const handleOpenUrl = useCallback((url: string) => { Linking.openURL(url); }, []); return ( {/* Account Section */} Account {}} /> {}} /> {}} /> {/* App Section */} App {/* Support Section */} Support handleOpenUrl(config.supportUrl)} /> handleOpenUrl(config.termsOfServiceUrl)} /> handleOpenUrl(config.privacyPolicyUrl)} /> {/* Sign Out */} Sign Out {/* Version */} Makima Mobile v1.0.0 ); } const styles = StyleSheet.create({ container: { flex: 1, }, content: { padding: 16, gap: 24, }, section: { gap: 8, }, sectionTitle: { fontSize: 13, fontWeight: '600', textTransform: 'uppercase', letterSpacing: 0.5, marginLeft: 16, }, card: { borderRadius: 12, overflow: 'hidden', }, row: { flexDirection: 'row', alignItems: 'center', padding: 12, paddingHorizontal: 16, borderBottomWidth: StyleSheet.hairlineWidth, gap: 12, }, iconContainer: { width: 32, height: 32, borderRadius: 8, alignItems: 'center', justifyContent: 'center', }, rowTitle: { flex: 1, fontSize: 16, }, rowValue: { fontSize: 14, }, signOutButton: { flexDirection: 'row', alignItems: 'center', justifyContent: 'center', padding: 16, borderRadius: 12, gap: 8, }, signOutText: { fontSize: 16, fontWeight: '600', color: '#ef4444', }, version: { textAlign: 'center', fontSize: 12, marginTop: 8, }, });