Skip to content

Commit a8fcf84

Browse files
Zeff01claude
andcommitted
fix: Remove duplicate 'Back to Videos' button on Quiz step
Fixed confusing UX where Quiz step showed two similar buttons. Problem: - Quiz component has Previous/Next buttons for quiz navigation - OnboardingClient added "Back to Videos" button after Quiz component - This created two buttons that looked similar and confused users Solution: - Moved "Back to Videos" button inside Quiz component - Show it only on results screen, not during quiz questions - Button appears below the main action buttons (Retake/Continue) UX Flow: - During quiz: Only Previous/Next buttons visible - After quiz: Show results, action buttons, then "Back to Videos" - Commitment step: Keep "Back to Quiz" button (no conflict) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent fd77e67 commit a8fcf84

2 files changed

Lines changed: 35 additions & 31 deletions

File tree

‎apps/codebility/app/applicant/onboarding/_components/OnboardingClient.tsx‎

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -262,23 +262,11 @@ export default function OnboardingClient({
262262
)}
263263

264264
{currentStep === "quiz" && (
265-
<>
266-
<Quiz
267-
applicantId={applicantId}
268-
onQuizComplete={handleQuizComplete}
269-
/>
270-
271-
{/* Back to Videos Button */}
272-
<div className="mt-6">
273-
<Button
274-
onClick={handleBackToVideos}
275-
variant="outline"
276-
className="w-full sm:w-auto"
277-
>
278-
← Back to Videos
279-
</Button>
280-
</div>
281-
</>
265+
<Quiz
266+
applicantId={applicantId}
267+
onQuizComplete={handleQuizComplete}
268+
onBackToVideos={handleBackToVideos}
269+
/>
282270
)}
283271

284272
{currentStep === "commitment" && (

‎apps/codebility/app/applicant/onboarding/_components/Quiz.tsx‎

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ import { saveQuizProgress } from "../_service/action";
88
interface QuizProps {
99
applicantId: string;
1010
onQuizComplete: (score: number, totalQuestions: number) => void;
11+
onBackToVideos?: () => void;
1112
}
1213

13-
export default function Quiz({ applicantId, onQuizComplete }: QuizProps) {
14+
export default function Quiz({ applicantId, onQuizComplete, onBackToVideos }: QuizProps) {
1415
const [currentQuestionIndex, setCurrentQuestionIndex] = useState(0);
1516
const [selectedAnswers, setSelectedAnswers] = useState<Record<number, number>>({});
1617
const [showResults, setShowResults] = useState(false);
@@ -149,19 +150,34 @@ export default function Quiz({ applicantId, onQuizComplete }: QuizProps) {
149150
</div>
150151

151152
{/* Action Buttons */}
152-
<div className="flex justify-center gap-4">
153-
{!passed && (
154-
<Button onClick={handleRetake} variant="outline" className="px-8">
155-
Retake Quiz
156-
</Button>
157-
)}
158-
{passed && (
159-
<Button
160-
onClick={handleComplete}
161-
className="from-customTeal to-customViolet-100 bg-gradient-to-r via-customBlue-100 px-8"
162-
>
163-
Continue to Commitment
164-
</Button>
153+
<div className="flex flex-col gap-4">
154+
<div className="flex justify-center gap-4">
155+
{!passed && (
156+
<Button onClick={handleRetake} variant="outline" className="px-8">
157+
Retake Quiz
158+
</Button>
159+
)}
160+
{passed && (
161+
<Button
162+
onClick={handleComplete}
163+
className="from-customTeal to-customViolet-100 bg-gradient-to-r via-customBlue-100 px-8"
164+
>
165+
Continue to Commitment
166+
</Button>
167+
)}
168+
</div>
169+
170+
{/* Back to Videos Button */}
171+
{onBackToVideos && (
172+
<div className="flex justify-center">
173+
<Button
174+
onClick={onBackToVideos}
175+
variant="outline"
176+
className="w-full sm:w-auto"
177+
>
178+
← Back to Videos
179+
</Button>
180+
</div>
165181
)}
166182
</div>
167183
</div>

0 commit comments

Comments
 (0)