"use client"; import Link from "next/link"; import { useEffect, useState } from "react"; import { GAME_META, GAMES, GameId, TOTAL_LEVELS } from "@/lib/levels"; function getLevelProgress(game: GameId): number { if (typeof window === "undefined") return 0; try { const raw = localStorage.getItem(`levels-${game}`); if (!raw) return 0; const data = JSON.parse(raw); return data.maxUnlocked ?? 0; } catch { return 0; } } function GameCard({ game }: { game: GameId }) { const meta = GAME_META[game]; const [progress, setProgress] = useState(0); useEffect(() => { setProgress(getLevelProgress(game)); }, [game]); const pct = Math.round((progress / TOTAL_LEVELS) * 100); return (
{meta.name}
{meta.subtitle}
{progress}
/ {TOTAL_LEVELS}
{meta.duration}
{pct}% complété
100 niveaux par jeu, du facile à l'expert
Résous les niveaux du quotidien pour débloquer les suivants