import React from 'react'; import { View, Text, TouchableOpacity, ScrollView } from 'react-native'; import { useNavigation, CompositeNavigationProp, } from '@react-navigation/native'; import { BottomTabNavigationProp } from '@react-navigation/bottom-tabs'; import { StackNavigationProp } from '@react-navigation/stack'; import { getStyles } from './accountScreen.styles'; import { Header, PrimaryButton } from '@components'; import { useAppTheme } from '@theme'; import { logout } from '../../../store/commonreducers/auth'; import { AppStackParamList } from '../../../navigation/appStack'; import { MainTabParamList } from '../../../navigation/mainTabNavigator'; import { useAppDispatch, useAppSelector } from '@store'; type AccountNavProp = CompositeNavigationProp< BottomTabNavigationProp, StackNavigationProp >; interface MenuItemData { icon: string; label: string; subLabel: string; tint: string; onPress?: (navigation: AccountNavProp) => void; } interface MenuSectionData { title: string; items: MenuItemData[]; } const MENU_SECTIONS: MenuSectionData[] = [ { title: 'Account', items: [ { icon: '📍', label: 'My Addresses', subLabel: 'Manage delivery addresses', tint: '#FDECEA', }, { icon: '💳', label: 'Payment Methods', subLabel: 'Cards, UPI & wallets', tint: '#FFF4E5', }, { icon: '🔔', label: 'Notifications', subLabel: 'Alerts, offers & updates', tint: '#FFF9DB', }, ], }, { title: 'Support & Legal', items: [ { icon: '❓', label: 'Help & Support', subLabel: 'FAQs and contact us', tint: '#EAF4FF', onPress: navigation => navigation.navigate('HelpSupportScreen'), }, { icon: '📋', label: 'Terms & Conditions', subLabel: 'Our terms of service', tint: '#F1F0FF', }, { icon: '🔒', label: 'Privacy Policy', subLabel: 'How we handle your data', tint: '#E9F7EF', }, ], }, ]; export const AccountScreen: React.FC = () => { const { colors } = useAppTheme(); const styles = getStyles(colors); const dispatch = useAppDispatch(); const navigation = useNavigation(); const user = useAppSelector(state => state.auth.user); // TODO: wire these to real selectors once order/wallet state is available. // const ordersCount = user?.ordersCount ?? 0; // const savedAddressesCount = user?.addressesCount ?? 0; // const walletBalance = user?.walletBalance ?? 0; return (
{/* Profile card */} {user?.name?.charAt(0)?.toUpperCase() || 'U'} ✏️ {user?.name || 'User'} 📞 {user?.mobileNumber || '+91 98765 43210'} Edit Profile {/* Quick stats */} {/* {ordersCount} Orders {savedAddressesCount} Addresses ₹{walletBalance} Wallet */} {/* Menu sections */} {MENU_SECTIONS.map(section => ( {section.title} {section.items.map((item, index) => { const isLast = index === section.items.length - 1; return ( item.onPress?.(navigation)} > {item.icon} {item.label} {item.subLabel} {'>'} ); })} ))} {/* Logout */} dispatch(logout())} /> App version 1.0.0 ); };