31 lines
1.2 KiB
TypeScript
31 lines
1.2 KiB
TypeScript
"use client";
|
|
|
|
import { useState, useEffect } from "react";
|
|
import { useParams } from "next/navigation";
|
|
import { generatePatches, PatchesPuzzle } from "@/lib/generators/patches";
|
|
import PatchesBoard from "@/components/PatchesBoard";
|
|
import Link from "next/link";
|
|
|
|
export default function PatchesDatePage() {
|
|
const { date } = useParams<{ date: string }>();
|
|
const [puzzle, setPuzzle] = useState<PatchesPuzzle | null>(null);
|
|
useEffect(() => { setPuzzle(generatePatches(date)); }, [date]);
|
|
|
|
return (
|
|
<div className="flex flex-col items-center gap-8">
|
|
<div className="text-center">
|
|
<h1 className="text-2xl font-bold text-gray-900 tracking-tight">Patches</h1>
|
|
<p className="text-sm text-gray-400 mt-1">{date}</p>
|
|
</div>
|
|
{puzzle ? (
|
|
<PatchesBoard key={date} puzzle={puzzle} date={date} />
|
|
) : (
|
|
<div className="py-20 text-gray-300 text-sm">Chargement…</div>
|
|
)}
|
|
<div className="flex gap-4 text-sm">
|
|
<Link href="/patches" className="text-gray-500 hover:text-gray-900 transition-colors">← Aujourd'hui</Link>
|
|
<Link href="/archive?game=patches" className="text-gray-400 hover:text-gray-700 transition-colors">Archives</Link>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|