"use client"; import { useEffect, useRef } from "react"; import { ArticleView } from "./ArticleView"; import { Breadcrumbs } from "./Breadcrumbs"; import { ShareBar } from "./ShareBar"; import { useSearchAllowed } from "../../lib/useSearchAllowed"; 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); const { allowed: searchAllowed, toggle: toggleSearch } = useSearchAllowed(); useEffect(() => { breadcrumbEndRef.current?.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "end", }); }, [history]); const btnPrimary = "w-full min-h-11 rounded-xl text-sm font-semibold bg-[#7c3aed] text-white hover:bg-[#6d28d9] disabled:opacity-50 cursor-pointer transition-colors"; const btnGhost = "w-full min-h-11 rounded-xl text-sm font-semibold bg-[#242424] border border-[#2e2e2e] text-[#f0f0f0] hover:bg-[#1a1a1a] cursor-pointer transition-colors"; 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 (
{/* Topbar */}
{/* Cible centrée */}
{puzzle?.target}
{/* Breadcrumbs + stats */}
{elapsedDisplay} {clicks} clics
{canGoBack && ( )}
{/* Content */}
{title &&

{title}

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

{loadError}

)} {!loading && !loadError && html && ( )}
); }