feat(multi): add go back button with extra click penalty

This commit is contained in:
jessy-david-dev
2026-04-11 22:30:47 +02:00
parent d268905f2d
commit 54c4400393
3 changed files with 52 additions and 0 deletions
+13
View File
@@ -18,6 +18,8 @@ type GameScreenProps = {
elapsed: string;
countdown: number | null;
onNavigate: (title: string) => void;
onGoBack: () => void;
canGoBack: boolean;
onRetry: () => void;
onNextRound: () => void;
onResetGame: () => void;
@@ -36,6 +38,8 @@ export function GameScreen({
elapsed,
countdown,
onNavigate,
onGoBack,
canGoBack,
onRetry,
onNextRound,
onResetGame,
@@ -262,6 +266,15 @@ export function GameScreen({
<span>{clicks} clics</span>
<span className="hidden sm:inline">{myPlayer?.score ?? 0} pts</span>
</div>
{!myFinished && canGoBack && (
<button
onClick={onGoBack}
disabled={loading}
className="min-h-8 px-2 rounded-lg text-xs font-semibold bg-[#242424] border border-[#2e2e2e] text-[#f0f0f0] hover:bg-[#1a1a1a] disabled:opacity-50 cursor-pointer shrink-0"
>
+1
</button>
)}
{!myFinished && (
<button
onClick={onSurrender}
+2
View File
@@ -176,6 +176,8 @@ export function ScreenRouter({
elapsed={fmt(multi.elapsed)}
countdown={multi.countdown}
onNavigate={multi.navigate}
onGoBack={multi.goBack}
canGoBack={multi.canGoBack}
onRetry={multi.retryLoad}
onNextRound={handlers.handleNextRound}
onResetGame={handlers.handleResetGame}