Hide game sheet sections and winner selection until game has started
Wrapped WinnerBadge, SheetSection grid, and WinnerCard components in conditional rendering based on `gameStarted` flag derived from game metadata's `started` property. Prevents display of game content in lobby state before host initiates gameplay.
This commit is contained in:
@@ -622,6 +622,7 @@ export default function App() {
|
||||
: [];
|
||||
|
||||
const isHost = !!(me?.id && gameMeta?.host_user_id && me.id === gameMeta.host_user_id);
|
||||
const gameStarted = !!gameMeta?.started;
|
||||
|
||||
return (
|
||||
<div style={styles.page}>
|
||||
@@ -666,16 +667,18 @@ export default function App() {
|
||||
onStartGame={startGame}
|
||||
/>
|
||||
|
||||
{/* Sieger Badge: zwischen Spiel und Verdächtigte Person */}
|
||||
{gameStarted && (
|
||||
<WinnerBadge
|
||||
winner={{
|
||||
display_name: gameMeta?.winner_display_name || "",
|
||||
email: gameMeta?.winner_email || "",
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
||||
<HelpModal open={helpOpen} onClose={() => setHelpOpen(false)} />
|
||||
|
||||
{gameStarted && (
|
||||
<div style={{ marginTop: 14, display: "grid", gap: 14 }}>
|
||||
{sections.map((sec) => (
|
||||
<SheetSection
|
||||
@@ -689,8 +692,10 @@ export default function App() {
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Host-only Winner Auswahl */}
|
||||
{gameStarted && (
|
||||
<WinnerCard
|
||||
isHost={isHost}
|
||||
members={members}
|
||||
@@ -698,6 +703,7 @@ export default function App() {
|
||||
setWinnerUserId={setWinnerUserId}
|
||||
onSave={saveWinner}
|
||||
/>
|
||||
)}
|
||||
|
||||
<div style={{ height: 24 }} />
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user