Commit Graph

95 Commits

Author SHA1 Message Date
5812906758 fix: disable show cleaned reports by default
- Set showCleaned to false in initial filter state
- Cleaned reports will be hidden by default
- Users can enable via map filters to see cleaned reports
2025-11-16 23:43:14 +00:00
fd3740391e fix: disable all map options by default except clustered markers
- Set showEvents to false by default
- Set showWaterQuality to false by default
- Set showHeatmap to false by default (already was)
- Set showHotspots to false by default (already was)
- Keep showClusters as true (only enabled option)

Users can now enable features as needed via map filters
2025-11-16 23:41:58 +00:00
11c9333c73 feat: add water quality markers to map
- Add 38 Irish beach water quality markers to map display
- Create water quality marker icons with color-coded status (excellent=green, good=blue, sufficient=amber, poor=red)
- Add water quality toggle in map filters
- Display beach name, status, and last sampled date in popups
- Create irishBeaches.ts data file with all beach locations
- Water quality markers shown by default, can be toggled off

Beaches covered: Dublin, Wicklow, Wexford, Waterford, Cork, Kerry, Clare, Galway, Mayo, Sligo, Donegal, Antrim, Down
2025-11-16 23:40:37 +00:00
9e5eadec82 docs: update task 32 completion with water quality implementation 2025-11-16 23:35:27 +00:00
b3f3d1ad33 feat: implement real water quality data with 38 Irish beaches
- Add static dataset of 38 Irish beaches with 2024 water quality data
- Implement nearest beach finder (within 20km radius)
- Return real water quality status (excellent/good/sufficient/poor)
- Include E.coli and Enterococci parameters
- Remove unimplemented services from EnvironmentalDataPanel (beach quality, biodiversity)
- Update panel description to reflect available data

Coverage: Dublin, Wicklow, Wexford, Waterford, Cork, Kerry, Clare, Galway, Mayo, Sligo, Donegal, Antrim, Down
2025-11-16 23:34:15 +00:00
e0889766cc docs: add water quality integration guide - no API key required
- Document EU Bathing Water Quality API (free, no key needed)
- Add EPA Ireland and Marine Institute alternatives
- Provide implementation examples
- Clarify that water quality data is completely free and public
2025-11-16 23:30:54 +00:00
8352327add docs: add task 32 completion summary 2025-11-16 23:27:55 +00:00
311d3aa60b fix: handle invalid weather API key gracefully and fix TideDisplay crash
- Fix TideDisplay component crash (use extremes instead of tides)
- Handle 401 weather API errors gracefully (return null data with note)
- Update weather controller to return 200 with null values instead of 503
- Add helpful message about API key activation time
- Fix tide type capitalization (High/Low instead of high/low)
2025-11-16 23:27:10 +00:00
3d487a468e feat: implement external API integration with static tide tables (task 32)
- Add in-memory caching for external API responses (6-hour expiration)
- Implement OpenWeatherMap integration for weather data
- Create static tide tables for 22 Irish coastal stations
- Add tide calculation based on semi-diurnal patterns and lunar cycles
- Implement water quality, beach quality, and biodiversity placeholder endpoints
- Add comprehensive API documentation (EXTERNAL_API_SETUP.md)
- Fix frontend WaterQualityIndicator crash
- Remove Redis dependency (using in-memory cache instead)
- All external data endpoints functional and tested
2025-11-16 23:24:42 +00:00
92426c5cc1 docs: add external data implementation summary 2025-11-16 23:08:10 +00:00
2b222b65e1 feat: implement external environmental data display components
- Add WeatherWidget for current weather conditions
- Add TideDisplay for tide times and heights
- Add WaterQualityIndicator for EPA water quality data
- Add BeachQualityDisplay for beach ratings and certifications
- Add BiodiversityInfo for marine biodiversity information
- Add EnvironmentalDataPanel composite component
- Create externalDataService for API integration
- Add types for external environmental data
- Create demo page at /demo/environmental-data
- Add comprehensive README documentation

