"use client"; import { useState } from "react"; import type { Room } from "../api/rooms/route"; type LobbyScreenProps = { room: Room; playerId: string; error: string | null; setError: (v: string | null) => void; loading: boolean; onLeave: () => void; onStart: () => void; onReset: () => void; }; export function LobbyScreen({ room, playerId, error, setError, loading, onLeave, onStart, onReset, }: LobbyScreenProps) { const isHost = room.players.find((p) => p.id === playerId)?.isHost ?? false; const [copied, setCopied] = useState(false); function copyCode() { navigator.clipboard.writeText(room.code).then(() => { setCopied(true); setTimeout(() => setCopied(false), 2000); }); } return (
{/* Code block */}
Code de la salle {copied ? "Copié !" : "Clique sur le code pour le copier"}
{error && (
{error}
)} {/* Players */}

Joueurs ({room.players.length}/8)

{room.round > 0 && (

Manche {room.round} terminée

)} {isHost ? (
{room.round > 0 && ( )}
) : (

En attente que l'hôte démarre...

)}
); }