How niiiizzz/food4all works
Food4All is a role-based food redistribution frontend connecting restaurants, customers, NGOs and shelters, delivery workers, and administrators. The main flow begins with sign-in or registration, then routes users to role-specific dashboards. Restaurants manage menu items and surplus; customers browse, purchase, or donate food; organizations and delivery users have claim and delivery workspaces; customers can track orders. The shared React context holds users, food, orders, notifications, and reward state in memory. The README documents rewards, eco-scores, and impact analytics. Dashboard excerpts are partial, so uncertain subsystem wiring is omitted.
Main entry points: App.tsx Role Router · AppContext.tsx Shared App State · CustomerDashboard.tsx Customer Workspace · RestaurantDashboard.tsx Restaurant Workspace
Components 16
App Entry
- Role Router
App.tsx
Identity And Navigation
- Sign In And Signup
pages/Login.tsx - Role Navigation
components/Sidebar.tsx - Shared App State
context/AppContext.tsx - Seed Accounts
services/mockData.ts
Food Redistribution
- Restaurant Workspace
pages/dashboards/RestaurantDashboard.tsx - Customer Workspace
pages/dashboards/CustomerDashboard.tsx - NGO Workspace
pages/dashboards/NGODashboard.tsx
Order Fulfillment
- Delivery Workspace
pages/dashboards/DeliveryDashboard.tsx - Checkout Modal
components/PaymentModal.tsx - Order Tracking Map
components/LiveMap.tsx - QR Code Display
components/QRCodeDisplay.tsx - QR Scanner
components/QRScanner.tsx
Rewards And Oversight
- Admin Workspace
pages/dashboards/AdminDashboard.tsx - User Profile
components/ProfileView.tsx
Other components
- Platform User
Connections 25
- Platform User → Role Router: opens app
- Role Router → Sign In And Signup: shows when signed out
- Sign In And Signup → Shared App State: requests login
- Shared App State → Role Router: provides current user
- Role Router → Role Navigation: renders navigation
- Role Router → Customer Workspace: routes customer
- Role Router → Restaurant Workspace: routes restaurant
- Role Router → NGO Workspace: routes NGO
- Role Router → Delivery Workspace: routes delivery
- Role Router → Admin Workspace: routes admin
- Shared App State → Seed Accounts: initializes from
- Restaurant Workspace → Shared App State: manages food
- Customer Workspace → Shared App State: reads food and orders
- Customer Workspace → Checkout Modal: opens checkout
- Checkout Modal → Customer Workspace: returns quantity
- Customer Workspace → Shared App State: places order
- Customer Workspace → Order Tracking Map: shows order tracking
- Customer Workspace → QR Code Display: presents verification code
- Delivery Workspace → QR Scanner: provides delivery workspace
- NGO Workspace → Shared App State: uses shared state
- Delivery Workspace → Shared App State: uses shared state
- Admin Workspace → Shared App State: reads users and activity
- Restaurant Workspace → User Profile: shows profile
- Customer Workspace → User Profile: shows profile
- Admin Workspace → User Profile: shows profile