import { useCallback } from 'react';
import {
View, Text, StyleSheet, Pressable, ScrollView, Alert,
} from 'react-native';
import Animated, { FadeIn, FadeInDown } from 'react-native-reanimated';
import { useSafeAreaInsets } from 'react-native-safe-area-context';
import { Image } from 'expo-image';
import { LinearGradient } from 'expo-linear-gradient';
import Svg, { Path, Polyline } from 'react-native-svg';
import * as Haptics from 'expo-haptics';
import { router } from 'expo-router';
import { Colors, Font, Spacing, Radius, TAB_BAR_HEIGHT, MINI_PLAYER_HEIGHT } from '../../constants/theme';
import { useAuth } from '../../store';
import { logout } from '../../hooks/useAuth';
export default function ProfileScreen() {
const { user } = useAuth();
const insets = useSafeAreaInsets();
const handleLogout = useCallback(() => {
Alert.alert('Выход', 'Выйти из аккаунта?', [
{ text: 'Отмена', style: 'cancel' },
{
text: 'Выйти', style: 'destructive',
onPress: async () => {
Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Medium);
await logout();
router.replace('/auth');
},
},
]);
}, []);
if (!user) return null;
const initials = (user.username || user.email).slice(0, 2).toUpperCase();
return (
Профиль
{user.avatar_url ? (
) : (
{initials}
)}
{user.username || 'Пользователь'}
{user.email}
{user.plan === 'free' ? 'Free' : 'Pro'}
Аккаунт
Выйти из аккаунта
Burmalda Music · v1.0.7 BETA · by NodeShift
);
}
function InfoRow({ label, value }: { label: string; value: string }) {
return (
{label}
{value}
);
}
const styles = StyleSheet.create({
scroll: { flex: 1, backgroundColor: Colors.bg },
content: { paddingHorizontal: Spacing.md },
pageTitle: { color: Colors.text, fontSize: Font.xxl, fontWeight: '800', letterSpacing: -0.5, marginBottom: Spacing.lg },
avatarCard: { borderRadius: Radius.xl, overflow: 'hidden', marginBottom: Spacing.xl },
avatarCardGrad: { padding: Spacing.xl, alignItems: 'center', gap: Spacing.sm },
avatar: { width: 88, height: 88, borderRadius: 44, marginBottom: Spacing.sm },
avatarPlaceholder: { width: 88, height: 88, borderRadius: 44, backgroundColor: Colors.elevated, alignItems: 'center', justifyContent: 'center', marginBottom: Spacing.sm },
avatarInitials: { color: Colors.text, fontSize: Font.xxl, fontWeight: '800' },
displayName: { color: Colors.text, fontSize: Font.xl, fontWeight: '700' },
email: { color: Colors.text2, fontSize: Font.sm },
planBadge: { paddingHorizontal: 12, paddingVertical: 4, borderRadius: Radius.full, backgroundColor: Colors.elevated, marginTop: 4 },
planBadgePro: { backgroundColor: Colors.accent + '22', borderWidth: 1, borderColor: Colors.accent + '44' },
planText: { color: Colors.text2, fontSize: Font.xs, fontWeight: '700' },
planTextPro: { color: Colors.accent },
section: { marginBottom: Spacing.lg },
sectionLabel: { color: Colors.text3, fontSize: Font.xs, fontWeight: '700', textTransform: 'uppercase', letterSpacing: 1, marginBottom: Spacing.sm },
infoRow: { flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', paddingVertical: 12, borderBottomWidth: StyleSheet.hairlineWidth, borderBottomColor: Colors.border },
infoLabel: { color: Colors.text2, fontSize: Font.md },
infoValue: { color: Colors.text, fontSize: Font.md, fontWeight: '500', maxWidth: '55%', textAlign: 'right' },
logoutBtn: { flexDirection: 'row', alignItems: 'center', gap: Spacing.sm, backgroundColor: Colors.surface, padding: Spacing.md, borderRadius: Radius.md, marginBottom: Spacing.lg },
logoutText: { color: Colors.red, fontSize: Font.md, fontWeight: '600' },
version: { color: Colors.text3, fontSize: Font.xs, textAlign: 'center' },
});