"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; }; function fmt(s: number): string { const m = Math.floor(s / 60); const sec = Math.floor(s % 60); return `${m}:${String(sec).padStart(2, "0")}`; } 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]); return (
{phase === "setup" && (

Mode Solo

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

)} {phase === "playing" && ( <>
{title &&

{title}

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

{loadError}

)} {!loading && !loadError && html && ( )}
VOUS DEVEZ TROUVER {puzzle?.target}
TEMPS {elapsedDisplay}
CLICS {clicks}
{canGoBack && ( )}
)} {phase === "won" && (
Bravo !

Article atteint !

{clicks} clics
{elapsedDisplay} temps
{history.map((t, i) => ( {i > 0 && } {t} ))}
)}
); }