import React from 'react'; import { View, Text, TouchableOpacity, StyleSheet, SafeAreaView, ScrollView, StatusBar, Alert, } from 'react-native'; import { useTranslation } from 'react-i18next'; import { useLanguage } from '../contexts/LanguageContext'; import { languages } from '../i18n'; import { KurdistanColors } from '../theme/colors'; interface SettingsScreenProps { onBack: () => void; onLogout: () => void; } const SettingsScreen: React.FC = ({ onBack, onLogout }) => { const { t } = useTranslation(); const { currentLanguage, changeLanguage } = useLanguage(); const handleLanguageChange = async (languageCode: string) => { if (languageCode === currentLanguage) return; Alert.alert( 'Change Language', `Switch to ${languages.find(l => l.code === languageCode)?.nativeName}?`, [ { text: t('common.cancel'), style: 'cancel' }, { text: t('common.confirm'), onPress: async () => { await changeLanguage(languageCode); Alert.alert( t('common.success'), 'Language updated successfully! The app will now use your selected language.' ); }, }, ] ); }; const handleLogout = () => { Alert.alert( t('settings.logout'), 'Are you sure you want to logout?', [ { text: t('common.cancel'), style: 'cancel' }, { text: t('settings.logout'), style: 'destructive', onPress: onLogout, }, ] ); }; return ( {/* Header */} {t('settings.title')} {/* Language Section */} {t('settings.language')} {languages.map((language) => ( handleLanguageChange(language.code)} > {language.nativeName} {language.name} {currentLanguage === language.code && ( )} ))} {/* Theme Section */} {t('settings.theme')} Dark Mode Off {/* Notifications Section */} {t('settings.notifications')} Push Notifications Enabled Transaction Alerts Enabled {/* Security Section */} {t('settings.security')} Biometric Login Disabled Change Password {/* About Section */} {t('settings.about')} Version 1.0.0 Terms of Service Privacy Policy {/* Logout Button */} {t('settings.logout')} Pezkuwi Blockchain • {new Date().getFullYear()} ); }; const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: '#F5F5F5', }, header: { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', padding: 20, backgroundColor: KurdistanColors.spi, borderBottomWidth: 1, borderBottomColor: '#E0E0E0', }, backButton: { width: 40, height: 40, justifyContent: 'center', alignItems: 'center', }, backButtonText: { fontSize: 24, color: KurdistanColors.kesk, }, headerTitle: { fontSize: 18, fontWeight: '600', color: KurdistanColors.reş, }, placeholder: { width: 40, }, section: { marginTop: 20, paddingHorizontal: 20, }, sectionTitle: { fontSize: 14, fontWeight: '600', color: '#999', marginBottom: 12, textTransform: 'uppercase', }, languageItem: { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', backgroundColor: KurdistanColors.spi, padding: 16, borderRadius: 12, marginBottom: 8, borderWidth: 2, borderColor: 'transparent', }, languageItemActive: { borderColor: KurdistanColors.kesk, backgroundColor: '#F0FAF5', }, languageInfo: { flex: 1, }, languageName: { fontSize: 16, fontWeight: '600', color: KurdistanColors.reş, marginBottom: 4, }, languageNameActive: { color: KurdistanColors.kesk, }, languageSubtext: { fontSize: 14, color: '#999', }, checkmark: { width: 24, height: 24, borderRadius: 12, backgroundColor: KurdistanColors.kesk, justifyContent: 'center', alignItems: 'center', }, checkmarkText: { color: KurdistanColors.spi, fontSize: 14, fontWeight: 'bold', }, settingItem: { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', backgroundColor: KurdistanColors.spi, padding: 16, borderRadius: 12, marginBottom: 8, }, settingText: { fontSize: 16, color: KurdistanColors.reş, }, settingValue: { fontSize: 16, color: '#999', }, logoutButton: { backgroundColor: KurdistanColors.sor, margin: 20, padding: 16, borderRadius: 12, alignItems: 'center', shadowColor: KurdistanColors.sor, shadowOffset: { width: 0, height: 4 }, shadowOpacity: 0.3, shadowRadius: 6, elevation: 6, }, logoutButtonText: { fontSize: 16, fontWeight: 'bold', color: KurdistanColors.spi, }, footer: { alignItems: 'center', paddingVertical: 20, }, footerText: { fontSize: 12, color: '#999', }, }); export default SettingsScreen;