/**
* BUS-Tickets - Profile Screen
* Copyright (c) 2024-2026 IT Enterprise
*/
import {
View,
Text,
ScrollView,
TouchableOpacity,
StyleSheet,
Alert,
} from 'react-native';
import { useRouter } from 'expo-router';
import { Ionicons } from '@expo/vector-icons';
import { useTheme } from '@/contexts/ThemeContext';
import { useAuth } from '@/contexts/AuthContext';
export default function ProfileScreen() {
const router = useRouter();
const { colors } = useTheme();
const { user, isAuthenticated, signOut } = useAuth();
const handleSignOut = () => {
Alert.alert(
'Sign Out',
'Are you sure you want to sign out?',
[
{ text: 'Cancel', style: 'cancel' },
{
text: 'Sign Out',
style: 'destructive',
onPress: async () => {
await signOut();
},
},
]
);
};
const styles = createStyles(colors);
if (!isAuthenticated) {
return (
Sign in to your account
Manage your profile, view booking history, and more
router.push('/auth/signin')}
>
Sign In
);
}
return (
{/* Profile Header */}
{user?.name?.charAt(0).toUpperCase() || 'U'}
{user?.name || 'User'}
{user?.email}
{/* Menu Items */}
Account
Personal Information
Payment Methods
Notifications
Privacy & Security
Support
Help Center
Contact Support
{/* Sign Out Button */}
Sign Out
);
}
const createStyles = (colors: any) =>
StyleSheet.create({
container: {
flex: 1,
backgroundColor: colors.background,
},
content: {
padding: 16,
},
emptyContainer: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
padding: 32,
},
emptyTitle: {
fontSize: 20,
fontWeight: '600',
color: colors.text,
marginTop: 16,
},
emptyText: {
fontSize: 16,
color: colors.textSecondary,
textAlign: 'center',
marginTop: 8,
},
signInButton: {
backgroundColor: colors.primary,
paddingHorizontal: 32,
paddingVertical: 12,
borderRadius: 8,
marginTop: 24,
},
signInButtonText: {
color: '#fff',
fontSize: 16,
fontWeight: '600',
},
header: {
alignItems: 'center',
paddingVertical: 24,
},
avatarContainer: {
width: 80,
height: 80,
borderRadius: 40,
backgroundColor: colors.primary,
justifyContent: 'center',
alignItems: 'center',
},
avatarText: {
fontSize: 32,
fontWeight: '600',
color: '#fff',
},
userName: {
fontSize: 24,
fontWeight: '600',
color: colors.text,
marginTop: 12,
},
userEmail: {
fontSize: 16,
color: colors.textSecondary,
marginTop: 4,
},
menuSection: {
marginTop: 24,
},
menuSectionTitle: {
fontSize: 14,
fontWeight: '600',
color: colors.textSecondary,
textTransform: 'uppercase',
marginBottom: 8,
},
menuItem: {
flexDirection: 'row',
alignItems: 'center',
backgroundColor: colors.card,
padding: 16,
borderRadius: 12,
marginBottom: 8,
},
menuItemText: {
flex: 1,
fontSize: 16,
color: colors.text,
marginLeft: 12,
},
signOutButton: {
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'center',
backgroundColor: colors.card,
padding: 16,
borderRadius: 12,
marginTop: 32,
},
signOutText: {
fontSize: 16,
color: colors.error,
fontWeight: '600',
marginLeft: 8,
},
});