From e6f1fc9c1f3c3932f9848331e9b4398f3bb443a3 Mon Sep 17 00:00:00 2001 From: ectasy663 Date: Tue, 22 Sep 2026 17:26:22 +0530 Subject: [PATCH] UI, layout, and target exam logic updates --- src/app/dashboard/cbt/page.tsx | 11 +++---- src/app/dashboard/layout.tsx | 47 +++++++++------------------- src/app/dashboard/progress/page.tsx | 27 +++++++++++----- src/app/dashboard/settings/page.tsx | 10 +++--- src/components/AI/MistakeHeatmap.tsx | 12 ++----- src/components/AI/ProgressShare.tsx | 42 +++++++++++++++++-------- 6 files changed, 75 insertions(+), 74 deletions(-) diff --git a/src/app/dashboard/cbt/page.tsx b/src/app/dashboard/cbt/page.tsx index d4ec6ec..9aba5a1 100644 --- a/src/app/dashboard/cbt/page.tsx +++ b/src/app/dashboard/cbt/page.tsx @@ -1,11 +1,11 @@ -"use client"; +"use client"; import { useEffect, useState } from "react"; import Link from "next/link"; import { Button } from "@/components/ui/button"; import { Card, CardContent } from "@/components/ui/card"; import { Badge } from "@/components/ui/badge"; -import { Activity, Clock, PlayCircle, Search, Lock, MonitorPlay } from "lucide-react"; +import { Activity, Clock, PlayCircle, Search, Lock, CheckSquare } from "lucide-react"; import { useActiveUser } from "@/hooks/useActiveUser"; interface TestData { @@ -41,7 +41,7 @@ export default function CBTPage() { if (!userRes.ok) throw new Error("Failed to load user target exam"); const userData = await userRes.json(); const pattern = userData.target_exam; - setTargetExam(pattern === "NEET" ? "NEET" : pattern === "JEE_Advanced" ? "JEE Advanced" : "JEE Main"); + setTargetExam(pattern === "NEET" ? "NEET" : pattern === "JEE_Advanced" ? "JEE Advanced" : "JEE"); // Only set the initial pattern if it hasn't been changed by the user if (!selectedPattern) { @@ -130,13 +130,12 @@ export default function CBTPage() {

- + Computer Based Tests (CBT)

- {/* BUG-09 fix: Dynamic subtitle reflecting current exam pattern tab (NEET vs JEE) */}

- Real exam environment simulations to conquer {selectedPattern === "NEET" ? "NEET" : (targetExam || "JEE Main & Advanced")}. + Real exam environment simulations to conquer {selectedPattern === "NEET" ? "NEET" : (targetExam || "JEE")}.

diff --git a/src/app/dashboard/layout.tsx b/src/app/dashboard/layout.tsx index 4d21b3e..bee3c06 100644 --- a/src/app/dashboard/layout.tsx +++ b/src/app/dashboard/layout.tsx @@ -133,22 +133,15 @@ export default function DashboardLayout({ children }: { children: ReactNode }) { active={pathname.startsWith("/dashboard/cbt")} isLocked={!hasAccessTo("weekly-test-series")} /> - } label="Quick Notes" active={pathname.startsWith("/dashboard/materials")} isLocked={!hasAccessTo("detailed-performance-analytics")} - /> - } - label="Performance Analytics" - active={pathname.startsWith("/dashboard/analytics")} - isLocked={!hasAccessTo("detailed-performance-analytics")} - /> + /> */} +
+ } + label="Performance Analytics" + active={pathname.startsWith("/dashboard/analytics")} + isLocked={!hasAccessTo("detailed-performance-analytics")} + />

{cleanDisplayName(user.name)}

{user.email || user.phone}

