Authentication fixes:
- Add isAuthenticated() method to ApiClient to check token presence
- Add useEffect in AdminLayout to redirect to login if no token found
- Fix logout to not fail when token is expired/invalid (401)
- Properly handle logout errors by clearing tokens locally
- Clear tokens and redirect to /login on 401 refresh token failure
UI/UX fixes:
- Replace all deprecated MUI Grid v1 with CSS Grid layout
- Remove Grid import since it's no longer used
- Fix Grid warnings: item, xs, sm, md props deprecated in MUI v7
- Use responsive CSS Grid with gridTemplateColumns for all layouts
Security improvements:
- Check authentication status on every page load
- Auto-redirect to login if no valid session exists
- Handle expired tokens gracefully without breaking logout flow
Backend changes:
- Created DashboardModule with controller and service
- Added /admin/dashboard/stats endpoint for aggregated statistics
- Added /admin/dashboard/activity-distribution endpoint for real activity data
- Query activities table to get actual counts by type (feeding, sleep, diaper, etc.)
- Query ai_conversations table for AI query totals
Frontend changes:
- Updated dashboard to fetch stats from new backend endpoint
- Replaced mock activity distribution with real data from database
- Added minWidth: 500px to all cards and charts for consistent layout
- Now displays actual activity counts: 9,965 feedings, 5,727 diapers, 4,633 sleep, etc.
- Replaced mock data with actual API calls to /admin/users
- Calculate real stats: totalUsers, activeUsers, totalFamilies, totalChildren
- Generate user growth chart from actual user creation dates
- Display top 5 most recent users sorted by creation date
- Added TODO comments for activity tracking and AI stats (endpoints don't exist yet)
Improved UX by consolidating user actions into a single dropdown menu:
- Added MoreVert icon button to open actions menu
- Menu includes: View Details, Edit User, Activate/Deactivate, Delete User
- Delete action shown in error color for visual distinction
- Cleaner table layout with single action button per row
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Fixed CORS to allow pfadmin.noru1.ro and localhost:3335
- Fixed API client to handle nested token response structure (data.tokens.accessToken)
- Added deviceInfo requirement to login endpoint
- Fixed API endpoint paths to use /api/v1 prefix consistently
- Updated admin user password to 'admin123' for demo@parentflowapp.com
- Fixed Grid deprecation warnings by replacing with CSS Grid
- Added automatic redirect to /login on 401 unauthorized
- Enhanced user management service to include familyCount, childrenCount, deviceCount
- Backend now queries family_members, children, and device_registry tables for counts
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Add comprehensive user management page with search, filters, and user details
- Create families management interface showing members and children
- Implement analytics dashboard with real-time charts using Recharts
- Add system health monitoring page with service status and metrics
- Create settings page with tabs for general, security, notifications, email, storage, and API settings
- All pages include mock data for development and are ready for API integration
- Fix start-dev.sh to use npx for correct port binding (3030 for frontend, 3335 for admin)
- Add aggressive port cleanup to ensure ports are always free before starting
- Fix admin dashboard layout to be client component (resolves MUI theme error)
- Bind all services to 0.0.0.0 for external access:
- Backend: maternal-api.noru1.ro (port 3020)
- Frontend: maternal.noru1.ro (port 3030)
- Admin: pfadmin.noru1.ro (port 3335)