import React from 'react'; import { View, ScrollView, Pressable } from 'react-native'; import { useRouter } from 'expo-router'; import MaterialIcons from '@expo/vector-icons/MaterialIcons'; import { MyText, tw } from 'common-ui'; import { LinearGradient } from 'expo-linear-gradient'; import { theme } from 'common-ui/src/theme'; interface MenuItem { title: string; icon: string; description?: string; route: string; category: 'quick' | 'products' | 'orders' | 'marketing' | 'settings'; iconColor?: string; iconBg?: string; } interface MenuItemComponentProps { item: MenuItem; router: any; } const MenuItemComponent: React.FC = ({ item, router }) => ( router.push(item.route as any)} style={({ pressed }) => [ tw`flex-row items-center p-4 bg-white border border-gray-100 rounded-xl mb-3 shadow-sm`, pressed && tw`bg-gray-50`, ]} > {item.title} {item.description && ( {item.description} )} ); export default function Dashboard() { const router = useRouter(); const menuItems: MenuItem[] = [ { title: 'Manage Orders', icon: 'shopping-bag', description: 'View and manage customer orders', route: '/(drawer)/orders', category: 'orders', iconColor: '#10B981', iconBg: '#D1FAE5', }, { title: 'Delivery Sequences', icon: 'alt-route', description: 'Plan and optimize delivery routes', route: '/(drawer)/delivery-sequences', category: 'orders', iconColor: '#8B5CF6', iconBg: '#EDE9FE', }, { title: 'Delivery Slots', icon: 'schedule', description: 'Configure delivery times', route: '/(drawer)/slots' as any, category: 'quick', iconColor: '#06B6D4', iconBg: '#CFFAFE', }, { title: 'Add Product', icon: 'add-circle', description: 'Create a new product listing', route: '/(drawer)/add-product', category: 'quick', iconColor: theme.colors.brand500, iconBg: theme.colors.brand50, }, { title: 'Complaints', icon: 'report-problem', description: 'Handle customer complaints', route: '/(drawer)/complaints', category: 'quick', iconColor: '#F59E0B', iconBg: '#FEF3C7', }, { title: 'Products', icon: 'inventory-2', description: 'Manage product catalog', route: '/(drawer)/products', category: 'products', iconColor: '#6366F1', iconBg: '#E0E7FF', }, { title: 'Prices Overview', icon: 'attach-money', description: 'Update product pricing', route: '/(drawer)/prices-overview', category: 'products', iconColor: '#059669', iconBg: '#ECFDF5', }, { title: 'Product Tags', icon: 'label', description: 'Organize with tags', route: '/(drawer)/product-tags', category: 'products', iconColor: '#EC4899', iconBg: '#FCE7F3', }, { title: 'Product Groupings', icon: 'category', description: 'Group products together', route: '/(drawer)/product-groupings', category: 'products', iconColor: '#8B5CF6', iconBg: '#F3E8FF', }, { title: 'Stores', icon: 'store', description: 'Manage store locations', route: '/(drawer)/stores', category: 'settings', iconColor: '#14B8A6', iconBg: '#CCFBF1', }, { title: 'Coupons', icon: 'local-offer', description: 'Create discount coupons', route: '/(drawer)/coupons', category: 'marketing', iconColor: '#F97316', iconBg: '#FFEDD5', }, { title: 'Address Management', icon: 'location-on', description: 'Manage service areas', route: '/(drawer)/address-management', category: 'settings', iconColor: '#EAB308', iconBg: '#FEF9C3', }, { title: 'App Constants', icon: 'settings-applications', description: 'Customize app settings', route: '/(drawer)/customize-app', category: 'settings', iconColor: '#7C3AED', iconBg: '#F3E8FF', }, ]; const quickActions = menuItems.filter(item => item.category === 'quick'); const categories = [ { key: 'orders', title: 'Orders', icon: 'receipt-long' }, { key: 'products', title: 'Products & Inventory', icon: 'inventory' }, { key: 'marketing', title: 'Marketing & Promotions', icon: 'campaign' }, { key: 'settings', title: 'Settings & Configuration', icon: 'settings' }, ]; return ( {/* Header with Gradient */} {/* Dashboard Manage your business operations */} {/* Quick Actions */} Quick Actions {quickActions.map((item) => ( router.push(item.route as any)} style={({ pressed }) => [ tw`bg-white rounded-xl p-3 shadow-sm border border-gray-100 items-center`, { width: 'calc(25% - 9px)' }, pressed && tw`bg-gray-50`, ]} > {item.title} ))} {/* Categorized Menu Items */} {categories.map((category) => { const categoryItems = menuItems.filter(item => item.category === category.key); if (categoryItems.length === 0) return null; return ( {category.title} {categoryItems.map(item => )} ); })} ); }