import { useRef } from 'react' import { Animated, Image, Pressable, ScrollView, StyleSheet, Text, View } from 'react-native' import { useSafeAreaInsets } from 'react-native-safe-area-context' import { useRouter } from 'expo-router' import Ionicons from '@expo/vector-icons/Ionicons' import { useAuth } from '../../src/lib/AuthContext' import { imageUrl } from '../../src/lib/api' import { colors, radius, spacing } from '../../src/lib/theme' import Loader from '../../src/components/Loader' import Footer from '../../src/components/Footer' interface ProfileRowProps { icon: keyof typeof Ionicons.glyphMap label: string onPress: () => void danger?: boolean } function ProfileRow({ icon, label, onPress, danger }: ProfileRowProps) { const scale = useRef(new Animated.Value(1)).current function pressIn() { Animated.spring(scale, { toValue: 0.97, useNativeDriver: true, speed: 50 }).start() } function pressOut() { Animated.spring(scale, { toValue: 1, useNativeDriver: true, speed: 50 }).start() } return ( {label} {!danger && } ) } function LoginButton() { const router = useRouter() const scale = useRef(new Animated.Value(1)).current function pressIn() { Animated.spring(scale, { toValue: 0.96, useNativeDriver: true, speed: 50 }).start() } function pressOut() { Animated.spring(scale, { toValue: 1, useNativeDriver: true, speed: 50 }).start() } return ( router.push('/login')} onPressIn={pressIn} onPressOut={pressOut} > Войти ) } export default function ProfileScreen() { const insets = useSafeAreaInsets() const router = useRouter() const { user, loading, logout } = useAuth() if (loading) { return ( ) } const avatarUri = user ? imageUrl(user.avatar?.optimized?.preview || user.avatar?.preview) : undefined return ( Профиль {user ? ( {avatarUri ? ( ) : ( {user.nickname?.[0]?.toUpperCase() ?? '?'} )} {user.nickname} ) : ( Вы не вошли в аккаунт Войдите в аккаунт AniLiberty, чтобы синхронизировать избранное, списки и историю просмотра между устройствами )} router.push('/wishlist')} /> {user && ( <> router.push('/account/lists')} /> router.push('/account/history')} /> )} {user && ( )}