chore: Secure routes with auth middleware, update text and fix minor bugs

This commit is contained in:
2026-08-03 17:55:20 +05:30
parent 62d15c85f6
commit c2fab50749
68 changed files with 2515 additions and 6808 deletions

View File

@@ -19,7 +19,7 @@ export function MistakeHeatmap() {
};
return (
<Card className="border-border bg-background shadow-sm h-full flex flex-col">
<Card className="border-border bg-background shadow-sm h-full min-h-[540px] flex flex-col justify-between">
<CardHeader className="pb-4">
<div className="flex items-center justify-between">
<CardTitle className="text-xl flex items-center gap-2">
@@ -30,47 +30,45 @@ export function MistakeHeatmap() {
</div>
<p className="text-sm text-muted-foreground">Topic-wise error rate across last 5 tests.</p>
</CardHeader>
<CardContent className="flex-1">
<div className="overflow-x-auto">
<div className="min-w-[400px]">
{/* Header row */}
<div className="flex mb-2">
<div className="w-40 shrink-0 text-xs font-bold text-muted-foreground uppercase tracking-wider">Topic</div>
<div className="flex-1 flex justify-between text-xs font-bold text-muted-foreground uppercase tracking-wider text-center">
<span>T-4</span>
<span>T-3</span>
<span>T-2</span>
<span>T-1</span>
<span>Latest</span>
</div>
<CardContent className="flex-1 p-4 md:p-6 flex flex-col justify-between">
<div className="w-full">
{/* Header row */}
<div className="flex items-center mb-3 text-xs sm:text-sm font-black text-muted-foreground uppercase tracking-wider">
<div className="w-32 sm:w-36 md:w-40 shrink-0 pr-2">Topic</div>
<div className="flex-1 grid grid-cols-5 gap-1 text-center">
<span>T-4</span>
<span>T-3</span>
<span>T-2</span>
<span>T-1</span>
<span>Latest</span>
</div>
{/* Data rows */}
<div className="space-y-3">
{HEATMAP_DATA.map((row, idx) => (
<div key={idx} className="flex items-center group">
<div className="w-40 shrink-0 text-sm font-medium truncate pr-2 group-hover:text-primary transition-colors">
{row.topic}
</div>
<div className="flex-1 flex justify-between gap-1">
{row.attempts.map((errRate, i) => (
<div
key={i}
className={`flex-1 h-8 rounded-md border transition-all duration-300 group-hover:scale-105 flex items-center justify-center cursor-help ${getColor(errRate)}`}
title={`Error Rate: ${errRate}%`}
>
<span className="text-[10px] font-bold text-foreground/80">{errRate}%</span>
</div>
))}
</div>
</div>
{/* Data rows */}
<div className="space-y-3">
{HEATMAP_DATA.map((row, idx) => (
<div key={idx} className="flex items-center group">
<div className="w-32 sm:w-36 md:w-40 shrink-0 text-xs sm:text-sm md:text-base font-bold truncate pr-2 group-hover:text-primary transition-colors" title={row.topic}>
{row.topic}
</div>
))}
</div>
<div className="flex-1 grid grid-cols-5 gap-1">
{row.attempts.map((errRate, i) => (
<div
key={i}
className={`h-8 sm:h-9 rounded-md border transition-all duration-300 group-hover:scale-105 flex items-center justify-center cursor-help ${getColor(errRate)}`}
title={`Error Rate: ${errRate}%`}
>
<span className="text-[10px] sm:text-xs font-black text-foreground/90">{errRate}%</span>
</div>
))}
</div>
</div>
))}
</div>
</div>
{/* Legend */}
<div className="mt-6 flex items-center justify-center gap-4 text-xs font-medium text-muted-foreground">
<div className="mt-6 pt-4 border-t border-border/50 flex flex-wrap items-center justify-center gap-x-4 gap-y-2 text-xs font-bold text-muted-foreground">
<div className="flex items-center gap-1.5"><div className="size-3 rounded-sm bg-green-500/20 border border-green-500/30"></div> {"< 10%"}</div>
<div className="flex items-center gap-1.5"><div className="size-3 rounded-sm bg-yellow-500/30 border border-yellow-500/50"></div> {"10-30%"}</div>
<div className="flex items-center gap-1.5"><div className="size-3 rounded-sm bg-amber-500/60 border border-amber-500"></div> {"30-50%"}</div>