"use client"
import { ReadinessGauge } from "@/components/AI/ReadinessGauge"
import { Card, CardContent } from "@/components/ui/card"
import { Button } from "@/components/ui/button"
import { Gauge, TrendingUp, Target, Award, ShieldAlert, CheckCircle2, BookOpen, Zap, BarChart2, Clock } from "lucide-react"
import Link from "next/link"
import { useActiveUser, isDemoUser } from "@/hooks/useActiveUser"
const DEMO_SCORE_HISTORY = [
{ week: "Wk 1", score: 54 },
{ week: "Wk 2", score: 60 },
{ week: "Wk 3", score: 63 },
{ week: "Wk 4", score: 68 },
{ week: "Wk 5", score: 72 },
{ week: "Wk 6", score: 78 },
]
const ZERO_SCORE_HISTORY = [
{ week: "Wk 1", score: 0 },
{ week: "Wk 2", score: 0 },
{ week: "Wk 3", score: 0 },
{ week: "Wk 4", score: 0 },
{ week: "Wk 5", score: 0 },
{ week: "Wk 6", score: 0 },
]
export default function ReadinessPage() {
const { userId } = useActiveUser()
const isDemo = isDemoUser(userId)
const scoreHistory = isDemo ? DEMO_SCORE_HISTORY : ZERO_SCORE_HISTORY
const maxScore = Math.max(1, ...scoreHistory.map(d => d.score))
return (
{/* Page Header */}
Exam Readiness Analytics
Real-time algorithmic prediction of your exam readiness — based on speed, accuracy, syllabus coverage, and test history.
AI Powered
{/* KPI Strip */}
{[
{ label: "Overall Score", value: isDemo ? "72 / 100" : "0 / 100", trend: isDemo ? "+5 this week" : "Baseline", trendUp: true, icon:
},
{ label: "Accuracy Rate", value: isDemo ? "88%" : "0%", trend: isDemo ? "+3% vs last week" : "0 attempts", trendUp: isDemo, icon:
},
{ label: "Avg Speed / Q", value: isDemo ? "45 sec" : "-- sec", trend: isDemo ? "↓ Needs work" : "Not tested", trendUp: false, icon:
},
{ label: "Syllabus Covered", value: isDemo ? "64%" : "0%", trend: isDemo ? "+8% this month" : "Day 1", trendUp: true, icon:
},
].map((kpi) => (
{kpi.icon}
{kpi.trend}
{kpi.value}
{kpi.label}
))}
{/* Readiness Score Card */}
Composite Readiness Index
{isDemo ? "Updated Daily" : "Day 1 Initializing"}
{/* Subject Confidence Matrix */}
Subject Confidence Matrix
{[
{ subject: "Biology / Maths", score: isDemo ? 82 : 0, color: "bg-[var(--cyan-ai)]", status: isDemo ? "High Readiness" : "Not Started", statusColor: isDemo ? "text-[var(--cyan-ai)]" : "text-muted-foreground" },
{ subject: "Chemistry", score: isDemo ? 74 : 0, color: "bg-amber-400", status: isDemo ? "Moderate Readiness" : "Not Started", statusColor: isDemo ? "text-amber-400" : "text-muted-foreground" },
{ subject: "Physics", score: isDemo ? 61 : 0, color: "bg-red-400", status: isDemo ? "Needs Intensive Drill" : "Not Started", statusColor: isDemo ? "text-red-400" : "text-muted-foreground" },
].map((sub) => (
{sub.subject}
{sub.score}% · {sub.status}
))}
{/* Score History Chart */}
6-Week Readiness Trend
{scoreHistory.map((d, i) => (
))}
{/* Sidebar */}
Readiness Boosters
{isDemo ? "Complete 2 full-length mock tests this week to boost consistency score." : "Complete your first diagnostic test to calculate your initial readiness baseline."}
{isDemo ? "Clear 15 pending errors in your Physics queue to gain ~4 readiness points." : "Attempt daily DPPs to populate your question error log."}
Maintain daily streak — consistency adds directly to your readiness algorithm.
Target under 45s per question in timed test series practice.
Quick Actions
{[
{ label: "Practice Physics DPP", href: "/dashboard/ai-coach/cbt-dpp", color: "text-[var(--cyan-ai)]" },
{ label: "Review Mistake Queue", href: "/dashboard/ai-coach/mistakes", color: "text-red-400" },
{ label: "View Exam Strategy", href: "/dashboard/ai-coach/strategy", color: "text-amber-400" },
{ label: "College Predictor", href: "/dashboard/ai-coach/college-predictor", color: "text-emerald-400" },
].map((a) => (
{a.label}
→
))}
)
}