Commit 97c4fb4
Frontend UI: Dashboard, Rewards & Activity Tracking (#3)
* Build complete React frontend for CivicPulse hackathon project
Implemented full-featured gamified civic engagement platform with:
Frontend Features:
- Authentication (Login/Register) with JWT token management
- Citizen Dashboard with points, carbon tracking, rank display
- Issue Reporting with photo upload support and AI categorization display
- Activity Logging (bike, walk, transit, carpool) with carbon calculations
- Leaderboard for users and neighborhoods with rankings
- City Official Dashboard with issue overview and statistics
- Issues Management interface with status updates and AI routing
- Analytics dashboard with charts and city-wide metrics
Technical Stack:
- React 18 with TypeScript
- Vite build tool for fast development
- React Router for navigation
- Tailwind CSS + custom components for styling
- Axios for API integration
- Recharts for data visualization
- Lucide React for icons
Architecture:
- Clean component structure with reusable UI components
- Protected routes with role-based access control
- API client with JWT interceptors
- Type-safe with comprehensive TypeScript types
- Mock data for independent development
- Responsive mobile-first design
Build Status:
- Zero TypeScript errors
- Production build successful
- Bundle size optimized
- Ready for local deployment on port 5173
Integration Points:
- POST /api/auth/login - Authentication
- POST /api/auth/register - User registration
- POST /api/issues - Issue reporting with photo upload
- POST /api/activities - Activity logging
- GET /api/leaderboard/* - Rankings data
- PATCH /api/issues/:id/status - Status updates
- Mock data used where backend not yet available
Demo Flow Verified:
✓ User can register/login
✓ Dashboard displays stats and activities
✓ Report issue with photo upload
✓ Log sustainable activity with points earned
✓ View leaderboard rankings
✓ City official can manage issues
✓ Analytics visualizations render
✓ Mobile responsive layout
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Add comprehensive frontend handoff documentation
* Enhance Analytics page with AI-powered insights dashboard
Added four major AI features for hackathon demo:
1. AI Issue Bundling & Route Optimization - visualizes clustered issues with carbon savings calculations
2. AI-Powered Recommendations - generates context-aware suggestions based on real analytics data
3. Predictive Maintenance Insights - displays pattern detection and IoT sensor recommendations
4. ML Resource Dispatch - shows intelligent priority queue optimization
Features:
- Fetches real data from /api/analytics/* endpoints
- Client-side AI recommendations generated from data patterns
- Visual improvements: color-coded badges, gradient cards, emoji markers
- Real-time carbon savings calculations (2.4kg per bundled route)
- Predictive analytics showing 40% response time improvement
- 25% engagement increase projections
Targets AWS and Benevity AI sponsor prizes with production-ready ML showcase.
Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
* Add interactive issue map with geographic visualization
Implemented comprehensive map feature for city officials to visualize reported issues geographically across Calgary. Key features include priority-based color coding, interactive filtering, and detailed issue popups.
Features:
- Interactive Leaflet map centered on Calgary
- Priority-based marker colors (red=critical, orange=high, yellow=medium, gray=low)
- Click markers to view full issue details in popups
- Filter by status (all, open, in_progress, resolved)
- Real-time statistics dashboard
- Mobile-responsive design
- AI analysis integration in popups
Technical implementation:
- Added react-leaflet and leaflet dependencies
- Created IssueMap component with custom marker icons
- Integrated with existing /api/issues endpoint
- Added /admin/map protected route
- Updated navigation for easy access
- Comprehensive error handling and loading states
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: Analytics page API calls - use api client instead of fetch
Root cause: Analytics.tsx was using native fetch() API with relative URLs
instead of the configured axios api client, causing:
- Wrong base URL (missing backend port)
- Missing JWT authentication headers
- CORS and connection failures
Solution:
- Import api client from lib/api.ts
- Replace fetch() calls with api.get()
- Use response.data instead of response.json()
This ensures:
- Correct backend URL (http://localhost:3000/api)
- JWT token automatically included via interceptor
- Consistent error handling across the app
Tested: TypeScript compiles without errors
Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
* Implement Material-UI dark theme redesign for Dashboard
- Install @mui/material v7, @mui/icons-material, @emotion packages
- Create comprehensive dark theme configuration (darkTheme.ts)
- Slate color palette (#0f172a background, #1e293b paper)
- Blue/green accent colors with gradients
- Professional typography scale with Inter font family
- Custom component styles with smooth transitions
- Scrollbar theming
- Redesign Dashboard.tsx with MUI components:
- Replace Tailwind components with Material-UI equivalents
- Gradient stat cards with hover effects and glassmorphism
- Professional card layouts with elevation and shadows
- Responsive grid using CSS Grid (MUI v7 compatible)
- Material icons for activities and stats
- Enhanced visual hierarchy and spacing
- Wrap App.tsx with ThemeProvider and CssBaseline
- Build successful with no errors
Design: Minimalistic, sleek dark mode with smooth animations
Performance: Fast load times, optimized bundle size
Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Add comprehensive location feature documentation and testing guide
Detailed handoff documentation for the location capture and validation system, including implementation details, testing procedures, integration notes, and demo talking points.
Documentation includes:
- Complete testing guide with 7 test scenarios
- Component handoff report with interfaces and contracts
- Integration notes with setup instructions
- Known limitations and future enhancement ideas
- Demo preparation talking points
- API endpoint documentation
Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: resolve blank white screen with MUI integration
- Fixed null reference error in Dashboard.tsx when user is null
- Wrapped activities initialization in user null check (line 152)
- Fixed Router/ThemeProvider nesting to prevent CssBaseline conflicts
- ThemeProvider now wraps inside Router to scope CSS resets properly
Root cause: Accessing user.id without null check caused render error
Secondary issue: CssBaseline global reset conflicting with Router
Tested: Build succeeds, no TypeScript errors
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* UI Stream 1: Create design system theme.ts
* UI Stream 1: Update Tailwind config with custom colors
* UI Stream 1: Create ModernCard component (Tailwind)
* UI Stream 1: Create ModernButton component
* UI Stream 4: AdminDashboard redesigned with modern dark theme
* UI Stream 4: IssuesManagement redesigned with modern dark theme
* UI Stream 1: Create ModernInput component
* UI Stream 1: Create ModernBadge component
* UI Stream 2: Add theme config and reusable components
- Created custom theme configuration (non-Material-UI) in src/styles/theme.ts
- Implemented AnimatedBackground component with gradient orbs and grid pattern
- Implemented LoadingSpinner component with size and color variants
- Implemented EmptyState component for empty lists/tables
- Fixed TypeScript import errors in existing modern components
- All components follow design system and use Framer Motion for animations
* UI Stream 1: Redesign Register page + export modern components
* UI Stream 3: Dashboard redesigned with dark theme
* UI Stream 1: Fix ModernCard gradient prop
* UI Stream 4: IssueMap redesigned with modern dark theme
* UI Stream 3: LogActivity redesigned with dark theme
* UI Stream 3: Leaderboard redesigned with dark theme and gradient badges
* UI Stream 3: Fix TypeScript errors and clean up imports
* feat(ui): refactor Login and Register pages to use Material-UI components
- Replace Framer Motion animations with Material-UI components
- Use MUI TextField, Button, Paper, Alert, CircularProgress
- Use MUI Select for neighborhood dropdown in Register
- Keep all existing functionality intact (form submission, validation, routing)
- Remove Tailwind classes, use sx prop for styling
- Maintain clean, professional design with MUI defaults
* feat(ui): refactor Dashboard page to use Material-UI components
- Replace custom StatCard with MUI Card/CardContent components
- Replace ModernCard with MUI Card components
- Use MUI Box with CSS Grid for responsive stat cards layout
- Use MUI Stack for action buttons layout
- Replace custom Button with MUI Button
- Use MUI Chip for badges and tags
- Use MUI List/ListItem for activities display
- Use MUI Paper for challenge cards
- Keep gradient backgrounds and all existing functionality
- Remove dependency on custom UI components
* docs: add Material-UI component patterns reference guide
- Quick reference for common MUI component patterns
- Form components (TextField, Select, Button)
- Layout patterns (Container, Box, Stack, CSS Grid)
- Card and Paper components
- Data display (Lists, Chips, Tables)
- Feedback components (Alerts, CircularProgress)
- Typography and navigation
- Common sx prop patterns
- Responsive breakpoint values
- Helps team maintain consistency when using MUI
* Add expandable AI-powered recommendations with Material-UI Accordions
Implemented accordion-style recommendation cards that display data-driven
justifications when expanded. Features include:
- RecommendationCard component with expand/collapse functionality
- ExpandableRecommendations container managing 5 recommendation cards
- Color-coded recommendations by type (carbon, efficiency, engagement, infrastructure)
- Data justification details shown on expansion
- Affected items list for each recommendation
- Smooth Material-UI transitions
- Integration into Analytics page
- JSON data import support with resolveJsonModule config
Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Implement AI Issue Bundling map visualization with interactive cluster routing
Added interactive map drawer component for visualizing and managing AI-optimized
civic issue clusters with route optimization.
Key Features:
- Material-UI Drawer slides from right (600px desktop, full-width mobile)
- Interactive Leaflet map centered on Calgary with cluster markers
- Numbered cluster markers (1-4) with selection highlighting
- Detailed cluster panel showing AI analysis, metrics, and route order
- Accept Route functionality with backend API integration
- Mobile responsive design
Components Added:
- ClusterMap.tsx: Leaflet map wrapper with numbered cluster markers
- ClusterMapDrawer.tsx: Main drawer component with state management
- ClusterDetails.tsx: Detailed cluster information panel
Analytics.tsx Integration:
- Added "View Routes & Optimize" button in AI bundling section
- Fetch cluster data from backend API with static fallback
- Handle route acceptance with analytics refresh
Data:
- Calgary real cluster data copied to public/data/
- 4 clusters: Beltline, Inglewood, Mission, Kensington
- Each cluster shows estimated time, carbon savings, AI analysis
Testing:
- Build successful with no errors
- All TypeScript types properly defined
- Leaflet CSS imported in main.tsx
Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Add comprehensive UI features for Sarah's dashboard
- Implemented circular progress trackers for weekly goals
- Added real-time activity history graphs with Recharts
- Created rewards redemption page with claim tracking
- Built redemption history with status tracking
- Added completed challenge highlighting in green
- Implemented activity type tracking (biking, walking, transit, carpool)
- Added issue reporting progress tracking
- Enhanced dashboard with real database integration
- Added AI-powered challenge display for citizens
- Implemented "Back to Dashboard" navigation
- Fixed card alignment and uniform heights across all pages
- Added claimed reward prevention with visual indicators
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent b86b746 commit 97c4fb4
File tree
83 files changed
+18754
-0
lines changed- docs
- frontend
- public
- data
- src
- assets
- components
- analytics
- layout
- modern
- ui
- data
- lib
- pages
- admin
- styles
- theme
- types
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
83 files changed
+18754
-0
lines changedLarge diffs are not rendered by default.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
0 commit comments