import Image from "next/image"; import { MAX_ATTEMPTS, getPuzzleNumber } from "@/lib/game-engine"; import { getDictionary, type Dictionary } from "@/lib/i18n"; import { formatElapsed } from "@/lib/time"; type HeaderProps = { attemptsUsed: number; dateKey: string; elapsedSeconds: number; solved: boolean; t?: Dictionary; }; function attemptColor(remaining: number, solved: boolean) { if (solved) return "bg-emerald-300 text-pitch-950 shadow-emerald-300/25"; if (remaining <= 1) return "bg-red-400 text-white shadow-red-400/25"; if (remaining <= 2) return "bg-orange-400 text-pitch-950 shadow-orange-400/25"; if (remaining <= 3) return "bg-yellow-300 text-pitch-950 shadow-yellow-300/25"; return "bg-emerald-400 text-pitch-950 shadow-emerald-400/25"; } export default function Header({ attemptsUsed, dateKey, elapsedSeconds, solved, t: dictionary }: HeaderProps) { const remaining = Math.max(0, MAX_ATTEMPTS - attemptsUsed); const t = dictionary ?? getDictionary("en"); return (

{t.puzzle}

#{getPuzzleNumber(dateKey)}

hidden11

hidden11

{t.dailySubtitle}

{t.time}

{formatElapsed(elapsedSeconds)}

{solved ? "✓" : remaining} {t.tries}
); }