Fulfills requirements 11.1, 11.2, 11.3, 11.4, 11.6, 11.7
Completes task 19 from implementation plan
2025-11-16 23:07:29 +00:00
1e1e54e7ff Move Sign Out button to profile page
- Remove Sign Out button from UserProfile component in header
- Add Sign Out button to UserProfilePage next to Edit Profile
- Sign Out button only visible on user's own profile page
- Styled with red background to indicate destructive action
2025-11-16 23:01:36 +00:00
0212e67052 Fix Show Cleaned Reports toggle logic
- Correctly toggle between true and false states
- Previously was setting the same value on each click
- Now properly hides/shows cleaned reports when toggled
2025-11-16 22:59:17 +00:00
55acff59bc Fix photo URL construction in ReportDetailModal
- Prepend API base URL to relative photo paths
- Use process.cwd() for upload directory in server
- Ensures photos display correctly in report detail modal
2025-11-16 22:57:40 +00:00
4e5ab7d41b Fix upload directory path issue
- Change UPLOAD_DIR from ../uploads to ./uploads in server/.env
- Use absolute path with process.cwd() in upload middleware
- Ensures uploads directory is created in correct location
2025-11-16 22:54:30 +00:00
39ce69172d Add cleanup tracking implementation documentation 2025-11-16 22:51:48 +00:00
c70fc77fa7 Implement Mark as Cleaned functionality
- Add showCleaned filter to FilterState type
- Update MapView to show green markers with checkmark for cleaned reports
- Add cleaned status filter toggle in MapFilters component
- Display cleaned information in ReportDetailModal
- Hide action buttons for already cleaned reports
- Wire up markAsCleaned functionality in MapPage
- Backend endpoint and database fields already in place
2025-11-16 22:51:10 +00:00
14a905a138 Put all action buttons (Verify, Dispute, Cleaned Up) in same row with shorter labels 2025-11-16 22:30:07 +00:00
17e3e85781 Add 'Mark as Cleaned Up' functionality
- Add cleaned_at and cleaned_by_user_id fields to reports table
- Create database migration for cleanup tracking
- Add markAsCleaned backend endpoint and service method
- Add Mark as Cleaned Up button to ReportDetailModal
- Update types to include cleaned fields
- Add frontend handler to mark reports as cleaned
2025-11-16 22:26:59 +00:00
beb5d8e7d8 Increase modal max height to 92vh for better content visibility 2025-11-16 22:22:59 +00:00
38f0e94bd7 Increase photo gallery height to h-80 for better visibility 2025-11-16 22:22:12 +00:00
b801b12435 Put location and photo timestamp in same row for more compact layout 2025-11-16 22:21:45 +00:00
8f98047bca Make report detail modal more compact and remove reporter info section 2025-11-16 22:20:44 +00:00
ff04e4fb47 Reduce ReportDetailModal size to minimize scrolling
- Reduce max width from 4xl to 3xl
- Reduce photo height from h-96 to h-64
- Reduce padding throughout (p-6 to p-4, p-4 to p-3)
- Reduce header font size from 2xl to xl
- Reduce audit log max height from 60 to 40
- Reduce spacing between sections from space-y-6 to space-y-4
2025-11-16 22:20:29 +00:00
0099ea4b84 Fix z-index for ReportDetailModal to appear above map elements 2025-11-16 22:17:31 +00:00
5c8b66cb0c Add safety checks and null guards to ReportDetailModal 2025-11-16 22:15:47 +00:00
02fe58eb31 Fix Decimal type conversion for latitude/longitude in report responses 2025-11-16 22:13:32 +00:00
66022bebf9 Add verification implementation documentation 2025-11-16 22:12:16 +00:00
f603ea8fda Implement report verification interface with audit log
- Add verify/dispute endpoints to backend API
- Create verification service methods with auto-hide logic for 3+ disputes
- Update ReportDetailModal with verification buttons and comment forms
- Add verification audit log display showing history of verifications/disputes
- Implement auto-hide warning for disputed reports
- Update MapPage to handle verification actions and refresh data
- Add verification counts to report responses
- Filter out disputed reports from public view by default
- Add verification test script

