From 3e7b89bcad182263d896546b232dc3cc1ba11a41 Mon Sep 17 00:00:00 2001 From: Joey Yakimowich-Payne Date: Tue, 13 Jan 2026 17:10:54 -0700 Subject: [PATCH] Stay on reason screen --- App.tsx | 2 ++ components/RevealScreen.tsx | 26 ++++++++++++++++++++------ hooks/useGame.ts | 8 ++++++-- 3 files changed, 28 insertions(+), 8 deletions(-) diff --git a/App.tsx b/App.tsx index 405be5d..47ed8e4 100644 --- a/App.tsx +++ b/App.tsx @@ -58,6 +58,7 @@ function App() { hasAnswered, lastPointsEarned, nextQuestion, + showScoreboard, currentCorrectShape, selectedOption, currentPlayerScore, @@ -158,6 +159,7 @@ function App() { correctOption={correctOpt} selectedOption={selectedOption} role={role} + onNext={showScoreboard} /> ) : null} diff --git a/components/RevealScreen.tsx b/components/RevealScreen.tsx index a501c68..f9ab10f 100644 --- a/components/RevealScreen.tsx +++ b/components/RevealScreen.tsx @@ -1,6 +1,6 @@ import React, { useEffect, useState } from 'react'; import { motion, useSpring, useTransform } from 'framer-motion'; -import { Check, X, Flame, Trophy } from 'lucide-react'; +import { Check, X, Flame, ChevronRight } from 'lucide-react'; import { AnswerOption, Player, GameRole } from '../types'; import { SHAPES, COLORS } from '../constants'; import confetti from 'canvas-confetti'; @@ -34,6 +34,7 @@ interface RevealScreenProps { correctOption: AnswerOption; selectedOption?: AnswerOption | null; role: GameRole; + onNext?: () => void; } export const RevealScreen: React.FC = ({ @@ -43,7 +44,8 @@ export const RevealScreen: React.FC = ({ streak, correctOption, selectedOption, - role + role, + onNext }) => { const isHost = role === 'HOST'; @@ -59,19 +61,18 @@ export const RevealScreen: React.FC = ({ } }, [isCorrect, isHost]); - // -- HOST VIEW -- if (isHost) { const ShapeIcon = SHAPES[correctOption.shape]; const colorClass = COLORS[correctOption.color]; return (
-
+
The correct answer is @@ -80,7 +81,7 @@ export const RevealScreen: React.FC = ({ initial={{ scale: 0, rotate: -10 }} animate={{ scale: 1, rotate: 0 }} transition={{ type: "spring", bounce: 0.5 }} - className={`${colorClass} p-12 rounded-[3rem] shadow-[0_20px_0_rgba(0,0,0,0.3)] flex flex-col items-center max-w-4xl w-full border-8 border-white/20`} + className={`${colorClass} p-12 rounded-[3rem] shadow-[0_20px_0_rgba(0,0,0,0.3)] flex flex-col items-center max-w-4xl w-full border-8 border-white/20 relative z-10`} >
@@ -99,6 +100,19 @@ export const RevealScreen: React.FC = ({ )} + + {onNext && ( + + Continue to Scoreboard + + + )}
); } diff --git a/hooks/useGame.ts b/hooks/useGame.ts index b565e1a..5bda1be 100644 --- a/hooks/useGame.ts +++ b/hooks/useGame.ts @@ -241,7 +241,11 @@ export const useGame = () => { if (timerRef.current) clearInterval(timerRef.current); setGameState('REVEAL'); broadcast({ type: 'TIME_UP', payload: {} }); - setTimeout(() => setGameState('SCOREBOARD'), 4000); + }; + + const showScoreboard = () => { + setGameState('SCOREBOARD'); + broadcast({ type: 'SHOW_SCOREBOARD', payload: { players: playersRef.current } }); }; const nextQuestion = () => { @@ -391,6 +395,6 @@ export const useGame = () => { return { role, gameState, quiz, players, currentQuestionIndex, timeLeft, error, gamePin, hasAnswered, lastPointsEarned, currentCorrectShape, selectedOption, currentPlayerScore, currentStreak, currentPlayerId, pendingQuizToSave, dismissSavePrompt, - startQuizGen, startManualCreation, finalizeManualQuiz, loadSavedQuiz, joinGame, startGame: startHostGame, handleAnswer, nextQuestion + startQuizGen, startManualCreation, finalizeManualQuiz, loadSavedQuiz, joinGame, startGame: startHostGame, handleAnswer, nextQuestion, showScoreboard }; }; \ No newline at end of file