diff --git a/PRD.md b/PRD.md index fa4a333..55a4712 100644 --- a/PRD.md +++ b/PRD.md @@ -78,40 +78,34 @@ The stack is orchestrated using `docker-compose.yml` and consists of 8 distinct The backend exposes the following RESTful APIs powered by FastAPI: **Authentication** -- `POST /api/auth/register` - Create new student account -- `POST /api/auth/login` - Authenticate & receive JWT session -- `POST /api/auth/forgot-password` - Request password reset link -- `POST /api/auth/otp-request` / `otp-verify` - Phone number authentication +- `[Built] POST /api/auth/register` - Create new student account +- `[Built] POST /api/auth/login` - Authenticate & receive JWT session +- `[Built] POST /api/auth/forgot-password` - Request password reset link +- `[Planned] POST /api/auth/otp-request` / `otp-verify` - Phone number authentication **Users & Profiles** -- `GET/PUT /api/users/{id}` - Fetch/update user profiles and settings -- `POST /api/users/{id}/avatar` - Upload profile picture to MinIO -- `GET /api/users/{id}/attempts` - Retrieve past test history +- `[Built] GET/PUT /api/users/{id}` - Fetch/update user profiles and settings +- `[Planned] POST /api/users/{id}/avatar` - Upload profile picture to MinIO +- `[Built] GET /api/users/{id}/attempts` - Retrieve past test history **CBT Engine** -- `GET /api/tests` - List active Mock Tests, PYQs, and Weekly Tests -- `GET /api/tests/{id}/questions` - Fetch test sections and questions -- `POST /api/attempts/submit` - Auto-grade and record a CBT session +- `[Built] GET /api/tests` - List active Mock Tests, PYQs, and Weekly Tests +- `[Built] GET /api/tests/{id}/questions` - Fetch test sections and questions +- `[Built] POST /api/attempts/submit` - Auto-grade and record a CBT session **AI Coach** -- `GET /api/ai-coach/readiness/{id}` - Predict JEE/NEET rank and college -- `GET /api/ai-coach/study-plan/today` - Generate daily tasks -- `GET /api/mistakes/today` - Fetch spaced repetition flashcards (SM-2 algorithm) -- `POST /api/mistakes/review` - Update mistake mastery based on recall -- `POST /api/ai-coach/chat/stream` - AI Tutor socket connection +- `[Planned] GET /api/ai-coach/readiness/{id}` - Predict JEE/NEET rank and college +- `[Planned] GET /api/ai-coach/study-plan/today` - Generate daily tasks +- `[Planned] GET /api/mistakes/today` - Fetch spaced repetition flashcards (SM-2 algorithm) +- `[Planned] POST /api/mistakes/review` - Update mistake mastery based on recall +- `[Built] POST /api/ai-coach/chat/stream` - AI Tutor socket connection **Subscription & Billing (Gateway Agnostic)** -- `POST /api/billing/create-order` - Generate payment gateway order IDs -- `POST /api/billing/verify-payment` - Cryptographically verify webhooks and upgrade tier +- `[Built] POST /api/billing/create-order` - Generate payment gateway order IDs +- `[Built] POST /api/billing/verify-payment` - Cryptographically verify webhooks and upgrade tier **Admin System** -- `GET/POST/PUT/DELETE /api/admin/*` - Full CRUD for Tests, Users, Coupons, and System Settings - -**Parent System (Planned / UI Mocked)** -- *Note: The UI exists at `/parent/dashboard` but currently uses fallback mock data. Backend APIs are not yet built.* -- `[Planned] POST /api/parent/register` - Parent account creation -- `[Planned] POST /api/parent/link-student` - Link student to parent dashboard -- `[Planned] GET /api/parent/{parent_id}/dashboard/{student_id}` - Fetch real-time student analytics +- `[Built] GET/POST/PUT/DELETE /api/admin/*` - Full CRUD for Tests, Users, Coupons, and System Settings ## 5. Technology Stack Summary - **Frontend:** Next.js 14/15, TailwindCSS, Framer Motion, Lucide Icons, Shadcn UI. diff --git a/src/app/parent/dashboard/page.tsx b/src/app/parent/dashboard/page.tsx deleted file mode 100644 index b94600f..0000000 --- a/src/app/parent/dashboard/page.tsx +++ /dev/null @@ -1,222 +0,0 @@ -"use client" - -import { useState, useEffect } from "react" -import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" -import { Switch } from "@/components/ui/switch" -import { Label } from "@/components/ui/label" -import { LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer } from "recharts" -import { Activity, Clock, Flame, AlertTriangle, RefreshCw } from "lucide-react" - -import { useActiveUser } from "@/hooks/useActiveUser" - -// Hardcoded mock UUIDs for this sprint -const PARENT_ID = "parent-123" - -const DICTIONARY = { - en: { - title: "Parent Monitoring Portal", - subtitle: "Real-time analytics for your child's learning journey.", - lang_toggle: "हिंदी", - time_spent: "Weekly Time Spent", - minutes: "Minutes", - streak: "Active Streak", - days: "Days", - tests_attempted: "Tests Attempted", - tests: "This week", - accuracy_trend: "7-Day Accuracy Trend", - areas_of_concern: "Areas of Concern", - attention_needed: "Attention Needed", - pending_errors: "pending errors", - loading: "Loading child data...", - no_concerns: "No current areas of concern. Great job!" - }, - hi: { - title: "अभिभावक निगरानी पोर्टल", - subtitle: "आपके बच्चे की सीखने की यात्रा के लिए वास्तविक समय विश्लेषिकी।", - lang_toggle: "English", - time_spent: "साप्ताहिक समय व्यतीत", - minutes: "मिनट", - streak: "सक्रिय लकीर", - days: "दिन", - tests_attempted: "परीक्षण का प्रयास", - tests: "इस सप्ताह", - accuracy_trend: "7-दिवसीय सटीकता प्रवृत्ति", - areas_of_concern: "चिंता के विषय", - attention_needed: "ध्यान देने की आवश्यकता है", - pending_errors: "लंबित त्रुटियां", - loading: "बच्चे का डेटा लोड हो रहा है...", - no_concerns: "चिंता का कोई विषय नहीं है। बहुत बढ़िया!" - } -} - -export default function ParentDashboard() { - const { userId, loading: userLoading } = useActiveUser() - const [lang, setLang] = useState<'en' | 'hi'>('en') - const [data, setData] = useState(null) - const [loading, setLoading] = useState(true) - - const t = DICTIONARY[lang] - - useEffect(() => { - if (userLoading || !userId) return; - async function fetchDashboard() { - try { - const res = await fetch(`/api/parent/${PARENT_ID}/dashboard/${userId}`) - if (!res.ok) throw new Error("Failed to fetch") - const payload = await res.json() - setData(payload) - } catch (err) { - console.error(err) - // Fallback mock data if server fails - setData({ - student_name: "Rahul", - streak_count: 5, - weekly_minutes_spent: 124.5, - total_tests_attempted_this_week: 3, - accuracy_trend: [ - { date: "Jul 01", accuracy: 40 }, - { date: "Jul 02", accuracy: 55 }, - { date: "Jul 03", accuracy: 50 }, - { date: "Jul 04", accuracy: 70 }, - { date: "Jul 05", accuracy: 65 }, - { date: "Jul 06", accuracy: 80 }, - { date: "Jul 07", accuracy: 85 } - ], - areas_of_concern: [ - { topic: "Thermodynamics", pending_errors: 4 }, - { topic: "Integration", pending_errors: 2 } - ] - }) - } finally { - setLoading(false) - } - } - fetchDashboard() - }, [userId, userLoading]) - - if (loading) { - return ( -
- {t.loading} -
- ) - } - - return ( -
- - {/* Header & Language Toggle */} -
-
-

- {t.title} -

-

{t.subtitle} — {data?.student_name}

-
- {/* -
- - setLang(c ? 'hi' : 'en')} - /> -
- */} -
- - {/* Metric Blocks */} -
- - -
-
-

{t.time_spent}

-

{data?.weekly_minutes_spent} {t.minutes}

-
-
-
- - -
-
-

{t.streak}

-

{data?.streak_count} {t.days}

-
-
-
- - -
-
-

{t.tests_attempted}

-

{data?.total_tests_attempted_this_week} {t.tests}

-
-
-
-
- - {/* Main Grid */} -
- - {/* Chart */} - - - {t.accuracy_trend} - - -
- - - - - `${val}%`} /> - - - - -
-
-
- - {/* Areas of Concern */} - - - - - {t.areas_of_concern} - - - - {!data?.areas_of_concern || data.areas_of_concern.length === 0 ? ( -
-

{t.no_concerns}

-
- ) : ( - data.areas_of_concern.map((concern: any, idx: number) => ( -
-
-

{concern.topic}

-

- {t.attention_needed} • {concern.pending_errors} {t.pending_errors} -

-
- )) - )} -
-
- -
-
- ) -}