Skip to content

Feature/parent dashboard screens#6

Merged
ldsgroups225 merged 2 commits intomainfrom
feature/parent-dashboard-screens
Jan 13, 2026
Merged

Feature/parent dashboard screens#6
ldsgroups225 merged 2 commits intomainfrom
feature/parent-dashboard-screens

Conversation

@ldsgroups225
Copy link
Owner

@ldsgroups225 ldsgroups225 commented Jan 13, 2026

Summary by CodeRabbit

Release Notes

  • New Features

    • Added parent dashboard with four main sections: Home, Stats, Alerts, and Profile.
    • Introduced child activity status monitoring showing online/offline status and last active time.
    • Added weekly study progress tracking with goal visualization.
    • Implemented streak tracking for consistent study activity.
    • Added subject performance metrics and trends display.
    • New parent alerts system with unread notifications.
    • Child profile management page with linked children and sign-out functionality.
  • Bug Fixes & Improvements

    • Fixed button type handling in achievement notifications.

✏️ Tip: You can customize this high-level summary in your review settings.

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.
@ldsgroups225 ldsgroups225 merged commit ff5c2cd into main Jan 13, 2026
0 of 3 checks passed
@coderabbitai
Copy link

coderabbitai bot commented Jan 13, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

This 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

Cohort / File(s) Summary
Parent Dashboard Components
apps/user-application/src/components/parent-dashboard/ActivityStatusCard.tsx, ParentBottomNav.tsx, ParentHeader.tsx, StreakCard.tsx, SubjectPerformanceGrid.tsx, WeeklyStudyCard.tsx, index.ts
Six new UI components for parent dashboard: ActivityStatusCard displays child status with badge and last active time; ParentBottomNav provides fixed bottom navigation with four items and alert badge; ParentHeader shows greeting and child selector; StreakCard animates current and longest streak with flame icon; SubjectPerformanceGrid renders 2-column grid of subject performance with trends; WeeklyStudyCard shows progress bar for weekly study goals. All use motion animations and utility styling.
Parent Dashboard Routes
apps/user-application/src/routes/_auth/app/parent/index.tsx, stats.tsx, profile.tsx, alerts.tsx
Four new authenticated routes: home displays activity summary and alerts banner; stats shows 7-day activity chart and subject performance; profile displays parent info and linked children with status; alerts renders unread alerts with mark-as-read interaction. Each integrates with ParentDashboard hook and bottom navigation.
State Management & Hooks
apps/user-application/src/lib/atoms/parent-dashboard.ts, hooks/use-parent-dashboard.ts, hooks/index.ts
New atoms (currentChildIdAtom, unreadAlertsCountAtom) for state persistence; TypeScript interfaces (LinkedChild, ChildStats, ParentAlert, SubjectPerformance) for type safety. Custom hooks useParentDashboard orchestrates multi-step data fetching and child selection; useParentAlerts handles alert querying with stubs for read operations.
Server Functions
apps/user-application/src/core/functions/parent.ts
Three protected server functions: getLinkedChildren fetches parent's children with grades; getChildStats computes activity, streaks, performance metrics for a specific child; getParentAlerts generates inactivity and streak-based alerts. Implements parent-child access control via userProfiles.childrenMatricules and performs database aggregations via Drizzle ORM.
Routing & Navigation
apps/user-application/src/routeTree.gen.ts, routes/_auth/app/index.tsx, routes/_auth/route.tsx
Generated route tree extended with four new parent routes (parent index, stats, profile, alerts). Route /_auth/app/index.tsx adds beforeLoad hook to redirect parent users to /app/parent. New ParentRedirectGuard component in /_auth/route.tsx enforces parent route isolation.
User Profile Utilities & Store
apps/user-application/src/lib/atoms/user-profile.ts
Added getStoredUserProfile() helper function to synchronously retrieve cached user profile from localStorage with client-side guard and error handling. Enables route-level access to user type without asynchronous operations.
Minor Fixes & Documentation
apps/user-application/src/components/gamification/achievement-unlock-toast.tsx, components/referrals/share-card.tsx, routes/_auth/app/progress.tsx, tasks/prd-parent-dashboard-screens.md, tasks/tasks-parent-dashboard-screens.md
achievement-unlock-toast: added explicit type="button" to buttons and fixed React list keys from index-based to value-based. share-card: formatting alignment only. progress.tsx: replaced console.log with console.warn. Two new markdown files documenting parent dashboard PRD, goals, user stories, design specs, and task breakdown.

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
Loading
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
Loading

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

🐰 A parent's view, now clear and bright,
Children's progress, tracked just right!
Streaks and stats, in motion dance,
Each alert a caring glance.

✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between eca5139 and 857fe0b.

📒 Files selected for processing (25)
  • apps/user-application/src/components/gamification/achievement-unlock-toast.tsx
  • apps/user-application/src/components/parent-dashboard/ActivityStatusCard.tsx
  • apps/user-application/src/components/parent-dashboard/ParentBottomNav.tsx
  • apps/user-application/src/components/parent-dashboard/ParentHeader.tsx
  • apps/user-application/src/components/parent-dashboard/StreakCard.tsx
  • apps/user-application/src/components/parent-dashboard/SubjectPerformanceGrid.tsx
  • apps/user-application/src/components/parent-dashboard/WeeklyStudyCard.tsx
  • apps/user-application/src/components/parent-dashboard/index.ts
  • apps/user-application/src/components/referrals/share-card.tsx
  • apps/user-application/src/core/functions/parent.ts
  • apps/user-application/src/hooks/index.ts
  • apps/user-application/src/hooks/use-parent-dashboard.ts
  • apps/user-application/src/lib/atoms/parent-dashboard.ts
  • apps/user-application/src/lib/atoms/user-profile.ts
  • apps/user-application/src/routeTree.gen.ts
  • apps/user-application/src/routes/_auth/app/index.lazy.tsx
  • apps/user-application/src/routes/_auth/app/index.tsx
  • apps/user-application/src/routes/_auth/app/parent/alerts.tsx
  • apps/user-application/src/routes/_auth/app/parent/index.tsx
  • apps/user-application/src/routes/_auth/app/parent/profile.tsx
  • apps/user-application/src/routes/_auth/app/parent/stats.tsx
  • apps/user-application/src/routes/_auth/app/progress.tsx
  • apps/user-application/src/routes/_auth/route.tsx
  • tasks/prd-parent-dashboard-screens.md
  • tasks/tasks-parent-dashboard-screens.md

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai bot mentioned this pull request Jan 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants