import { h } from 'preact'; import { useState } from 'preact/hooks'; import styles from './GameDetail.module.css'; import modalStyles from './PlayerSelectModal.module.css'; const StartingPlayerModal = ({ players, onSelect, onCancel }) => (
e.stopPropagation()}>

Welcher Spieler fängt an?

{/* A cancel button isn't strictly needed if a choice is mandatory */}
{players.map((player, index) => ( ))}
); const GameDetail141 = ({ game, onUpdate, onBack }) => { const handleSelectStartingPlayer = (playerIndex) => { onUpdate({ ...game, currentPlayer: playerIndex, }); }; // If no player is selected yet, show the modal if (game.currentPlayer === null || game.currentPlayer === undefined) { return ; } const currentPlayer = game.players[game.currentPlayer]; const handleTurnEnd = (remainingBalls) => { if (remainingBalls > game.ballsOnTable) { console.error("Cannot leave more balls than are on the table."); return; } const ballsPotted = game.ballsOnTable - remainingBalls; const newScore = currentPlayer.score + ballsPotted; const updatedPlayers = game.players.map((p, index) => index === game.currentPlayer ? { ...p, score: newScore } : p ); const nextPlayer = (game.currentPlayer + 1) % game.players.length; onUpdate({ ...game, players: updatedPlayers, ballsOnTable: remainingBalls, currentPlayer: nextPlayer, history: [...game.history, { player: currentPlayer.name, ballsPotted, newScore, ballsOnTable: remainingBalls }], }); }; return (
14/1 endlos | Race to {game.raceTo}
{game.players.map((p, idx) => (
{p.name} {p.score}
))}
Aktueller Spieler: {currentPlayer.name} ({game.ballsOnTable} Bälle auf dem Tisch)

Bälle am Ende der Aufnahme:

{Array.from({ length: 16 }, (_, i) => i).map(num => ( ))}
{/* Placeholder for future buttons */}

Fouls & Re-Racks (nächste Phase)

); }; export default GameDetail141;