From 7e4b603ae395fbe38ee5f5b3c8d35ccb6841ecf2 Mon Sep 17 00:00:00 2001 From: Davide Grilli Date: Tue, 21 Jul 2026 16:03:42 +0200 Subject: [PATCH] Show a draw animation and win/lose reveal on the user dashboard MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the round leaves "open" (closing/drawing/paying_out), the round card swaps its timer for a spinning "Estrazione del vincitore in corso…" state instead β€” bets are already rejected server-side once the round isn't open, this just reflects that visually. Once winner_user_id is set AND at least draw_animation_seconds has elapsed since the round started closing (client-tracked per round_id), it reveals "πŸŽ‰ Hai vinto! +N PLM" (compared against the user's own id from /users/me) or "Non hai vinto questa volta.", with a success toast on a win. The result stays on screen through the cooldown gap and only clears once a genuinely new round opens (tracked via activeResultRoundId), not the instant the old round has no active status. Polling is now dynamic (setTimeout-chained, not setInterval): 3s while the round is closing/drawing/paying_out for a responsive reveal, 15s while open. Co-Authored-By: Claude Sonnet 5 --- app/static/index.html | 113 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 106 insertions(+), 7 deletions(-) diff --git a/app/static/index.html b/app/static/index.html index 2caece6..efbb286 100644 --- a/app/static/index.html +++ b/app/static/index.html @@ -140,6 +140,19 @@ .hidden { display: none !important; } + .draw-state { display: none; text-align: center; padding: 8px 0 4px; } + .draw-state.active { display: block; } + .draw-spinner { + width: 40px; height: 40px; margin: 0 auto 10px; + border: 3px solid var(--color-border); border-top-color: var(--color-primary); + border-radius: 50%; animation: spin 900ms linear infinite; + } + @keyframes spin { to { transform: rotate(360deg); } } + .draw-state .draw-label { font-weight: 600; font-size: 0.95rem; } + .draw-result { font-size: 1.05rem; font-weight: 700; padding: 6px 0; } + .draw-result.win { color: var(--color-success); } + .draw-result.lose { color: var(--color-muted-foreground); } + #toast-container { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 100; width: calc(100% - 40px); max-width: 440px; @@ -201,11 +214,11 @@
-
+

Round β€”

--:--
-
+
Giocatori
β€” @@ -215,6 +228,13 @@ β€” PLM
+ +
+
+
Estrazione del vincitore in corso…
+
+ +