diff --git a/backend/src/tools/schocken/routes.js b/backend/src/tools/schocken/routes.js index ecb00a9..37d65a3 100644 --- a/backend/src/tools/schocken/routes.js +++ b/backend/src/tools/schocken/routes.js @@ -586,4 +586,19 @@ function getGame(id, requesterId) { }; } +// ── Spiel abbrechen (Admin only, keine Punkte) ─────────────────────────────── +router.post('/:id/cancel', authenticate, (req, res) => { + if (req.user?.role !== 'admin') return res.status(403).json({ error: 'Nur Admin' }); + const game = db.prepare('SELECT * FROM schocken_games WHERE id=?').get(req.params.id); + if (!game) return res.status(404).json({ error: 'Nicht gefunden' }); + if (game.status === 'finished') return res.status(400).json({ error: 'Spiel bereits beendet' }); + db.prepare(`UPDATE schocken_games SET status='finished', phase_status='cancelled', + updated_at=datetime('now','localtime') WHERE id=?`).run(game.id); + const players = JSON.parse(game.players); + for (const p of players) { + sendPush(p.id, '🎲 Schocken', 'Das Spiel wurde vom Admin abgebrochen.'); + } + res.json({ ok: true }); +}); + module.exports = router; diff --git a/frontend/src/tools/schocken.jsx b/frontend/src/tools/schocken.jsx index 21000e4..840cda0 100644 --- a/frontend/src/tools/schocken.jsx +++ b/frontend/src/tools/schocken.jsx @@ -147,19 +147,63 @@ function DiceArea({ game, myId, onRoll, onReady, onEvaluate }) { ); } - // Auswertungsphase + // Auswertungsphase — alle Würfel sichtbar if (allDone) { const isFirstPlayer = activePlayers[0]?.id === myId || players[0]?.id === myId; return (
-
- Alle haben gewürfelt — Ergebnis auswerten! +
+ 🎲 Alle Becher oben — wer hat was?
+ {/* Alle Spieler mit Würfeln und Ergebnis */} + {activePlayers.map(p => { + const ps = round.playerStates?.[p.id]; + const isP = p.id === myId; + return ( +
+
+ + {p.username}{isP?' (du)':''} + + {ps?.dark && 🌑 war dunkel} + {ps?.roll_count && {ps.roll_count}. Wurf} +
+
+ {(ps?.dice||[null,null,null]).map((d,i) => )} +
+ {ps?.result && ( +
+ {ps.result.label} {ps.result.scheiben > 0 ? `→ ${ps.result.scheiben} Scheibe${ps.result.scheiben!==1?'n':''}` : ''} +
+ )} +
+ ); + })} {isFirstPlayer && ( - )} + {!isFirstPlayer && ( +
+ Warte auf {activePlayers[0]?.username} zum Auswerten… +
+ )}
); } @@ -613,6 +657,17 @@ export default function Schocken({ toast }) {

🎲 SCHOCKEN

+
+ {activeId && game?.status !== 'finished' && isAdmin && ( + + )}
{!activeId