UI, layout, and target exam logic updates
This commit is contained in:
@@ -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() {
|
||||
<div>
|
||||
<h1 className="text-3xl md:text-4xl font-black tracking-tight flex items-center gap-3 mb-1">
|
||||
<span className="p-2.5 rounded-xl bg-yellow-50 dark:bg-[var(--cyan-ai-10)] border border-yellow-300/60 dark:border-[var(--cyan-ai-20)]">
|
||||
<MonitorPlay className="text-yellow-600 dark:text-[var(--cyan-ai)]" size={28} />
|
||||
<CheckSquare className="text-yellow-600 dark:text-[var(--cyan-ai)]" size={28} />
|
||||
</span>
|
||||
Computer Based Tests (CBT)
|
||||
</h1>
|
||||
{/* BUG-09 fix: Dynamic subtitle reflecting current exam pattern tab (NEET vs JEE) */}
|
||||
<p className="text-muted-foreground text-base font-medium max-w-2xl pl-1">
|
||||
Real exam environment simulations to conquer {selectedPattern === "NEET" ? "NEET" : (targetExam || "JEE Main & Advanced")}.
|
||||
Real exam environment simulations to conquer {selectedPattern === "NEET" ? "NEET" : (targetExam || "JEE")}.
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex flex-col sm:flex-row gap-3">
|
||||
|
||||
@@ -133,22 +133,15 @@ export default function DashboardLayout({ children }: { children: ReactNode }) {
|
||||
active={pathname.startsWith("/dashboard/cbt")}
|
||||
isLocked={!hasAccessTo("weekly-test-series")}
|
||||
/>
|
||||
<NavItem
|
||||
{/* <NavItem
|
||||
section="pro"
|
||||
href="/dashboard/materials"
|
||||
icon={<BookOpen size={17} />}
|
||||
label="Quick Notes"
|
||||
active={pathname.startsWith("/dashboard/materials")}
|
||||
isLocked={!hasAccessTo("detailed-performance-analytics")}
|
||||
/>
|
||||
<NavItem
|
||||
section="pro"
|
||||
href="/dashboard/analytics"
|
||||
icon={<LineChart size={17} />}
|
||||
label="Performance Analytics"
|
||||
active={pathname.startsWith("/dashboard/analytics")}
|
||||
isLocked={!hasAccessTo("detailed-performance-analytics")}
|
||||
/>
|
||||
/> */}
|
||||
|
||||
<NavItem
|
||||
section="pro"
|
||||
href="/dashboard/community"
|
||||
@@ -170,6 +163,14 @@ export default function DashboardLayout({ children }: { children: ReactNode }) {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<NavItem
|
||||
section="ai"
|
||||
href="/dashboard/analytics"
|
||||
icon={<LineChart size={17} />}
|
||||
label="Performance Analytics"
|
||||
active={pathname.startsWith("/dashboard/analytics")}
|
||||
isLocked={!hasAccessTo("detailed-performance-analytics")}
|
||||
/>
|
||||
<NavItem
|
||||
section="ai"
|
||||
href="/dashboard/ai-coach/tutor"
|
||||
@@ -266,15 +267,7 @@ export default function DashboardLayout({ children }: { children: ReactNode }) {
|
||||
<div className="px-4 py-3 border-b border-border bg-secondary/30">
|
||||
<p className="text-sm font-bold text-foreground truncate">{cleanDisplayName(user.name)}</p>
|
||||
<p className="text-xs text-muted-foreground truncate">{user.email || user.phone}</p>
|
||||
{/* Trial info in dropdown */}
|
||||
{trialInfo.isTrialActive && (
|
||||
<div className="mt-1.5 flex items-center gap-1.5">
|
||||
<span className="inline-flex items-center gap-1 text-[10px] font-bold px-2 py-0.5 rounded-full bg-primary/10 text-primary border border-primary/20">
|
||||
Day {trialInfo.trialDayNumber} of {trialInfo.trialTotalDays} Trial
|
||||
</span>
|
||||
<span className="text-[10px] text-muted-foreground">{trialInfo.trialDaysRemaining}d left</span>
|
||||
</div>
|
||||
)}
|
||||
{/* Trial info in dropdown removed */}
|
||||
</div>
|
||||
<div className="p-1.5">
|
||||
<Link href="/dashboard/settings" className="flex items-center gap-2 px-3 py-2 text-sm text-foreground hover:bg-secondary rounded-lg transition-colors">
|
||||
@@ -310,13 +303,7 @@ export default function DashboardLayout({ children }: { children: ReactNode }) {
|
||||
<div className="flex-1 min-w-0">
|
||||
<p className="text-sm font-bold leading-none truncate">{user ? cleanDisplayName(user.name).split(" ")[0] : "Loading..."}</p>
|
||||
<div className="mt-1">
|
||||
{trialInfo.isTrialActive ? (
|
||||
<span className="inline-flex items-center text-[10px] font-bold text-primary">
|
||||
Day {trialInfo.trialDayNumber}/{trialInfo.trialTotalDays} Trial
|
||||
</span>
|
||||
) : (
|
||||
<TierBadge tier={user ? (user.tier === "Al_Coach" ? "AI Coach" : user.tier) : "Free"} />
|
||||
)}
|
||||
<TierBadge tier={user ? (user.tier === "Al_Coach" ? "AI Coach" : user.tier) : "Free"} />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -339,13 +326,7 @@ export default function DashboardLayout({ children }: { children: ReactNode }) {
|
||||
{targetExamLabel} Target
|
||||
</Badge>
|
||||
)}
|
||||
{/* Trial countdown badge — shown to trial users in top header */}
|
||||
{trialInfo.isTrialActive && (
|
||||
<Badge variant="outline" className="bg-primary/10 text-primary border-primary/20 font-bold px-2.5 py-0.5 hidden md:inline-flex gap-1">
|
||||
<span className="size-1.5 rounded-full bg-primary animate-pulse"></span>
|
||||
Day {trialInfo.trialDayNumber}/{trialInfo.trialTotalDays} Trial · {trialInfo.trialDaysRemaining}d left
|
||||
</Badge>
|
||||
)}
|
||||
{/* Trial countdown badge removed from top header */}
|
||||
</div>
|
||||
|
||||
<div className="flex items-center gap-4">
|
||||
|
||||
@@ -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<Subject[]>(isDemo ? DEMO_SUBJECTS : ZERO_SUBJECTS)
|
||||
const [subjects, setSubjects] = useState<Subject[]>([])
|
||||
|
||||
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() {
|
||||
<div>
|
||||
<h1 className="text-3xl md:text-4xl font-black tracking-tight flex items-center gap-3 mb-1">
|
||||
<span className="p-2.5 rounded-xl bg-yellow-50 dark:bg-[var(--cyan-ai-10)] border border-yellow-300/60 dark:border-[var(--cyan-ai-20)]">
|
||||
<Target className="text-yellow-600 dark:text-[var(--cyan-ai)]" size={28} />
|
||||
<BarChart3 className="text-yellow-600 dark:text-[var(--cyan-ai)]" size={28} />
|
||||
</span>
|
||||
Syllabus Tracker
|
||||
</h1>
|
||||
|
||||
@@ -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
|
||||
</h1>
|
||||
<p className="text-muted-foreground text-base font-medium max-w-2xl pl-1">
|
||||
Manage your personal details, school details, and platform preferences.
|
||||
Manage your personal details, institute details, and platform preferences.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -159,7 +159,7 @@ export default function SettingsPage() {
|
||||
<Card className="border-border bg-background shadow-sm">
|
||||
<CardHeader>
|
||||
<CardTitle>Profile Details</CardTitle>
|
||||
<CardDescription>Update your personal and school information.</CardDescription>
|
||||
<CardDescription>Update your personal and institute information.</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent className="space-y-4">
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
@@ -183,11 +183,11 @@ export default function SettingsPage() {
|
||||
</div>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<label className="text-sm font-bold">School Name</label>
|
||||
<label className="text-sm font-bold">Institute Name</label>
|
||||
<input
|
||||
type="text"
|
||||
value={school}
|
||||
placeholder="Enter your school name"
|
||||
placeholder="Enter your institute name"
|
||||
onChange={(e) => 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)]"
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user