feat: admin auth, charts, backend service layer, frontend improvements#3
Open
AAYUSH412 wants to merge 1 commit intoLagadnakul:mainfrom
Open
feat: admin auth, charts, backend service layer, frontend improvements#3AAYUSH412 wants to merge 1 commit intoLagadnakul:mainfrom
AAYUSH412 wants to merge 1 commit intoLagadnakul:mainfrom
Conversation
Admin Panel: - Fix .env.local syntax (VITE_API_URL was invalid JS expression) - Implement api.js, foodService.js, orderService.js (were empty) - Add AuthContext, ProtectedRoute, admin Login page - Add 3 live recharts: Revenue, Orders by Status, Category - Fix Navbar to show real admin name with working logout - Fix Orders double /api/ URL bug + POST->PATCH status update - Fix food image URLs (use ImageKit CDN, not localhost) - Fix 'Cannot access handleFileSelection before initialization' crash - Fix orders filter showing empty list with empty search term - Add Pending status support across Orders page Backend: - Add isAdmin field to userModel - Add POST /user/admin/login endpoint (rejects non-admin with 403) - Add service layer (foodService, orderService, userService) - Add error-handler, logger, rate-limit middleware - Improve error handling across controllers Frontend: - Centralize API calls through api.js service - Add 14 shadcn/ui components - Fix ESLint errors (motion imports, smart quotes in Contact.jsx) - Add useOrders custom hook - Fix AddressesPage to use api.js instead of raw axios Docs: - Add DOCUMENTATION.md for admin, backend, frontend - Add CHANGES.md summarizing all changes
|
@AAYUSH412 is attempting to deploy a commit to the Nakul Lagad's projects Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Pull request overview
This PR implements a comprehensive admin authentication system, adds data visualization charts to the dashboard, introduces a service layer to the backend for better code organization, and includes numerous bug fixes and improvements across the admin panel and frontend.
Changes:
- Added JWT-based admin authentication with login page, AuthContext, and protected routes
- Implemented three live Recharts visualizations (Revenue, Orders by Status, Category distribution)
- Created backend service layer (foodService, orderService, userService) and improved error handling
- Fixed multiple critical bugs including incorrect API URLs, image loading issues, and filter logic
Reviewed changes
Copilot reviewed 117 out of 275 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/.agents/skills/ui-ux-pro-max/data/stacks/astro.csv | Added Astro framework best practices guideline data |
| frontend/.agents/skills/ui-ux-pro-max/data/landing.csv | Added landing page design pattern reference data |
| frontend/.agents/skills/ui-ux-pro-max/data/charts.csv | Added chart type selection and accessibility guidelines |
| frontend/.agents/skills/shadcn-ui/references/learn.md | Added shadcn/ui learning guide documentation |
| frontend/.agents/skills/shadcn-ui/references/chart.md | Added shadcn/ui chart component reference |
| frontend/.agents/skills/find-skills/SKILL.md | Added skill discovery system documentation |
| backend/vercel.json | Removed hardcoded environment variables |
| backend/utils/errors.js | Created custom error classes for better error handling |
| backend/services/userService.js | Created user service layer with auth and profile logic |
| backend/services/orderService.js | Created order service layer with validation |
| backend/services/foodService.js | Created food service layer |
| backend/server.js | Added middleware for logging, rate limiting, and error handling |
| backend/scripts/makeAdmin.js | Created admin promotion script |
| backend/routes/userRoute.js | Added admin login endpoint |
| backend/models/userModel.js | Added isAdmin field to user schema |
| backend/middleware/* | Added error handler, logger, and rate limiter middleware |
| backend/controllers/* | Refactored to use service layer |
| admin/src/services/* | Implemented all API service methods |
| admin/src/contexts/AuthContext.jsx | Created admin authentication context |
| admin/src/components/ProtectedRoute.jsx | Created route protection component |
| admin/src/components/Navbar/Navbar.jsx | Fixed to show real admin name and working logout |
| admin/src/components/Charts/Charts.jsx | Created three chart components |
| admin/src/pages/Login/Login.jsx | Created admin login page |
| admin/src/pages/Orders/Orders.jsx | Fixed API calls and added Pending status support |
| admin/src/pages/List/List.jsx | Fixed image URLs to use ImageKit CDN |
| admin/src/pages/Add/Add.jsx | Fixed initialization order bug |
| admin/src/App.jsx | Added authentication routing |
| CHANGES.md | Added comprehensive change log |
Files not reviewed (2)
- admin/package-lock.json: Language not supported
- backend/package-lock.json: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Admin Panel:
Backend:
Frontend:
Docs: