2026-04-10 15:43:07 +02:00
|
|
|
|
"use client";
|
|
|
|
|
|
|
|
|
|
|
|
import { useEffect, useRef } from "react";
|
|
|
|
|
|
import { ArticleView } from "./ArticleView";
|
|
|
|
|
|
import { Breadcrumbs } from "./Breadcrumbs";
|
|
|
|
|
|
import type { Room } from "../api/rooms/route";
|
2026-04-11 22:02:06 +02:00
|
|
|
|
import { useCtrlFBlock } from "../../lib/useSearchAllowed";
|
2026-04-10 15:43:07 +02:00
|
|
|
|
|
|
|
|
|
|
type GameScreenProps = {
|
|
|
|
|
|
room: Room;
|
|
|
|
|
|
playerId: string;
|
|
|
|
|
|
html: string;
|
|
|
|
|
|
title: string;
|
|
|
|
|
|
loading: boolean;
|
|
|
|
|
|
loadError: string | null;
|
|
|
|
|
|
history: string[];
|
|
|
|
|
|
clicks: number;
|
|
|
|
|
|
elapsed: string;
|
|
|
|
|
|
countdown: number | null;
|
2026-04-11 22:41:40 +02:00
|
|
|
|
timeLeft: number | null;
|
2026-04-10 15:43:07 +02:00
|
|
|
|
onNavigate: (title: string) => void;
|
2026-04-11 22:30:47 +02:00
|
|
|
|
onGoBack: () => void;
|
|
|
|
|
|
canGoBack: boolean;
|
2026-04-10 15:43:07 +02:00
|
|
|
|
onRetry: () => void;
|
|
|
|
|
|
onNextRound: () => void;
|
2026-04-13 00:20:17 +02:00
|
|
|
|
onStartGame: () => void;
|
2026-04-10 15:43:07 +02:00
|
|
|
|
onResetGame: () => void;
|
2026-04-11 21:58:35 +02:00
|
|
|
|
onSurrender: () => void;
|
2026-04-10 15:43:07 +02:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
export function GameScreen({
|
2026-04-11 22:25:34 +02:00
|
|
|
|
room,
|
|
|
|
|
|
playerId,
|
|
|
|
|
|
html,
|
|
|
|
|
|
title,
|
|
|
|
|
|
loading,
|
|
|
|
|
|
loadError,
|
|
|
|
|
|
history,
|
|
|
|
|
|
clicks,
|
|
|
|
|
|
elapsed,
|
|
|
|
|
|
countdown,
|
2026-04-11 22:41:40 +02:00
|
|
|
|
timeLeft,
|
2026-04-11 22:25:34 +02:00
|
|
|
|
onNavigate,
|
2026-04-11 22:30:47 +02:00
|
|
|
|
onGoBack,
|
|
|
|
|
|
canGoBack,
|
2026-04-11 22:25:34 +02:00
|
|
|
|
onRetry,
|
|
|
|
|
|
onNextRound,
|
2026-04-13 00:20:17 +02:00
|
|
|
|
onStartGame,
|
2026-04-11 22:25:34 +02:00
|
|
|
|
onResetGame,
|
|
|
|
|
|
onSurrender,
|
2026-04-10 15:43:07 +02:00
|
|
|
|
}: GameScreenProps) {
|
|
|
|
|
|
const breadcrumbEndRef = useRef<HTMLDivElement>(null);
|
2026-04-11 22:02:06 +02:00
|
|
|
|
useCtrlFBlock(room.searchAllowed);
|
2026-04-13 15:59:34 +02:00
|
|
|
|
|
|
|
|
|
|
function fmtMs(ms: number): string {
|
|
|
|
|
|
const s = Math.floor(ms / 1000);
|
|
|
|
|
|
const m = Math.floor(s / 60);
|
|
|
|
|
|
const sec = s % 60;
|
|
|
|
|
|
return m > 0 ? `${m}:${String(sec).padStart(2, "0")}` : `${sec}s`;
|
|
|
|
|
|
}
|
2026-04-10 15:43:07 +02:00
|
|
|
|
const myPlayer = room.players.find((p) => p.id === playerId);
|
|
|
|
|
|
const isHost = myPlayer?.isHost ?? false;
|
2026-04-11 21:58:35 +02:00
|
|
|
|
const myFinished = myPlayer?.hasWon || myPlayer?.hasSurrendered;
|
2026-04-10 15:43:07 +02:00
|
|
|
|
const sortedPlayers = [...room.players].sort((a, b) => b.score - a.score);
|
2026-04-11 22:25:34 +02:00
|
|
|
|
const winner = room.roundWinner
|
|
|
|
|
|
? room.players.find((p) => p.id === room.roundWinner)
|
|
|
|
|
|
: null;
|
2026-04-10 15:43:07 +02:00
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
2026-04-11 22:25:34 +02:00
|
|
|
|
breadcrumbEndRef.current?.scrollIntoView({
|
|
|
|
|
|
behavior: "smooth",
|
|
|
|
|
|
block: "nearest",
|
|
|
|
|
|
inline: "end",
|
|
|
|
|
|
});
|
2026-04-10 15:43:07 +02:00
|
|
|
|
}, [history]);
|
|
|
|
|
|
|
2026-04-11 22:25:34 +02:00
|
|
|
|
const btnPrimary =
|
|
|
|
|
|
"w-full min-h-11 px-5 rounded-xl text-sm font-semibold bg-[#7c3aed] text-white hover:bg-[#6d28d9] cursor-pointer transition-colors";
|
|
|
|
|
|
const btnGhost =
|
|
|
|
|
|
"w-full min-h-11 px-5 rounded-xl text-sm font-semibold bg-[#242424] border border-[#2e2e2e] text-[#f0f0f0] hover:bg-[#1a1a1a] cursor-pointer transition-colors";
|
2026-04-10 19:04:52 +02:00
|
|
|
|
|
2026-04-10 18:58:41 +02:00
|
|
|
|
// Results
|
2026-04-11 22:25:34 +02:00
|
|
|
|
if (room.phase === "results")
|
|
|
|
|
|
return (
|
|
|
|
|
|
<div className="min-h-dvh w-full bg-[#0f0f0f] text-[#f0f0f0] animate-fade-in flex items-center justify-center px-4 py-8">
|
|
|
|
|
|
<div className="w-full max-w-sm sm:max-w-md flex flex-col gap-5 sm:gap-6">
|
|
|
|
|
|
<div className="text-center bg-[#1a1a1a] border border-[#2e2e2e] rounded-xl p-5 sm:p-6">
|
|
|
|
|
|
{winner ? (
|
|
|
|
|
|
<>
|
|
|
|
|
|
<div className="text-4xl sm:text-5xl mb-2">🏆</div>
|
|
|
|
|
|
<div className="text-base sm:text-lg font-bold">
|
|
|
|
|
|
{winner.name} a gagné la manche !
|
2026-04-11 22:08:56 +02:00
|
|
|
|
</div>
|
2026-04-11 22:25:34 +02:00
|
|
|
|
</>
|
|
|
|
|
|
) : (
|
|
|
|
|
|
<div className="text-base sm:text-lg font-bold">
|
|
|
|
|
|
Manche terminée !
|
|
|
|
|
|
</div>
|
|
|
|
|
|
)}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div className="text-center text-xs sm:text-sm text-[#888]">
|
|
|
|
|
|
<span className="text-[#f0f0f0]">{room.startArticle}</span>
|
|
|
|
|
|
<span className="mx-2">→</span>
|
|
|
|
|
|
<span className="text-[#7c3aed] font-bold">
|
|
|
|
|
|
{room.targetArticle}
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<h3 className="text-[10px] sm:text-xs font-bold text-[#888] uppercase tracking-wider mb-3">
|
|
|
|
|
|
Classement
|
|
|
|
|
|
</h3>
|
|
|
|
|
|
<ul className="flex flex-col gap-2">
|
|
|
|
|
|
{sortedPlayers.map((p, i) => (
|
|
|
|
|
|
<li
|
|
|
|
|
|
key={p.id}
|
|
|
|
|
|
className={`flex flex-col gap-2 bg-[#1a1a1a] rounded-xl px-3.5 py-2.5 border ${p.id === playerId ? "border-[#7c3aed]" : "border-[#2e2e2e]"}`}
|
|
|
|
|
|
>
|
|
|
|
|
|
<div className="flex items-center gap-2 min-h-7">
|
|
|
|
|
|
<span className="text-xs sm:text-sm font-bold text-[#888] min-w-6 sm:min-w-7">
|
|
|
|
|
|
#{i + 1}
|
|
|
|
|
|
</span>
|
|
|
|
|
|
<span className="flex-1 font-semibold text-sm truncate">
|
|
|
|
|
|
{p.name}
|
|
|
|
|
|
</span>
|
|
|
|
|
|
{p.hasWon && (
|
|
|
|
|
|
<span className="text-[10px] font-bold px-2 py-0.5 rounded-full bg-green-900/40 text-green-300 uppercase tracking-wide shrink-0">
|
|
|
|
|
|
✓ Trouvé
|
|
|
|
|
|
</span>
|
|
|
|
|
|
)}
|
|
|
|
|
|
{p.hasSurrendered && (
|
|
|
|
|
|
<span className="text-[10px] font-bold px-2 py-0.5 rounded-full bg-[#242424] text-[#888] uppercase tracking-wide shrink-0">
|
|
|
|
|
|
Forfait
|
2026-04-11 22:08:56 +02:00
|
|
|
|
</span>
|
2026-04-11 22:25:34 +02:00
|
|
|
|
)}
|
|
|
|
|
|
<span className="font-bold text-[#7c3aed] text-sm shrink-0">
|
|
|
|
|
|
{p.score} pts
|
|
|
|
|
|
</span>
|
2026-04-11 22:08:56 +02:00
|
|
|
|
</div>
|
2026-04-11 22:25:34 +02:00
|
|
|
|
{p.path && p.path.length > 0 && (
|
|
|
|
|
|
<div className="flex flex-wrap items-center gap-x-1 gap-y-0.5 text-[11px] text-[#666] pl-6 sm:pl-7">
|
|
|
|
|
|
{p.path.map((t, j) => (
|
|
|
|
|
|
<span key={j} className="flex items-center gap-0.5">
|
|
|
|
|
|
{j > 0 && <span className="text-[#444]">›</span>}
|
|
|
|
|
|
<span
|
|
|
|
|
|
className={
|
|
|
|
|
|
j === 0
|
|
|
|
|
|
? "text-[#555]"
|
|
|
|
|
|
: j === p.path.length - 1 && p.hasWon
|
|
|
|
|
|
? "text-green-400 font-semibold"
|
|
|
|
|
|
: j === p.path.length - 1 && p.hasSurrendered
|
|
|
|
|
|
? "text-[#888]"
|
|
|
|
|
|
: "text-[#888]"
|
|
|
|
|
|
}
|
|
|
|
|
|
>
|
|
|
|
|
|
{t}
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</span>
|
|
|
|
|
|
))}
|
|
|
|
|
|
<span className="text-[#555] ml-1">
|
|
|
|
|
|
({p.path.length - 1} clic
|
2026-04-13 15:59:34 +02:00
|
|
|
|
{p.path.length - 1 > 1 ? "s" : ""}
|
|
|
|
|
|
{p.hasWon && p.wonAt && room.roundStart
|
|
|
|
|
|
? ` · ${fmtMs(p.wonAt - room.roundStart)}`
|
|
|
|
|
|
: ""}
|
|
|
|
|
|
)
|
2026-04-11 22:25:34 +02:00
|
|
|
|
</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
)}
|
|
|
|
|
|
</li>
|
|
|
|
|
|
))}
|
|
|
|
|
|
</ul>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div className="text-center text-xs text-[#555]">
|
|
|
|
|
|
Manche {room.round}/{room.totalRounds}
|
2026-04-10 18:58:41 +02:00
|
|
|
|
</div>
|
2026-04-11 22:25:34 +02:00
|
|
|
|
{isHost ? (
|
|
|
|
|
|
<div className="flex flex-col gap-2.5">
|
|
|
|
|
|
{room.round < room.totalRounds ? (
|
|
|
|
|
|
<button className={btnPrimary} onClick={onNextRound}>
|
|
|
|
|
|
Manche suivante
|
|
|
|
|
|
</button>
|
|
|
|
|
|
) : (
|
|
|
|
|
|
<button className={btnPrimary} onClick={onResetGame}>
|
|
|
|
|
|
Partie terminée - Recommencer
|
|
|
|
|
|
</button>
|
|
|
|
|
|
)}
|
|
|
|
|
|
{room.round < room.totalRounds && (
|
|
|
|
|
|
<button className={btnGhost} onClick={onResetGame}>
|
|
|
|
|
|
Arrêter la partie
|
|
|
|
|
|
</button>
|
|
|
|
|
|
)}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
) : (
|
|
|
|
|
|
<p className="text-xs sm:text-sm text-[#888] text-center animate-pulse-slow">
|
|
|
|
|
|
En attente de l'hôte...
|
|
|
|
|
|
</p>
|
|
|
|
|
|
)}
|
|
|
|
|
|
</div>
|
2026-04-10 15:43:07 +02:00
|
|
|
|
</div>
|
2026-04-11 22:25:34 +02:00
|
|
|
|
);
|
2026-04-10 15:43:07 +02:00
|
|
|
|
|
2026-04-11 22:19:25 +02:00
|
|
|
|
// Entre les manches : attente que l'hôte démarre la suivante
|
2026-04-11 22:25:34 +02:00
|
|
|
|
if (room.phase === "waiting")
|
|
|
|
|
|
return (
|
|
|
|
|
|
<div className="min-h-dvh w-full bg-[#0f0f0f] text-[#f0f0f0] flex items-center justify-center px-4">
|
|
|
|
|
|
<div className="text-center flex flex-col items-center gap-4">
|
|
|
|
|
|
<div className="text-2xl font-black">
|
|
|
|
|
|
Manche {room.round}/{room.totalRounds} terminée
|
2026-04-11 22:19:25 +02:00
|
|
|
|
</div>
|
2026-04-11 22:25:34 +02:00
|
|
|
|
<p className="text-sm text-[#888] animate-pulse-slow">
|
|
|
|
|
|
{isHost
|
|
|
|
|
|
? "Lance la manche suivante quand tu veux."
|
|
|
|
|
|
: "En attente que l'hôte démarre la prochaine manche..."}
|
|
|
|
|
|
</p>
|
|
|
|
|
|
{isHost && (
|
|
|
|
|
|
<div className="flex flex-col gap-2.5 w-full max-w-xs mt-2">
|
2026-04-13 00:20:17 +02:00
|
|
|
|
<button className={btnPrimary} onClick={onStartGame}>
|
2026-04-11 22:25:34 +02:00
|
|
|
|
Manche suivante
|
|
|
|
|
|
</button>
|
|
|
|
|
|
<button className={btnGhost} onClick={onResetGame}>
|
|
|
|
|
|
Arrêter la partie
|
|
|
|
|
|
</button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
)}
|
|
|
|
|
|
</div>
|
2026-04-11 22:19:25 +02:00
|
|
|
|
</div>
|
2026-04-11 22:25:34 +02:00
|
|
|
|
);
|
2026-04-11 22:19:25 +02:00
|
|
|
|
|
2026-04-10 18:58:41 +02:00
|
|
|
|
// Countdown
|
2026-04-11 22:25:34 +02:00
|
|
|
|
if (room.phase === "countdown")
|
|
|
|
|
|
return (
|
|
|
|
|
|
<div className="min-h-dvh w-full bg-[#0f0f0f] text-[#f0f0f0] flex items-center justify-center px-4">
|
|
|
|
|
|
<div className="text-center">
|
|
|
|
|
|
<div className="flex items-center justify-center gap-6 sm:gap-10 flex-col sm:flex-row mb-10 sm:mb-12">
|
|
|
|
|
|
<div className="flex flex-col items-center gap-1 max-w-48">
|
|
|
|
|
|
<span className="text-[10px] sm:text-[11px] text-[#888] uppercase tracking-wider">
|
|
|
|
|
|
Départ
|
|
|
|
|
|
</span>
|
|
|
|
|
|
<span className="text-base sm:text-lg font-bold text-center">
|
|
|
|
|
|
{room.startArticle}
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<span className="text-xl sm:text-2xl text-[#888] rotate-90 sm:rotate-0">
|
|
|
|
|
|
→
|
|
|
|
|
|
</span>
|
|
|
|
|
|
<div className="flex flex-col items-center gap-1 max-w-48">
|
|
|
|
|
|
<span className="text-[10px] sm:text-[11px] text-[#888] uppercase tracking-wider">
|
|
|
|
|
|
Cible
|
|
|
|
|
|
</span>
|
|
|
|
|
|
<span className="text-lg sm:text-xl font-bold text-[#7c3aed] text-center">
|
|
|
|
|
|
{room.targetArticle}
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</div>
|
2026-04-10 15:43:07 +02:00
|
|
|
|
</div>
|
2026-04-11 22:25:34 +02:00
|
|
|
|
<div className="text-[clamp(72px,20vw,140px)] font-black leading-none text-[#7c3aed] animate-count-pop">
|
|
|
|
|
|
{countdown !== null && countdown > 0 ? countdown : "Partez !"}
|
2026-04-10 15:43:07 +02:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2026-04-11 22:25:34 +02:00
|
|
|
|
);
|
2026-04-10 15:43:07 +02:00
|
|
|
|
|
2026-04-10 18:58:41 +02:00
|
|
|
|
// Playing
|
2026-04-10 15:43:07 +02:00
|
|
|
|
return (
|
2026-04-10 18:58:41 +02:00
|
|
|
|
<div className="min-h-dvh w-full bg-[#0f0f0f] flex flex-col">
|
|
|
|
|
|
{/* Topbar */}
|
2026-04-10 19:04:52 +02:00
|
|
|
|
<div className="sticky top-0 z-50 bg-[#0f0f0f]/97 backdrop-blur-sm border-b border-[#2e2e2e] flex items-center gap-2 sm:gap-3 px-3 sm:px-3.5 py-2">
|
2026-04-13 15:45:39 +02:00
|
|
|
|
<div className="flex-1 min-w-0 flex flex-col gap-1">
|
|
|
|
|
|
<div className="flex items-center gap-1.5 min-w-0">
|
|
|
|
|
|
<span className="shrink-0 text-xs font-black text-[#a78bfa]">
|
|
|
|
|
|
Cible →
|
2026-04-11 22:25:34 +02:00
|
|
|
|
</span>
|
2026-04-13 15:45:39 +02:00
|
|
|
|
<span className="truncate text-sm sm:text-base font-black text-white bg-[#7c3aed] px-2 py-0.5 rounded-lg leading-tight">
|
2026-04-11 22:25:34 +02:00
|
|
|
|
{room.targetArticle}
|
|
|
|
|
|
</span>
|
2026-04-10 15:43:07 +02:00
|
|
|
|
</div>
|
|
|
|
|
|
<Breadcrumbs history={history} endRef={breadcrumbEndRef} />
|
|
|
|
|
|
</div>
|
2026-04-11 21:58:35 +02:00
|
|
|
|
<div className="flex items-center gap-2 sm:gap-3 shrink-0">
|
2026-04-11 22:41:40 +02:00
|
|
|
|
<div className="flex items-center gap-2 sm:gap-3 text-[10px] sm:text-xs font-bold tabular-nums">
|
|
|
|
|
|
{timeLeft !== null && (
|
2026-04-13 15:45:39 +02:00
|
|
|
|
<span
|
|
|
|
|
|
className={`font-black ${timeLeft <= 10 ? "text-red-400 animate-pulse" : timeLeft <= 30 ? "text-orange-400" : "text-[#888]"}`}
|
|
|
|
|
|
>
|
2026-04-11 22:41:40 +02:00
|
|
|
|
{timeLeft}s
|
|
|
|
|
|
</span>
|
|
|
|
|
|
)}
|
|
|
|
|
|
<span className="text-[#888]">{elapsed}</span>
|
|
|
|
|
|
<span className="text-[#888]">{clicks} clics</span>
|
2026-04-13 15:45:39 +02:00
|
|
|
|
<span className="hidden sm:inline text-[#888]">
|
|
|
|
|
|
{myPlayer?.score ?? 0} pts
|
|
|
|
|
|
</span>
|
2026-04-11 21:58:35 +02:00
|
|
|
|
</div>
|
2026-04-11 22:30:47 +02:00
|
|
|
|
{!myFinished && canGoBack && (
|
|
|
|
|
|
<button
|
|
|
|
|
|
onClick={onGoBack}
|
|
|
|
|
|
disabled={loading}
|
|
|
|
|
|
className="min-h-8 px-2 rounded-lg text-xs font-semibold bg-[#242424] border border-[#2e2e2e] text-[#f0f0f0] hover:bg-[#1a1a1a] disabled:opacity-50 cursor-pointer shrink-0"
|
|
|
|
|
|
>
|
|
|
|
|
|
← +1
|
|
|
|
|
|
</button>
|
|
|
|
|
|
)}
|
2026-04-11 21:58:35 +02:00
|
|
|
|
{!myFinished && (
|
|
|
|
|
|
<button
|
|
|
|
|
|
onClick={onSurrender}
|
|
|
|
|
|
className="min-h-8 px-2 rounded-lg text-xs font-semibold bg-red-950/40 border border-red-900 text-red-400 hover:bg-red-900/40 cursor-pointer shrink-0"
|
|
|
|
|
|
>
|
|
|
|
|
|
Forfait
|
|
|
|
|
|
</button>
|
|
|
|
|
|
)}
|
|
|
|
|
|
{myFinished && myPlayer?.hasWon && (
|
2026-04-11 22:25:34 +02:00
|
|
|
|
<span className="text-xs font-bold text-green-400 shrink-0">
|
|
|
|
|
|
✓ Trouvé !
|
|
|
|
|
|
</span>
|
2026-04-11 21:58:35 +02:00
|
|
|
|
)}
|
|
|
|
|
|
{myFinished && myPlayer?.hasSurrendered && (
|
2026-04-11 22:25:34 +02:00
|
|
|
|
<span className="text-xs font-bold text-[#888] shrink-0">
|
|
|
|
|
|
Forfait
|
|
|
|
|
|
</span>
|
2026-04-11 21:58:35 +02:00
|
|
|
|
)}
|
2026-04-10 15:43:07 +02:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
2026-04-10 19:04:52 +02:00
|
|
|
|
{/* Content */}
|
2026-04-10 18:58:41 +02:00
|
|
|
|
<div className="flex flex-1 min-h-0">
|
|
|
|
|
|
<div className="flex-1 overflow-y-auto bg-white">
|
2026-04-10 15:43:07 +02:00
|
|
|
|
{loading && (
|
2026-04-10 18:58:41 +02:00
|
|
|
|
<div className="flex items-center gap-3 py-10 px-4 text-[#888]">
|
|
|
|
|
|
<div className="spinner" /> Chargement...
|
|
|
|
|
|
</div>
|
2026-04-10 15:43:07 +02:00
|
|
|
|
)}
|
|
|
|
|
|
{loadError && (
|
2026-04-10 18:58:41 +02:00
|
|
|
|
<div className="flex flex-col items-center gap-4 py-10 px-4 text-center">
|
2026-04-10 19:04:52 +02:00
|
|
|
|
<p className="text-[#888] text-sm">{loadError}</p>
|
2026-04-11 22:25:34 +02:00
|
|
|
|
<button
|
|
|
|
|
|
className="min-h-11 px-5 rounded-xl text-sm font-semibold bg-[#2563eb] text-white hover:bg-[#1d4ed8] cursor-pointer"
|
|
|
|
|
|
onClick={onRetry}
|
|
|
|
|
|
>
|
2026-04-10 18:58:41 +02:00
|
|
|
|
Réessayer
|
|
|
|
|
|
</button>
|
2026-04-10 15:43:07 +02:00
|
|
|
|
</div>
|
|
|
|
|
|
)}
|
|
|
|
|
|
{!loading && !loadError && html && (
|
|
|
|
|
|
<div className="article-container">
|
|
|
|
|
|
<h1 className="article-title">{title}</h1>
|
2026-04-11 22:25:34 +02:00
|
|
|
|
<ArticleView
|
|
|
|
|
|
html={html}
|
|
|
|
|
|
onNavigate={onNavigate}
|
|
|
|
|
|
disabled={loading}
|
|
|
|
|
|
/>
|
2026-04-10 15:43:07 +02:00
|
|
|
|
</div>
|
|
|
|
|
|
)}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
2026-04-10 22:26:24 +02:00
|
|
|
|
{/* Sidebar - desktop seulement */}
|
2026-04-10 19:04:52 +02:00
|
|
|
|
<aside className="hidden md:flex w-36 lg:w-44 shrink-0 bg-[#1a1a1a] border-l border-[#2e2e2e] flex-col px-3 py-4 overflow-y-auto gap-3">
|
2026-04-11 22:25:34 +02:00
|
|
|
|
<h4 className="text-[10px] font-bold uppercase tracking-wider text-[#888]">
|
|
|
|
|
|
Joueurs
|
|
|
|
|
|
</h4>
|
2026-04-10 18:58:41 +02:00
|
|
|
|
<ul className="flex flex-col gap-2.5">
|
2026-04-10 15:43:07 +02:00
|
|
|
|
{sortedPlayers.map((p) => (
|
2026-04-10 18:58:41 +02:00
|
|
|
|
<li key={p.id} className="flex flex-col gap-0.5">
|
2026-04-11 22:25:34 +02:00
|
|
|
|
<span
|
|
|
|
|
|
className={`text-xs font-semibold truncate ${p.id === playerId ? "text-[#7c3aed]" : "text-[#f0f0f0]"}`}
|
|
|
|
|
|
>
|
|
|
|
|
|
{p.name}
|
|
|
|
|
|
</span>
|
2026-04-10 18:58:41 +02:00
|
|
|
|
<span className="text-xs text-[#888]">{p.score} pts</span>
|
2026-04-11 22:25:34 +02:00
|
|
|
|
{p.hasWon && (
|
|
|
|
|
|
<span className="text-[10px] text-green-400 font-bold">
|
|
|
|
|
|
✓ Trouvé
|
|
|
|
|
|
</span>
|
|
|
|
|
|
)}
|
|
|
|
|
|
{p.hasSurrendered && (
|
|
|
|
|
|
<span className="text-[10px] text-[#888] font-bold">
|
|
|
|
|
|
Forfait
|
|
|
|
|
|
</span>
|
|
|
|
|
|
)}
|
2026-04-10 15:43:07 +02:00
|
|
|
|
</li>
|
|
|
|
|
|
))}
|
|
|
|
|
|
</ul>
|
|
|
|
|
|
</aside>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|