delete account added
This commit is contained in:
@@ -206,5 +206,7 @@
|
|||||||
"Bir Zumda Jonatish": "Express Send Info",
|
"Bir Zumda Jonatish": "Express Send Info",
|
||||||
"Hammasi": "All",
|
"Hammasi": "All",
|
||||||
"Bekor qilish": "Cancel",
|
"Bekor qilish": "Cancel",
|
||||||
"Barchasi o'qildi": "Mark All as Read"
|
"Barchasi o'qildi": "Mark All as Read",
|
||||||
|
"Hisobni o'chirish": "Delete account",
|
||||||
|
"Rostdan ham hisobingizni o‘chirmoqchimisiz?": "Are you sure you want to delete your account?"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -205,5 +205,7 @@
|
|||||||
"Bir Zumda Jonatish": "Экспресс Рассылки Инфо",
|
"Bir Zumda Jonatish": "Экспресс Рассылки Инфо",
|
||||||
"Hammasi": "Все",
|
"Hammasi": "Все",
|
||||||
"Bekor qilish": "Отменить",
|
"Bekor qilish": "Отменить",
|
||||||
"Barchasi o'qildi": "Отметить все как прочитанное"
|
"Barchasi o'qildi": "Отметить все как прочитанное",
|
||||||
|
"Hisobni o'chirish": "Удалить аккаунт",
|
||||||
|
"Rostdan ham hisobingizni o'chirmoqchimisiz?": "Вы уверены, что хотите удалить свой аккаунт?"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -205,5 +205,7 @@
|
|||||||
"Bir Zumda Jonatish": "Bir Zumda Jonatish",
|
"Bir Zumda Jonatish": "Bir Zumda Jonatish",
|
||||||
"Hammasi": "Hammasi",
|
"Hammasi": "Hammasi",
|
||||||
"Bekor qilish": "Bekor qilish",
|
"Bekor qilish": "Bekor qilish",
|
||||||
"Barchasi o'qildi": "Barchasi o'qildi"
|
"Barchasi o'qildi": "Barchasi o'qildi",
|
||||||
|
"Hisobni o'chirish": "Hisobni o'chirish",
|
||||||
|
"Rostdan ham hisobingizni o'chirmoqchimisiz?": "Rostdan ham hisobingizni o'chirmoqchimisiz?"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,21 +14,32 @@ import {
|
|||||||
Megaphone,
|
Megaphone,
|
||||||
Package,
|
Package,
|
||||||
Settings,
|
Settings,
|
||||||
|
Trash2,
|
||||||
User,
|
User,
|
||||||
Users,
|
Users
|
||||||
} from 'lucide-react-native';
|
} from 'lucide-react-native';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { ScrollView, StyleSheet, Text, TouchableOpacity, View } from 'react-native';
|
import { Alert, ScrollView, StyleSheet, Text, TouchableOpacity, View } from 'react-native';
|
||||||
import { RefreshControl } from 'react-native-gesture-handler';
|
import { RefreshControl } from 'react-native-gesture-handler';
|
||||||
import { user_api } from '../lib/api';
|
import { user_api } from '../lib/api';
|
||||||
|
|
||||||
interface SectionType {
|
interface SectionType {
|
||||||
title: string;
|
title: string;
|
||||||
items: { icon: LucideIcon; label: string; route: string; badge?: number; image?: any }[];
|
items: {
|
||||||
|
icon: LucideIcon;
|
||||||
|
label: string;
|
||||||
|
route?: string;
|
||||||
|
badge?: number;
|
||||||
|
image?: any;
|
||||||
|
isDestructive?: boolean;
|
||||||
|
}[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
import { useAuth } from '@/components/AuthProvider';
|
||||||
|
|
||||||
export default function Profile() {
|
export default function Profile() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { logout } = useAuth();
|
||||||
const { onRefresh, refreshing } = useGlobalRefresh();
|
const { onRefresh, refreshing } = useGlobalRefresh();
|
||||||
const { isDark } = useTheme();
|
const { isDark } = useTheme();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@@ -80,6 +91,10 @@ export default function Profile() {
|
|||||||
items: [
|
items: [
|
||||||
{ icon: Settings, label: 'Sozlamalar', route: '/profile/settings' },
|
{ icon: Settings, label: 'Sozlamalar', route: '/profile/settings' },
|
||||||
{ icon: BookAIcon, label: "Foydalanish qo'llanmasi", route: '/profile/manual' },
|
{ icon: BookAIcon, label: "Foydalanish qo'llanmasi", route: '/profile/manual' },
|
||||||
|
{
|
||||||
|
icon: Trash2,
|
||||||
|
label: "Hisobni o'chirish",
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
@@ -108,20 +123,34 @@ export default function Profile() {
|
|||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
key={idx}
|
key={idx}
|
||||||
style={[styles.card, isDark ? styles.darkCard : styles.lightCard]}
|
style={[styles.card, isDark ? styles.darkCard : styles.lightCard]}
|
||||||
onPress={() => router.push(item.route as any)}
|
onPress={() => {
|
||||||
|
if (item.label === "Hisobni o'chirish") {
|
||||||
|
Alert.alert(
|
||||||
|
t("Hisobni o'chirish"),
|
||||||
|
t("Rostdan ham hisobingizni o'chirmoqchimisiz?"),
|
||||||
|
[
|
||||||
|
{ text: t('Bekor qilish'), style: 'cancel' },
|
||||||
|
{ text: t("O'chirish"), onPress: () => logout(), style: 'destructive' },
|
||||||
|
]
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
router.push(item.route as any);
|
||||||
|
}
|
||||||
|
}}
|
||||||
activeOpacity={0.7}
|
activeOpacity={0.7}
|
||||||
>
|
>
|
||||||
<View
|
<View style={[styles.iconContainer, isDark ? styles.darkIconBg : styles.lightIconBg]}>
|
||||||
style={[styles.iconContainer, isDark ? styles.darkIconBg : styles.lightIconBg]}
|
<item.icon
|
||||||
>
|
size={24}
|
||||||
<item.icon size={24} color="#3b82f6" />
|
color={item.label === "Hisobni o'chirish" ? '#ef4444' : '#3b82f6'}
|
||||||
|
/>
|
||||||
{item?.badge && (
|
{item?.badge && (
|
||||||
<View style={styles.badge}>
|
<View style={styles.badge}>
|
||||||
<Text style={styles.badgeText}>{item.badge}</Text>
|
<Text style={styles.badgeText}>{item.badge}</Text>
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<View style={{ flex: 1 }}>
|
<View style={{ flex: 1 }}>
|
||||||
{item.image ? (
|
{item.image ? (
|
||||||
<View style={{ flex: 1 }}>
|
<View style={{ flex: 1 }}>
|
||||||
@@ -130,24 +159,45 @@ export default function Profile() {
|
|||||||
style={{ width: '60%', height: 40 }}
|
style={{ width: '60%', height: 40 }}
|
||||||
contentFit="contain"
|
contentFit="contain"
|
||||||
/>
|
/>
|
||||||
<Text style={[styles.cardLabel, isDark ? styles.darkText : styles.lightText, { fontSize: 14, marginTop: 4, fontWeight: '500' }]}>
|
<Text
|
||||||
{t("Bir Zumda Jonatish")}
|
style={[
|
||||||
|
styles.cardLabel,
|
||||||
|
isDark ? styles.darkText : styles.lightText,
|
||||||
|
{ fontSize: 14, marginTop: 4, fontWeight: '500' },
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
{t('Bir Zumda Jonatish')}
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
) : (
|
) : (
|
||||||
<View>
|
<View>
|
||||||
<Text style={[styles.cardLabel, isDark ? styles.darkText : styles.lightText]}>
|
<Text
|
||||||
|
style={[
|
||||||
|
styles.cardLabel,
|
||||||
|
item.label === "Hisobni o'chirish"
|
||||||
|
? { color: '#ef4444' }
|
||||||
|
: isDark
|
||||||
|
? styles.darkText
|
||||||
|
: styles.lightText,
|
||||||
|
]}
|
||||||
|
>
|
||||||
{t(item.label)}
|
{t(item.label)}
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
<ChevronRight size={20} color={isDark ? '#64748b' : '#94a3b8'} />
|
|
||||||
|
<ChevronRight
|
||||||
|
size={20}
|
||||||
|
color={item.label === "Hisobni o'chirish" ? '#ef4444' : isDark ? '#64748b' : '#94a3b8'}
|
||||||
|
/>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
|
|
||||||
))}
|
))}
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
))}
|
))
|
||||||
|
}
|
||||||
</ScrollView >
|
</ScrollView >
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user