- {/* Trial info in dropdown */} - {trialInfo.isTrialActive && ( -
- - Day {trialInfo.trialDayNumber} of {trialInfo.trialTotalDays} Trial - - {trialInfo.trialDaysRemaining}d left -
- )} + {/* Trial info in dropdown removed */}
@@ -310,13 +303,7 @@ export default function DashboardLayout({ children }: { children: ReactNode }) {

{user ? cleanDisplayName(user.name).split(" ")[0] : "Loading..."}

- {trialInfo.isTrialActive ? ( - - Day {trialInfo.trialDayNumber}/{trialInfo.trialTotalDays} Trial - - ) : ( - - )} +
@@ -339,13 +326,7 @@ export default function DashboardLayout({ children }: { children: ReactNode }) { {targetExamLabel} Target )} - {/* Trial countdown badge — shown to trial users in top header */} - {trialInfo.isTrialActive && ( - - - Day {trialInfo.trialDayNumber}/{trialInfo.trialTotalDays} Trial · {trialInfo.trialDaysRemaining}d left - - )} + {/* Trial countdown badge removed from top header */}
diff --git a/src/app/dashboard/progress/page.tsx b/src/app/dashboard/progress/page.tsx index 95c20f0..82de848 100644 --- a/src/app/dashboard/progress/page.tsx +++ b/src/app/dashboard/progress/page.tsx @@ -1,8 +1,8 @@ -"use client" +"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 { ChevronDown, ChevronRight, CheckCircle2, Circle, Clock, Activity, BarChart3 } from "lucide-react" import { useActiveUser, isDemoUser } from "@/hooks/useActiveUser" type ChapterStatus = 'Mastered' | 'Practiced' | 'In Progress' | 'Not Started' @@ -160,13 +160,26 @@ const ZERO_SUBJECTS: Subject[] = [ ] export default function ProgressTrackerPage() { - const { userId } = useActiveUser() + const { userId, user } = useActiveUser() const isDemo = isDemoUser(userId) - const [subjects, setSubjects] = useState(isDemo ? DEMO_SUBJECTS : ZERO_SUBJECTS) + const [subjects, setSubjects] = useState([]) useEffect(() => { - setSubjects(isDemo ? DEMO_SUBJECTS : ZERO_SUBJECTS) - }, [isDemo]) + const targetExam = user?.target_exam || "JEE_Main"; + const mathOrBio = targetExam === "NEET" ? "Biology" : "Mathematics"; + + const getSubjects = (demo: boolean) => { + const base = demo ? DEMO_SUBJECTS : ZERO_SUBJECTS; + return base.map(s => { + if (s.name === "Mathematics / Biology") { + return { ...s, name: mathOrBio }; + } + return s; + }); + }; + + setSubjects(getSubjects(isDemo)); + }, [isDemo, user?.target_exam]); const toggleChapter = (subjectIndex: number, chapterIndex: number) => { const newSubjects = [...subjects] @@ -180,7 +193,7 @@ export default function ProgressTrackerPage() {

- + Syllabus Tracker

diff --git a/src/app/dashboard/settings/page.tsx b/src/app/dashboard/settings/page.tsx index 979f64d..877be5c 100644 --- a/src/app/dashboard/settings/page.tsx +++ b/src/app/dashboard/settings/page.tsx @@ -1,4 +1,4 @@ -"use client"; +"use client"; import { useEffect, useState } from "react"; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; @@ -111,7 +111,7 @@ export default function SettingsPage() { Account Settings

- Manage your personal details, school details, and platform preferences. + Manage your personal details, institute details, and platform preferences.

@@ -159,7 +159,7 @@ export default function SettingsPage() { Profile Details - Update your personal and school information. + Update your personal and institute information.
@@ -183,11 +183,11 @@ export default function SettingsPage() {
- + setSchool(e.target.value)} className="w-full bg-secondary/50 border border-border rounded-lg px-4 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-[var(--cyan-ai)]" /> diff --git a/src/components/AI/MistakeHeatmap.tsx b/src/components/AI/MistakeHeatmap.tsx index a58ea2e..44707c5 100644 --- a/src/components/AI/MistakeHeatmap.tsx +++ b/src/components/AI/MistakeHeatmap.tsx @@ -24,8 +24,8 @@ export function MistakeHeatmap() { const isDemo = isDemoUser(userId); const getColor = (errorRate: number) => { - if (errorRate === 0) return 'bg-white/5 border-white/10 text-muted-foreground'; - if (errorRate >= 50) return 'bg-red-500/80 border-red-500 shadow-[0_0_10px_-2px_rgba(239,68,68,0.5)]'; // Critical + 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 @@ -41,7 +41,6 @@ export function MistakeHeatmap() { Mastery Map AI Coach -

{isDemo ? "Topic-wise error rate across last 5 tests." : "Topic-wise error rate across your recent test sessions."} @@ -95,13 +94,6 @@ export function MistakeHeatmap() { )} - {/* Legend */} -

-
{"0-10% (Optimal)"}
-
{"10-30%"}
-
{"30-50%"}
-
{"> 50%"}
-
) diff --git a/src/components/AI/ProgressShare.tsx b/src/components/AI/ProgressShare.tsx index 518c989..6cbca8e 100644 --- a/src/components/AI/ProgressShare.tsx +++ b/src/components/AI/ProgressShare.tsx @@ -1,4 +1,4 @@ -"use client" +"use client" import { Card, CardContent, CardHeader, CardTitle, CardDescription } from "@/components/ui/card" import { Button } from "@/components/ui/button" @@ -68,25 +68,41 @@ export function ProgressShare() { -
-

You crushed it this week!

-
-
- -
{streak}
+
+

You crushed it this week!

+
+
+ +
{streak}
Day Streak
-
- -
{accuracy}%
+
+ +
{accuracy}%
Accuracy
+
+ +
4
+
Tests Taken
+
+
+ +
78%
+
Avg Score
+
-
-
{name}
-
JEE Aspirant
+
+
+
{name}
+
{user?.tier === "Al_Coach" ? "AI Coach Plan" : `${user?.tier || "Free"} Plan`}
+
{user?.target_exam === "NEET" ? "NEET Aspirant" : "JEE Aspirant"}
+
+
+
contact@pragativeer.com
+