"use client" import { useState, useEffect } from "react" import { Card, CardContent, CardHeader, CardTitle, CardDescription } from "@/components/ui/card" import { ChevronDown, ChevronRight, CheckCircle2, Circle, Clock, Activity, Target } from "lucide-react" import { useActiveUser, isDemoUser } from "@/hooks/useActiveUser" type ChapterStatus = 'Mastered' | 'Practiced' | 'In Progress' | 'Not Started' interface Topic { name: string status: ChapterStatus accuracy: number questionsAttempted: number } interface Chapter { name: string topics: Topic[] isExpanded: boolean } interface Subject { name: string chapters: Chapter[] completionPct: number } const getStatusIcon = (status: ChapterStatus) => { switch (status) { case 'Mastered': return case 'Practiced': return case 'In Progress': return case 'Not Started': return } } const DEMO_SUBJECTS: Subject[] = [ { name: "Physics", completionPct: 42, chapters: [ { name: "Kinematics", isExpanded: true, topics: [ { name: "Motion in One Dimension", status: "Mastered", accuracy: 92, questionsAttempted: 150 }, { name: "Projectile Motion", status: "Practiced", accuracy: 75, questionsAttempted: 85 }, { name: "Relative Velocity", status: "In Progress", accuracy: 45, questionsAttempted: 20 }, ] }, { name: "Laws of Motion", isExpanded: false, topics: [ { name: "Newton's First Law", status: "Practiced", accuracy: 88, questionsAttempted: 40 }, { name: "Friction", status: "In Progress", accuracy: 50, questionsAttempted: 35 }, ] }, { name: "Thermodynamics", isExpanded: false, topics: [ { name: "First Law", status: "Not Started", accuracy: 0, questionsAttempted: 0 }, { name: "Carnot Engine", status: "Not Started", accuracy: 0, questionsAttempted: 0 }, ] } ] }, { name: "Chemistry", completionPct: 68, chapters: [ { name: "Atomic Structure", isExpanded: false, topics: [ { name: "Bohr Model", status: "Mastered", accuracy: 95, questionsAttempted: 110 }, { name: "Quantum Numbers", status: "Mastered", accuracy: 88, questionsAttempted: 95 }, ] } ] }, { name: "Mathematics / Biology", completionPct: 22, chapters: [ { name: "Calculus", isExpanded: false, topics: [ { name: "Limits", status: "In Progress", accuracy: 60, questionsAttempted: 45 }, { name: "Derivatives", status: "Not Started", accuracy: 0, questionsAttempted: 0 }, ] } ] } ] const ZERO_SUBJECTS: Subject[] = [ { name: "Physics", completionPct: 0, chapters: [ { name: "Kinematics", isExpanded: true, topics: [ { name: "Motion in One Dimension", status: "Not Started", accuracy: 0, questionsAttempted: 0 }, { name: "Projectile Motion", status: "Not Started", accuracy: 0, questionsAttempted: 0 }, { name: "Relative Velocity", status: "Not Started", accuracy: 0, questionsAttempted: 0 }, ] }, { name: "Laws of Motion", isExpanded: false, topics: [ { name: "Newton's First Law", status: "Not Started", accuracy: 0, questionsAttempted: 0 }, { name: "Friction", status: "Not Started", accuracy: 0, questionsAttempted: 0 }, ] }, { name: "Thermodynamics", isExpanded: false, topics: [ { name: "First Law", status: "Not Started", accuracy: 0, questionsAttempted: 0 }, { name: "Carnot Engine", status: "Not Started", accuracy: 0, questionsAttempted: 0 }, ] } ] }, { name: "Chemistry", completionPct: 0, chapters: [ { name: "Atomic Structure", isExpanded: false, topics: [ { name: "Bohr Model", status: "Not Started", accuracy: 0, questionsAttempted: 0 }, { name: "Quantum Numbers", status: "Not Started", accuracy: 0, questionsAttempted: 0 }, ] } ] }, { name: "Mathematics / Biology", completionPct: 0, chapters: [ { name: "Core Foundation", isExpanded: false, topics: [ { name: "Limits / Cell Structure", status: "Not Started", accuracy: 0, questionsAttempted: 0 }, { name: "Derivatives / Genetics", status: "Not Started", accuracy: 0, questionsAttempted: 0 }, ] } ] } ] export default function ProgressTrackerPage() { const { userId } = useActiveUser() const isDemo = isDemoUser(userId) const [subjects, setSubjects] = useState(isDemo ? DEMO_SUBJECTS : ZERO_SUBJECTS) useEffect(() => { setSubjects(isDemo ? DEMO_SUBJECTS : ZERO_SUBJECTS) }, [isDemo]) const toggleChapter = (subjectIndex: number, chapterIndex: number) => { const newSubjects = [...subjects] newSubjects[subjectIndex].chapters[chapterIndex].isExpanded = !newSubjects[subjectIndex].chapters[chapterIndex].isExpanded setSubjects(newSubjects) } return (

Syllabus Tracker

Track your syllabus coverage and mastery per chapter to ensure no gaps.

{subjects.map((sub, i) => (

{sub.name}

{sub.completionPct}%
))}
{subjects.map((subject, subIndex) => ( {subject.name} Syllabus
{subject.chapters.map((chapter, chapIndex) => (
{chapter.isExpanded && (
TOPIC ACCURACY QUESTIONS
{chapter.topics.map((topic, topIndex) => (
{getStatusIcon(topic.status)}

{topic.name}

{topic.status}

{topic.accuracy > 0 ? ( 80 ? 'text-emerald-500' : topic.accuracy > 60 ? 'text-amber-500' : 'text-red-500'}`}> {topic.accuracy}% ) : -}
{topic.questionsAttempted > 0 ? topic.questionsAttempted : '-'}
))}
)}
))}
))}
) }