How hafizmanap/campuseats-2410285 works
CampusEats is a React app for browsing campus food vendors, adding menu items and specials to a cart, and placing and managing orders. Users can register or sign in (including with Google); authentication protects cart and order pages. Vendor and order data are backed by Firebase, while cart state is persisted in browser storage. The source index and excerpts support the main route and service relationships; some UI and Firebase details are unsampled, so those links are omitted where their callers are not evidenced.
Main entry points: App.jsx Application router · CartPage.jsx Cart and checkout · VendorPage.jsx Vendor menu · AuthProvider.jsx Authentication state
Components 28
App and routes
- Application router
src/App.jsx
Identity
- Login
src/pages/LoginPage.jsx - Registration
src/pages/RegisterPage.jsx - Authentication state
src/context/AuthProvider.jsx - Auth hook
src/hooks/useAuth.js - Auth error messages
src/authErrors.js - Protected routes
src/components/ProtectedRoute.jsx
Vendor browsing
- Vendor home
src/pages/HomePage.jsx - Vendor menu
src/pages/VendorPage.jsx - Vendor data hooks
src/hooks/useVendors.js - Vendor services
src/services/vendors.js - Vendor cards
src/components/VendorCard.jsx - Menu list
src/components/MenuList.jsx - Daily special
src/components/DailySpecial.jsx
Cart and orders
- Cart and checkout
src/pages/CartPage.jsx - Checkout form
src/components/CheckOutForm.jsx - Cart item
src/components/CartItem.jsx - Order history
src/pages/OrdersPage.jsx - Order subscription hook
src/hooks/useMyOrders.js - Order services
src/services/orders.js - Order actions
src/components/OrderActions.jsx
State and Firebase
- Cart state
src/context/CartProvider.jsx - Cart hook
src/hooks/useCart.js - Browser storage
src/hooks/useLocalStorage.js - Firebase setup
src/firebase.js
Other components
- CampusEats user
- Cloud Firestore
- Firebase Auth
Connections 37
- CampusEats user → Application router: opens
- Application router → Vendor home: routes to
src/App.jsx - Application router → Vendor menu: routes to
src/App.jsx - Application router → Login: routes to
src/App.jsx - Application router → Registration: routes to
src/App.jsx - Application router → Cart and checkout: routes to
src/App.jsx - Application router → Order history: routes to
src/App.jsx - Application router → Authentication state: provides auth
src/App.jsx - Application router → Cart state: provides cart
src/App.jsx - Application router → Protected routes: guards routes
src/App.jsx - Vendor home → Vendor data hooks: loads vendors
src/pages/HomePage.jsx - Vendor home → Vendor cards: renders vendors
src/pages/HomePage.jsx - Vendor data hooks → Vendor services: subscribes
src/hooks/useVendors.js - Vendor menu → Menu list: renders menu
src/pages/VendorPage.jsx - Vendor menu → Daily special: renders special
src/pages/VendorPage.jsx - Vendor menu → Vendor services: loads vendor
- Vendor services → Cloud Firestore: reads and seeds
src/services/vendors.js - Login → Auth hook: uses auth
src/pages/LoginPage.jsx - Registration → Auth hook: uses auth
src/pages/RegisterPage.jsx - Login → Auth error messages: formats errors
src/pages/LoginPage.jsx - Registration → Auth error messages: formats errors
src/pages/RegisterPage.jsx - Auth hook → Authentication state: reads context
src/hooks/useAuth.js - Authentication state → Firebase Auth: authenticates
src/context/AuthProvider.jsx - Authentication state → Firebase setup: uses auth config
src/context/AuthProvider.jsx - Protected routes → Auth hook: checks user
src/components/ProtectedRoute.jsx - Cart and checkout → Cart item: renders lines
src/pages/CartPage.jsx - Cart and checkout → Checkout form: renders checkout
src/pages/CartPage.jsx - Cart and checkout → Order services: places orders
src/pages/CartPage.jsx - Cart and checkout → Cart hook: uses cart
src/pages/CartPage.jsx - Order history → Order subscription hook: loads orders
src/pages/OrdersPage.jsx - Order history → Order actions: renders actions
src/pages/OrdersPage.jsx - Order subscription hook → Order services: subscribes
src/hooks/useMyOrders.js - Order actions → Order services: updates orders
src/components/OrderActions.jsx - Order services → Cloud Firestore: reads and writes
src/services/orders.js - Cart hook → Cart state: reads context
src/hooks/useCart.js - Cart state → Browser storage: persists cart
src/context/CartProvider.jsx - Firebase setup → Cloud Firestore: initializes
src/firebase.js