Requirements: 7.1, 7.2, 7.3, 7.4, 7.5
2025-11-16 22:11:40 +00:00
53cc84e832 Mark task 16 (Implement notification preferences) as complete 2025-11-16 22:06:26 +00:00
c1f3940e82 Mark task 31 (Build user profile endpoints) as complete
All user profile endpoints have been implemented and tested:
- GET /api/users/:id for profile retrieval
- PATCH /api/users/:id for profile updates
- GET /api/users/:id/reports endpoint
- GET /api/users/:id/events endpoint
- Impact score calculation
- Notification preferences endpoint (PATCH /api/users/:id/preferences)

Requirements: 6.3, 6.4, 6.5, 10.4
2025-11-16 22:05:54 +00:00
06c2310266 Fix 403 error in notification preferences and profile updates
- Handle both Clerk ID and database ID in authorization checks
- Compare Clerk IDs when URL parameter is a Clerk ID (user_xxx)
- Convert Clerk ID to database ID for service layer operations
- Apply fix to both updateNotificationPreferences and updateUserProfile endpoints
2025-11-16 22:03:50 +00:00
86169f6141 Implement notification preferences (Task 16)
- Create NotificationSettings component with map-based area selector
- Add radius configuration slider (1-50km range)
- Implement notification type toggles (email, in-app)
- Add notifications tab to user profile page (visible only to profile owner)
- Update backend to parse and return areasOfInterest JSON
- Save and load user notification preferences
- Requirements: 10.1, 10.4
2025-11-16 22:01:01 +00:00
515e85b1eb chore: mark task 15 (user profile page) as complete
Task 15 implementation includes:
✅ Display user statistics (reports submitted, events attended)
✅ Calculate and show impact score
✅ Create personal contribution map showing all user reports
✅ Implement activity timeline with reports and events
✅ Add profile editing functionality (first name, last name, username)

All requirements satisfied: 6.3, 6.4, 6.5
2025-11-16 21:54:14 +00:00
fdeaa4ff3a fix: only count attended events in profile statistics
- Update getUserProfile to count only eventRegistrations where attended=true
- This ensures 'Events Attended' shows actual attended events, not just registrations
- Impact score calculation already had this logic and remains unchanged

Now 'Events Attended' will only increment after an event is completed and marked as attended
2025-11-16 21:50:19 +00:00
cc7298bc56 fix: handle events structure and prevent duplicate keys
- Update events state to match backend response structure (registered/organized)
- Display registered and organized events in separate sections
- Use unique keys for all event mappings (registered-id, organized-id)
- Fix duplicate key errors in activity timeline overview section

This resolves all duplicate React key warnings
2025-11-16 21:48:45 +00:00
ad06833842 fix: resolve React key duplicates and NaN in profile page
- Fix NaN error in impact score calculation by handling undefined reportCount/eventCount
- Fix duplicate React keys in activity timeline by using unique composite keys
- Add reportCount and eventCount to backend profile response to match frontend expectations
- Keep stats object for backward compatibility

Fixes:
- 'Received NaN for children attribute' warning
- 'Encountered two children with the same key' errors
2025-11-16 21:46:40 +00:00
701735a7e4 docs: add username fix documentation 2025-11-16 21:44:49 +00:00
258cbcf238 fix: prevent duplicate user_ prefix in usernames
- Update user creation logic to strip 'user_' prefix from Clerk ID before generating username
- Change default username pattern from 'user_<clerkId>' to 'user<cleanId>'
- This prevents usernames like 'user_user_35Z...' and creates 'user35Z...' instead
- Apply fix to both userService and reportController
- Add migration script to fix existing duplicate usernames

