Add total litter collected display to user profile

- Updated backend userService to calculate total litter collected across all attended events
- Added totalLitterCollected field to UserProfile interface
- Added new statistics card showing total litter collected in kg
- Updated profile grid layout to accommodate 5 statistics cards
- Displays litter collected with 1 decimal place precision
This commit is contained in:
2025-11-18 19:03:43 +00:00
parent 3d7b84f376
commit 3a6db92699
22 changed files with 1462 additions and 128 deletions

54
START_SERVERS.md Normal file
View File

@@ -0,0 +1,54 @@
# Starting the Application
## Backend Server
Open a terminal and run:
```bash
cd server
npm run dev
```
The backend server should start on `http://localhost:3005`
You should see output like:
```
Server running on port 3005
Connected to database
```
## Frontend Development Server
Open another terminal and run:
```bash
npm run dev
```
The frontend should start on `http://localhost:5173`
## Troubleshooting
### Backend won't start
- Check if port 3005 is already in use: `lsof -ti:3005`
- Check database connection in `server/.env`
- Run `cd server && npm install` to ensure dependencies are installed
### Frontend won't start
- Check if port 5173 is already in use
- Run `npm install` to ensure dependencies are installed
- Check `.env.local` for correct API URL
### "Server returned non-JSON response" error
- This means the backend server is not running
- Start the backend server first (see above)
- Check that `VITE_API_BASE_URL` in `.env.local` matches your backend URL
## Quick Check
Test if backend is running:
```bash
curl http://localhost:3005/api/events
```
Should return JSON with events list.