"use client"; import { useEffect, useRef } from "react"; import { ArticleView } from "./ArticleView"; import { Breadcrumbs } from "./Breadcrumbs"; import type { Puzzle } from "../../lib/types"; type SoloPhase = "setup" | "playing" | "won"; type SoloScreenProps = { phase: SoloPhase; puzzle: Puzzle | null; html: string; title: string; loading: boolean; loadError: string | null; history: string[]; clicks: number; elapsedDisplay: string; canGoBack: boolean; onStart: () => void; onNavigate: (title: string) => void; onBack: () => void; onQuit: () => void; onNewGame: () => void; onRetry: () => void; }; export function SoloScreen({ phase, puzzle, html, title, loading, loadError, history, clicks, elapsedDisplay, canGoBack, onStart, onNavigate, onBack, onQuit, onNewGame, onRetry, }: SoloScreenProps) { const breadcrumbEndRef = useRef(null); useEffect(() => { breadcrumbEndRef.current?.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "end" }); }, [history]); if (phase === "setup") return (

Mode Solo

Deux articles aléatoires seront choisis. Atteins l'article cible en cliquant uniquement sur les liens !

); if (phase === "won") return (
🎉

Article atteint !

{clicks} clics
{elapsedDisplay} temps
{history.map((t, i) => ( {i > 0 && } {t} ))}
); // playing return (
{/* Article */}
{title &&

{title}

} {loading && (
Chargement...
)} {loadError && (

{loadError}

)} {!loading && !loadError && html && ( )}
{/* Bottom bar */}
Vous devez trouver {puzzle?.target}
Temps {elapsedDisplay}
Clics {clicks}
{canGoBack && ( )}
); }