import { View, Text, ScrollView, Pressable, Button, Alert } from 'react-native'; import React, { useContext } from 'react'; import { SafeAreaView } from 'react-native-safe-area-context'; import { router } from 'expo-router'; import { CrossLogoSvg, RightArrowIconSvg } from '../global/SVG'; import { AuthContext, useAuth } from '../../context/AuthProvider'; import { useTranslation } from '../../util/hooks/useTranslation'; const AccountSettingPageComponent = () => { const { user } = useContext(AuthContext); const { logout } = useAuth(); const { t } = useTranslation(); const genderText = user?.gender === 'woman' ? t('accountSettings.female') : user?.gender === 'man' ? t('accountSettings.male') : user?.gender; const handleDeletionAccount = () => { Alert.alert( t('accountSettings.delete_account'), t('accountSettings.delete_account_confirmation'), [ { text: t('common.cancel'), style: 'cancel' }, { text: t('accountSettings.delete'), style: 'destructive', onPress: async () => { try { logout(); // await walletService.deleteWallet(user.id); // Handle successful deletion (e.g., logout and redirect) // You might want to add additional logic here } catch (error) { console.error('Error deleting account:', error); Alert.alert(t('common.error'), t('accountSettings.delete_account_error')); } } } ] ); }; return ( { router.replace('/accountMainPage'); }} > {t('accountSettings.account_management')} router.push('changeEmailPage')}> {t('accountSettings.email')} {user?.email} router.push('changePasswordPage')}> {t('accountSettings.password')} ******** router.push('changeNamePage')}> {t('accountSettings.nickname')} {user?.nickname} router.push('changeGenderPage')}> {t('accountSettings.gender')} {genderText} router.push('changeCarPage')}> {t('accountSettings.license_plate')} {user?.car} {/* router.push('changePhonePage')}> {t('accountSettings.phone')} {user?.phone ? `+852 ${user.phone}` : t('accountSettings.no_phone')} */} ); }; export default AccountSettingPageComponent;