"use client" import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" import { Badge } from "@/components/ui/badge" import { Flame, Info, CheckCircle2 } from "lucide-react" import { useActiveUser, isDemoUser } from "@/hooks/useActiveUser" const HEATMAP_DATA = [ { topic: "Rotational Dynamics", attempts: [80, 90, 40, 20, 10] }, // 10 is critical error rate { topic: "Electromagnetism", attempts: [30, 25, 20, 15, 10] }, { topic: "Thermodynamics", attempts: [5, 10, 5, 2, 0] }, { topic: "Optics", attempts: [60, 50, 45, 60, 55] }, { topic: "Modern Physics", attempts: [10, 5, 2, 0, 0] } ]; const ZERO_HEATMAP_DATA = [ { topic: "Physics (Core Mechanics)", attempts: [0, 0, 0, 0, 0] }, { topic: "Chemistry (Physical & Organic)", attempts: [0, 0, 0, 0, 0] }, { topic: "Mathematics / Biology", attempts: [0, 0, 0, 0, 0] }, ]; export function MistakeHeatmap() { const { userId } = useActiveUser(); const isDemo = isDemoUser(userId); const getColor = (errorRate: number) => { if (errorRate === 0) return 'bg-green-600/50 border-green-600/80 text-green-100'; if (errorRate >= 50) return 'bg-red-600/80 border-red-600 shadow-[0_0_10px_-2px_rgba(220,38,38,0.5)] text-red-100'; // Critical if (errorRate >= 30) return 'bg-amber-500/60 border-amber-500'; // Warning if (errorRate >= 10) return 'bg-yellow-500/30 border-yellow-500/50'; // Moderate return 'bg-green-500/20 border-green-500/30'; // Good }; const rows = isDemo ? HEATMAP_DATA : ZERO_HEATMAP_DATA; return (
Mastery Map AI Coach

{isDemo ? "Topic-wise error rate across last 5 tests." : "Topic-wise error rate across your recent test sessions."}

{/* Header row */}
Topic
T-4 T-3 T-2 T-1 Latest
{/* Data rows */}
{rows.map((row, idx) => (
{row.topic}
{row.attempts.map((errRate, i) => (
{errRate}%
))}
))}
{!isDemo && (
Clean Slate ยท 0 Errors Recorded

As you attempt DPPs and CBT mock tests, questions you get wrong will automatically be tracked and heatmapped here.

)}
) }