diff --git a/src/app/dashboard/ai-coach/heatmap/page.tsx b/src/app/dashboard/ai-coach/heatmap/page.tsx
index 324712a..709c0fb 100644
--- a/src/app/dashboard/ai-coach/heatmap/page.tsx
+++ b/src/app/dashboard/ai-coach/heatmap/page.tsx
@@ -1,4 +1,4 @@
-"use client"
+"use client"
import { MistakeHeatmap } from "@/components/AI/MistakeHeatmap"
import { Flame, AlertTriangle, TrendingDown, BookOpen, ArrowRight, BarChart2, Target, CheckCircle2 } from "lucide-react"
@@ -44,7 +44,7 @@ export default function HeatmapPage() {
- Mistake Heatmap Vault
+ Mastery Map Vault
Visual density map of your errors across subjects and topics — pinpoint your weakest areas instantly.
@@ -148,7 +148,6 @@ export default function HeatmapPage() {
What To Do Next
{[
- { label: "Start Mistake Review Session", href: "/dashboard/ai-coach/mistakes" },
{ label: "Take a Physics DPP", href: "/dashboard/ai-coach/cbt-dpp" },
{ label: "Check Exam Readiness Score", href: "/dashboard/ai-coach/readiness" },
].map((link) => (
diff --git a/src/app/dashboard/ai-coach/mistakes/page.tsx b/src/app/dashboard/ai-coach/mistakes/page.tsx
deleted file mode 100644
index 479430a..0000000
--- a/src/app/dashboard/ai-coach/mistakes/page.tsx
+++ /dev/null
@@ -1,183 +0,0 @@
-"use client"
-
-import { useEffect, useState } from "react"
-import { MistakeHeatmap } from "@/components/AI/MistakeHeatmap"
-import { MistakeReviewCard, MistakePayload } from "@/components/AI/MistakeReviewCard"
-import { Card, CardContent } from "@/components/ui/card"
-import { Button } from "@/components/ui/button"
-import { BrainCircuit, RefreshCw, CheckCircle2, Flame, Sparkles, AlertTriangle, Target, Clock, TrendingDown } from "lucide-react"
-import { useActiveUser } from "@/hooks/useActiveUser"
-import { Badge } from "@/components/ui/badge"
-
-export default function MistakeTrackingPage() {
- const [mistakes, setMistakes] = useState
([])
- const [currentIndex, setCurrentIndex] = useState(0)
- const [loading, setLoading] = useState(true)
- const { userId, loading: userLoading } = useActiveUser()
-
- const fetchMistakes = async () => {
- if (!userId) return
- setLoading(true)
- try {
- const res = await fetch(`/api/mistakes/today?user_id=${userId}`)
- if (!res.ok) throw new Error("Failed to fetch")
- const data = await res.json()
- setMistakes(data)
- } catch {
- setMistakes([])
- } finally {
- setLoading(false)
- }
- }
-
- useEffect(() => {
- if (!userLoading && userId) fetchMistakes()
- }, [userId, userLoading])
-
- const submitReview = async (mistakeId: string, selectedAnswer: string) => {
- const res = await fetch("/api/mistakes/review", {
- method: "POST",
- headers: { "Content-Type": "application/json" },
- body: JSON.stringify({ mistake_id: mistakeId, selected_answer: selectedAnswer })
- })
- if (!res.ok) throw new Error("Failed to submit review")
- return await res.json()
- }
-
- const handleNext = () => {
- if (currentIndex < mistakes.length - 1) {
- setCurrentIndex(prev => prev + 1)
- } else {
- setCurrentIndex(mistakes.length)
- }
- }
-
- const completedCount = Math.min(currentIndex, mistakes.length)
- const progressPct = mistakes.length > 0 ? Math.round((completedCount / mistakes.length) * 100) : 0
- const avgErrorRate = mistakes.length > 0 ? "38%" : "0%"
-
- return (
-
- {/* Page Header */}
-
-
-
-
-
-
-
- Mistake Review & Spaced Repetition
-
-
- Review logged errors using our AI-powered spaced repetition engine. Questions resurface at optimal intervals to cement long-term retention.
-
-
-
- AI Powered
-
-
-
-
- {/* KPI Strip */}
- {!loading && (
-
- {[
- { label: "In Today's Queue", value: mistakes.length.toString(), icon:
, color: "border-amber-400/20 bg-amber-400/5" },
- { label: "Reviewed This Session", value: completedCount.toString(), icon:
, color: "border-green-400/20 bg-green-400/5" },
- { label: "Session Progress", value: `${progressPct}%`, icon:
, color: "border-[var(--cyan-ai-20)] bg-[var(--cyan-ai-10)]" },
- { label: "Avg Error Rate", value: avgErrorRate, icon:
, color: "border-red-400/20 bg-red-400/5" },
- ].map(kpi => (
-
-
- {kpi.icon}
- {kpi.value}
- {kpi.label}
-
-
- ))}
-
- )}
-
- {/* Progress bar */}
- {!loading && mistakes.length > 0 && (
-
-
- Session Progress
- {completedCount} of {mistakes.length} reviewed
-
-
-
- )}
-
- {/* Main 2-col layout */}
-
-
-
-
-
- Active Review Queue
-
- {mistakes.length > 0 && (
-
- {currentIndex < mistakes.length ? `${currentIndex + 1} / ${mistakes.length}` : "Complete"}
-
- )}
-
-
- {loading ? (
-
-
- Loading your review queue...
-
- ) : mistakes.length === 0 ? (
-
-
-
-
Queue Complete
-
- All scheduled reviews for today are done. Solve more practice tests to surface new questions here.
-
-
- window.location.reload()} variant="outline" className="rounded-xl font-bold h-10 px-6">
- Refresh Queue
-
-
- ) : currentIndex < mistakes.length ? (
-
- ) : (
-
-
-
-
Session Complete! 🎉
-
- All {mistakes.length} questions reviewed. The AI engine has scheduled your next review intervals.
-
-
- window.location.reload()} className="bg-[var(--cyan-ai)] text-black font-bold rounded-xl px-6 h-10 text-sm">
- Check for New Errors
-
-
- )}
-
-
- {/* Heatmap Column */}
-
-
-
- Error Density by Topic
-
-
-
-
-
- )
-}
diff --git a/src/app/dashboard/ai-coach/page.tsx b/src/app/dashboard/ai-coach/page.tsx
index b6fdad2..0c2200d 100644
--- a/src/app/dashboard/ai-coach/page.tsx
+++ b/src/app/dashboard/ai-coach/page.tsx
@@ -1,4 +1,4 @@
-"use client";
+"use client";
import { useEffect, useState } from "react"
import { MistakeHeatmap } from "@/components/AI/MistakeHeatmap"
@@ -10,7 +10,6 @@ import { StudyTimeOptimizationCard } from "@/components/AI/StudyTimeOptimization
import { TutorChat } from "@/components/AI/TutorChat"
import { ReferralCard } from "@/components/AI/ReferralCard"
import { ProgressShare } from "@/components/AI/ProgressShare"
-import { MistakeReviewCard, MistakePayload } from "@/components/AI/MistakeReviewCard"
import { DailyChallengeBanner } from "@/components/AI/DailyChallengeBanner"
import { WeeklyProgressReport } from "@/components/AI/WeeklyProgressReport"
import { Card, CardContent } from "@/components/ui/card"
@@ -33,33 +32,13 @@ function getDaysToExam(exam: string) {
}
export default function AICoachDashboard() {
- const [mistakes, setMistakes] = useState([])
- const [currentIndex, setCurrentIndex] = useState(0)
- const [loading, setLoading] = useState(true)
const [stats, setStats] = useState(null)
const { userId, user, hasAccessTo, loading: userLoading } = useActiveUser();
const isDemo = isDemoUser(userId);
- const fetchMistakes = async () => {
- if (!userId) return
- setLoading(true)
- try {
- const res = await fetch(`/api/mistakes/today?user_id=${userId}`)
- if (!res.ok) throw new Error("Failed to fetch")
- const data = await res.json()
- setMistakes(data)
- } catch (error) {
- console.error(error)
- setMistakes([])
- } finally {
- setLoading(false)
- }
- }
-
useEffect(() => {
if (!userLoading && userId) {
- fetchMistakes()
fetch(`/api/users/${userId}/stats`)
.then(res => res.ok ? res.json() : null)
.then(data => setStats(data))
@@ -67,24 +46,6 @@ export default function AICoachDashboard() {
}
}, [userId, userLoading])
- const submitReview = async (mistakeId: string, selectedAnswer: string) => {
- const res = await fetch("/api/mistakes/review", {
- method: "POST",
- headers: { "Content-Type": "application/json" },
- body: JSON.stringify({ mistake_id: mistakeId, selected_answer: selectedAnswer })
- })
- if (!res.ok) throw new Error("Failed to submit review")
- return await res.json()
- }
-
- const handleNext = () => {
- if (currentIndex < mistakes.length - 1) {
- setCurrentIndex(prev => prev + 1)
- } else {
- setCurrentIndex(mistakes.length)
- }
- }
-
if (userLoading) {
return (
@@ -188,53 +149,6 @@ export default function AICoachDashboard() {
- {/* ── MISTAKE REVIEW WORKSPACE ── */}
-
-
-
-
-
-
-
-
Daily Mistake Review Queue
-
SM-2 Spaced Repetition Flashcard Engine
-
-
-
-
- Open Full Mistake Vault Page →
-
-
- {currentIndex < mistakes.length ? `${currentIndex + 1} / ${mistakes.length}` : "Finished"}
-
-
-
-
- {loading ? (
-
- Loading queue...
-
- ) : mistakes.length === 0 ? (
-
-
- You're all caught up!
- No mistakes scheduled for review today. Go take a test!
-
- ) : currentIndex < mistakes.length ? (
-
- ) : (
-
-
- Session Complete
- Great job clearing your error queue! The SM-2 engine has scheduled your next reviews.
- window.location.reload()} variant="outline" className="rounded-xl">Check for New Errors
-
- )}
-
{/* ── HEATMAP / STUDY PLAN / WEEKLY REPORT ── */}
@@ -252,10 +166,10 @@ export default function AICoachDashboard() {
- Mistake Heatmap
+ Mastery Map
-
- Heatmap Vault →
+
+ Mastery Map Vault →
diff --git a/src/app/dashboard/layout.tsx b/src/app/dashboard/layout.tsx
index 3027485..4d21b3e 100644
--- a/src/app/dashboard/layout.tsx
+++ b/src/app/dashboard/layout.tsx
@@ -230,7 +230,7 @@ export default function DashboardLayout({ children }: { children: ReactNode }) {
section="ai"
href="/dashboard/ai-coach/heatmap"
icon={
}
- label="Mistake Heatmap"
+ label="Mastery Map"
active={pathname.startsWith("/dashboard/ai-coach/heatmap")}
isLocked={!hasAccessTo("ai-mistake-tracking")}
/>
@@ -242,14 +242,7 @@ export default function DashboardLayout({ children }: { children: ReactNode }) {
active={pathname.startsWith("/dashboard/ai-coach/weekly-progress")}
isLocked={!hasAccessTo("detailed-performance-analytics")}
/>
-
}
- label="Mistake Analyzer"
- active={pathname.startsWith("/dashboard/ai-coach/mistakes")}
- isLocked={!hasAccessTo("ai-mistake-tracking")}
- />
+
{/* Bottom Settings + Profile */}
diff --git a/src/components/AI/MistakeHeatmap.tsx b/src/components/AI/MistakeHeatmap.tsx
index ee74281..a58ea2e 100644
--- a/src/components/AI/MistakeHeatmap.tsx
+++ b/src/components/AI/MistakeHeatmap.tsx
@@ -1,4 +1,4 @@
-"use client"
+"use client"
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
import { Badge } from "@/components/ui/badge"
@@ -38,7 +38,7 @@ export function MistakeHeatmap() {
- Mistake Heatmap
+ Mastery Map
AI Coach