release/0.1.0 #18

Merged
ayoub merged 68 commits from release/0.1.0 into main 2026-06-11 18:36:42 +00:00
Showing only changes of commit a2dc687ac0 - Show all commits

View file

@ -68,16 +68,19 @@ export function LobbyView({ snapshot }: { snapshot: RoomSnapshot }) {
const totalTracks = snapshot.submissions.reduce((n, s) => n + s.count, 0)
const myCount =
snapshot.submissions.find((s) => s.playerId === playerId)?.count ?? 0
const showQuiz = gameType === "quiz" || gameType === "mixed"
const showBlindtest = gameType === "blindtest" || gameType === "mixed"
// Le blindtest exige au moins 3 joueurs connectés (DJ + 2 devineurs).
const connectedCount = snapshot.players.filter((p) => p.connected).length
const blindtestAvailable = connectedCount >= 3
// Tant que le blindtest est indisponible, on retombe sur du quiz (sans
// toucher au réglage stocké) : repasse en mixte automatiquement à 3 joueurs.
const effectiveType: GameType = blindtestAvailable ? gameType : "quiz"
const showQuiz = effectiveType === "quiz" || effectiveType === "mixed"
const showBlindtest =
effectiveType === "blindtest" || effectiveType === "mixed"
const rounds = buildRounds(gameType, showQuiz ? count : 0, totalTracks)
const canStart =
rounds.length > 0 && (!showBlindtest || blindtestAvailable)
const rounds = buildRounds(effectiveType, showQuiz ? count : 0, totalTracks)
const canStart = rounds.length > 0
async function start() {
setError(null)
@ -130,7 +133,7 @@ export function LobbyView({ snapshot }: { snapshot: RoomSnapshot }) {
<Button
key={t.value}
className="flex-1"
variant={gameType === t.value ? "default" : "secondary"}
variant={effectiveType === t.value ? "default" : "secondary"}
disabled={needsThree}
title={needsThree ? "Blindtest : 3 joueurs minimum" : undefined}
onClick={() => updateSettings({ gameType: t.value })}