fix: QA report bugs BUG-01 through BUG-11 resolved - streak modal close btn, calculator crash guard, AI chat auto-scroll, leaderboard zero-streak fix, name annotation cleanup everywhere, CBT score display colors, PrepPilot difficulty badge layout
This commit is contained in:
@@ -49,7 +49,11 @@ export default function DashboardLayout({ children }: { children: ReactNode }) {
|
||||
return () => document.removeEventListener("mousedown", handleClickOutside)
|
||||
}, [])
|
||||
|
||||
const userInitials = user ? user.name.split(" ").filter(n => /^[a-zA-Z]/.test(n)).slice(0, 2).map(n => n[0]).join("").toUpperCase() : "DS"
|
||||
// BUG-05 fix: strip any parenthetical role annotations from display names
|
||||
// e.g. "Rahul (AI Coach)" → "Rahul", "Priya (NEET Aspirant)" → "Priya"
|
||||
const cleanDisplayName = (name: string) => name.replace(/\s*\([^)]*\)\s*$/, '').trim();
|
||||
|
||||
const userInitials = user ? cleanDisplayName(user.name).split(" ").filter(n => /^[a-zA-Z]/.test(n)).slice(0, 2).map(n => n[0]).join("").toUpperCase() : "DS"
|
||||
const targetExamLabel = user?.target_exam === "JEE_Main" ? "JEE" : user?.target_exam === "JEE_Advanced" ? "JEE Advanced" : user?.target_exam === "NEET" ? "NEET" : "NEET/JEE"
|
||||
|
||||
// Trial logic removed as requested
|
||||
@@ -251,7 +255,7 @@ export default function DashboardLayout({ children }: { children: ReactNode }) {
|
||||
{dropdownOpen && user && (
|
||||
<div className="absolute bottom-full left-0 w-full mb-2 bg-background border border-border rounded-xl shadow-xl shadow-black/20 overflow-hidden animate-in fade-in slide-in-from-bottom-2 duration-200 z-50">
|
||||
<div className="px-4 py-3 border-b border-border bg-secondary/30">
|
||||
<p className="text-sm font-bold text-foreground truncate">{user.name}</p>
|
||||
<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 && (
|
||||
@@ -295,7 +299,7 @@ export default function DashboardLayout({ children }: { children: ReactNode }) {
|
||||
{userInitials}
|
||||
</div>
|
||||
<div className="flex-1 min-w-0">
|
||||
<p className="text-sm font-bold leading-none truncate">{user ? user.name.split(" ")[0] : "Loading..."}</p>
|
||||
<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">
|
||||
@@ -319,7 +323,7 @@ export default function DashboardLayout({ children }: { children: ReactNode }) {
|
||||
<header className="h-16 border-b border-border bg-background/95 backdrop-blur-md flex items-center justify-between px-8 shrink-0 z-40">
|
||||
<div className="flex items-center gap-4">
|
||||
<h2 className="font-bold text-lg hidden sm:block">
|
||||
{user ? `Welcome back, ${user.name.split(" ")[0]}!` : "Welcome back!"}
|
||||
{user ? `Welcome back, ${cleanDisplayName(user.name).split(" ")[0]}!` : "Welcome back!"}
|
||||
</h2>
|
||||
{user && (
|
||||
<Badge variant="outline" className="bg-cyan-500/10 text-cyan-700 dark:text-cyan-400 border-cyan-500/20 font-bold tracking-wide uppercase px-2.5 py-0.5 animate-pulse shadow-none dark:shadow-[0_0_10px_-2px_#00F0FF]">
|
||||
|
||||
Reference in New Issue
Block a user