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:
2026-09-19 22:34:45 +05:30
parent afab06d33c
commit 45f2f82eaf
11 changed files with 88 additions and 26 deletions

View File

@@ -1,6 +1,6 @@
"use client"
import { useState } from "react"
import { useState, useRef, useEffect } from "react"
import { Card, CardContent, CardHeader, CardTitle, CardFooter } from "@/components/ui/card"
import { Button } from "@/components/ui/button"
import { Input } from "@/components/ui/input"
@@ -39,6 +39,15 @@ export function AITutorChat() {
const [input, setInput] = useState('');
const [isOpen, setIsOpen] = useState(false);
const [isExpanded, setIsExpanded] = useState(false);
// BUG-03 fix: ref to anchor bottom of chat for auto-scroll
const bottomRef = useRef<HTMLDivElement>(null);
// Auto-scroll to latest message whenever messages change
useEffect(() => {
if (bottomRef.current) {
bottomRef.current.scrollIntoView({ behavior: 'smooth' });
}
}, [messages]);
const handleSend = () => {
if (!input.trim()) return;
@@ -118,6 +127,8 @@ export function AITutorChat() {
</div>
</div>
))}
{/* BUG-03 fix: invisible scroll anchor */}
<div ref={bottomRef} />
</CardContent>
<CardFooter className="p-4 border-t border-border bg-background shrink-0">