Example: user_user_35ZFZ... -> user35ZFZ...
2025-11-16 21:44:21 +00:00
426c4c7d7e fix: remove email display from user profile page
- Remove email from profile header display for privacy
- Keep username and full name visible
2025-11-16 21:41:35 +00:00
bee80be87d fix: add support for Clerk IDs and activity endpoint
- Update getUserProfile to accept both database ID and Clerk ID
- Update getUserReports to handle Clerk IDs
- Update getUserEvents to handle Clerk IDs
- Add getUserActivity endpoint to return timeline of user actions
- Add activity route GET /api/users/:id/activity
- Fix TypeScript errors with const assertions

This fixes 404 errors when frontend uses Clerk IDs to fetch user data
2025-11-16 21:39:38 +00:00
c84bcb2fd6 feat: implement user profile endpoints (task 31)
- Add GET /api/users/:id for profile retrieval with stats
- Add PATCH /api/users/:id for profile updates
- Add GET /api/users/:id/reports to fetch user's reports
- Add GET /api/users/:id/events to fetch user's events (registered & organized)
- Add PATCH /api/users/:id/preferences for notification settings
- Add POST /api/users/:id/calculate-impact for impact score calculation
- Create userService with all business logic
- Create userController with request handling
- Create userRoutes and register in main server
- Update frontend userService with new endpoints
- Add comprehensive documentation in USER_PROFILE_ENDPOINTS.md
- Add test script for manual endpoint testing

Requirements satisfied: 6.3, 6.4, 6.5, 10.4
2025-11-16 21:38:16 +00:00
f02f23e185 feat: implement user profile page with statistics, contribution map, and activity timeline
- Add userService for profile and activity API calls
- Create UserProfilePage with tabbed interface (overview, reports, events, activity)
- Display user statistics (reports count, events count, impact score)
- Implement personal contribution map showing all user report locations
- Add activity timeline with different activity types
- Enable profile editing for own profile (first name, last name, username)
- Update UserProfile component to link to profile page
- Add /profile/:userId route to App
- Install react-leaflet for map integration
- Requirements: 6.3, 6.4, 6.5
2025-11-16 21:13:26 +00:00
5cbdb8f284 Shift map center further west to focus on Ireland
- Moved center from (53.4, -8.0) to (53.4, -9.0)
- Minimizes UK visibility and focuses view on Ireland
- Provides optimal viewing with filter panel open
2025-11-16 21:09:24 +00:00
2b8e4e9b31 Adjust map center further west to -8.0 longitude
- Moved center from (53.4, -7.5) to (53.4, -8.0)
- Provides more clearance for filter panel on the left
- Ensures all of Ireland is clearly visible
2025-11-16 21:08:14 +00:00
8e73d8a2a5 Improve event popup and map positioning
- Added 'View Event Details' button in event popup that navigates to /events?id={eventId}
- Adjusted map center from Dublin (53.3498, -6.2603) to (53.4, -7.5) to better show all of Ireland
- New center point ensures Ireland is fully visible even when filter panel is open
- Button has blue styling with hover effect for better UX
2025-11-16 21:07:10 +00:00
91ecbd2443 Link map items with events - Display cleanup events on interactive map
- Added event fetching in MapPage component
- Events now display on map with custom markers (calendar emoji)
- Enhanced event popup with detailed information (date, time, participants, litter collected)
- Added event visibility toggle in MapFilters
- Events use different colors based on status (upcoming=amber, completed=green, cancelled=gray)
- Sample event data provided as fallback
- Fixed date filter type conversion for API calls
2025-11-16 21:05:23 +00:00
7153e55f4d Add organizerClerkId to events for proper organizer permission checks 2025-11-16 20:53:59 +00:00
9a0358d25e Fix EventDetailModal z-index issue causing blank grey page 2025-11-16 20:50:46 +00:00
b208eb7f63 Fix Clerk configuration by adding afterSignOutUrl prop 2025-11-16 20:49:21 +00:00