diff --git a/frontend/app/[locale]/dashboard/page.tsx b/frontend/app/[locale]/dashboard/page.tsx index 7c19c8a0..84effb5b 100644 --- a/frontend/app/[locale]/dashboard/page.tsx +++ b/frontend/app/[locale]/dashboard/page.tsx @@ -3,6 +3,7 @@ import { getTranslations } from 'next-intl/server'; import { PostAuthQuizSync } from '@/components/auth/PostAuthQuizSync'; import { ExplainedTermsCard } from '@/components/dashboard/ExplainedTermsCard'; import { ProfileCard } from '@/components/dashboard/ProfileCard'; +import { QuizResultsSection } from '@/components/dashboard/QuizResultsSection'; import { QuizSavedBanner } from '@/components/dashboard/QuizSavedBanner'; import { StatsCard } from '@/components/dashboard/StatsCard'; import { DynamicGridBackground } from '@/components/shared/DynamicGridBackground'; @@ -116,6 +117,9 @@ export default async function DashboardPage({
+
+ +
diff --git a/frontend/app/[locale]/quiz/[slug]/page.tsx b/frontend/app/[locale]/quiz/[slug]/page.tsx index 47145586..5e3305f1 100644 --- a/frontend/app/[locale]/quiz/[slug]/page.tsx +++ b/frontend/app/[locale]/quiz/[slug]/page.tsx @@ -5,10 +5,10 @@ import { getTranslations } from 'next-intl/server'; import { QuizContainer } from '@/components/quiz/QuizContainer'; import { categoryTabStyles } from '@/data/categoryStyles'; -import { cn } from '@/lib/utils'; import { stripCorrectAnswers } from '@/db/queries/quiz'; import { getQuizBySlug, getQuizQuestionsRandomized } from '@/db/queries/quiz'; import { getCurrentUser } from '@/lib/auth'; +import { cn } from '@/lib/utils'; type MetadataProps = { params: Promise<{ locale: string; slug: string }> }; @@ -52,9 +52,10 @@ export default async function QuizPage({ notFound(); } - const categoryStyle = quiz.categorySlug - ? categoryTabStyles[quiz.categorySlug as keyof typeof categoryTabStyles] - : null; + const categoryStyle = + quiz.categorySlug && quiz.categorySlug in categoryTabStyles + ? categoryTabStyles[quiz.categorySlug as keyof typeof categoryTabStyles] + : null; const parsedSeed = seedParam ? Number.parseInt(seedParam, 10) : Number.NaN; const seed = Number.isFinite(parsedSeed) diff --git a/frontend/components/quiz/QuizQuestion.tsx b/frontend/components/quiz/QuizQuestion.tsx index 75ab5a3d..3be075f7 100644 --- a/frontend/components/quiz/QuizQuestion.tsx +++ b/frontend/components/quiz/QuizQuestion.tsx @@ -1,7 +1,7 @@ 'use client'; - import { BookOpen, Check, Lightbulb, X } from 'lucide-react'; import { useTranslations } from 'next-intl'; +import { useEffect, useRef } from 'react'; import { RadioGroup, RadioGroupItem } from '@/components/ui/radio-group'; import { QuizQuestionClient } from '@/db/queries/quiz'; @@ -36,6 +36,14 @@ export function QuizQuestion({ const isCorrectAnswer = isRevealed && isCorrect; + const nextButtonRef = useRef(null); + + useEffect(() => { + if (isRevealed) { + nextButtonRef.current?.scrollIntoView({ behavior: 'smooth', block: 'center' }); + } + }, [isRevealed]); + return (
@@ -130,6 +138,7 @@ export function QuizQuestion({ )} {isRevealed && (