feat(P5C.T4): confetti burst on game win

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
byGalax
2026-05-16 22:26:25 +02:00
parent a974e5b8ab
commit 888ed1b217
3 changed files with 35 additions and 0 deletions
+17
View File
@@ -1,3 +1,4 @@
import confetti from 'canvas-confetti';
import { useEffect } from 'react';
import { useTranslation } from 'react-i18next';
@@ -44,6 +45,22 @@ export function GameModal({ gameId, onClose }: Props) {
: game.players[1] === game.winnerUserId
? 1
: null;
useEffect(() => {
if (finished && winnerIdx !== null && winnerIdx === myPlayerIdx) {
// Two bursts from the lower corners for a celebratory feel.
void confetti({
particleCount: 80,
spread: 60,
origin: { x: 0.2, y: 0.9 },
});
void confetti({
particleCount: 80,
spread: 60,
origin: { x: 0.8, y: 0.9 },
});
}
}, [finished, winnerIdx, myPlayerIdx]);
const title =
game?.gameType === 'c4'
? t('app:game.c4', { defaultValue: 'Vier-Gewinnt' })