Conversation
Introduces the basic structure for the parent-facing dashboard, including a dedicated route at /app/parent. A new ParentRedirectGuard is added to the main application layout. This guard checks the user's role from their profile and automatically redirects any user with the 'parent' role to the new dashboard, ensuring they land on the correct interface after logging in. To support this, a getStoredUserProfile utility was created to allow access to the user's profile information from outside React components, which is necessary for the routing logic.
|
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthroughThis pull request introduces a comprehensive parent dashboard feature enabling parents to monitor their children's learning activities. It includes six new UI components, four new authenticated routes, server-side data retrieval functions, custom hooks for state orchestration, state atoms for persistence, and updated routing logic to redirect parent users to their dedicated dashboard area. Changes
Sequence Diagram(s)sequenceDiagram
participant User as Parent User
participant Router as Router
participant Dashboard as useParentDashboard Hook
participant API as Server Functions
participant DB as Database
User->>Router: Navigate to /app/parent
activate Router
Router->>Dashboard: useParentDashboard()
deactivate Router
activate Dashboard
Dashboard->>API: getLinkedChildren()
API->>DB: Query parent profile & children
DB-->>API: Children data
API-->>Dashboard: Linked children array
Dashboard->>Dashboard: Derive selectedChild (first or cached)
Dashboard->>API: getChildStats(selectedChildId)
API->>DB: Query child stats (activity, streaks, performance)
DB-->>API: Stats data
API-->>Dashboard: Child stats object
Dashboard->>API: getParentAlerts()
API->>DB: Query and compute alerts for all children
DB-->>API: Alerts array
API-->>Dashboard: Parent alerts
Dashboard->>Dashboard: Filter alerts by selectedChild
Dashboard->>Dashboard: Compute unreadCount & aggregate loading
deactivate Dashboard
Dashboard-->>User: Render dashboard with data
sequenceDiagram
participant User as Parent User
participant Dashboard as Parent Dashboard
participant Hook as useParentDashboard
participant API as Server Functions
User->>Dashboard: Click child in ParentHeader dropdown
activate Dashboard
Dashboard->>Hook: selectChild(newChild)
deactivate Dashboard
activate Hook
Hook->>Hook: Update selectedChild state
Hook->>Hook: useMemo: childStats dependency updates
Hook->>API: getChildStats(newChildId)
deactivate Hook
activate API
API-->>Hook: New child's stats
deactivate API
activate Hook
Hook->>Hook: Recompute filtered alerts for new child
Hook->>Hook: Update unreadAlertsCount
Hook-->>Dashboard: Updated state (childStats, alerts, unreadCount)
deactivate Hook
activate Dashboard
Dashboard->>Dashboard: Re-render cards with new child's data
Dashboard->>Dashboard: Update bottom nav alert badge
deactivate Dashboard
Estimated code review effort🎯 4 (Complex) | ⏱️ ~65 minutes The review encompasses multiple heterogeneous subsystems: six UI components with animations and conditional logic, four new routes with complex data integration, server-side functions with database queries and access control validation, three new hooks with multi-step data orchestration, new state atoms and types, and routing tree regeneration. While individual components follow consistent patterns and the code is well-structured, the breadth of changes across different layers (UI, routes, server, hooks, state) and the business logic density in server functions and hooks demand careful cross-component verification of data flows, access control, and integration points. Poem
✨ Finishing touches
📜 Recent review detailsConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (25)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary by CodeRabbit
Release Notes
New Features
Bug Fixes & Improvements
✏️ Tip: You can customize this high-level summary in your review settings.