Add a "phasingOut" minigame status and an `estimatedRemovalDate` field so a game can be announced as leaving soon while staying fully playable and keeping scoring periods (unlike retired games). Visibility is the only difference: - Sidebar badge + tooltip (amber "Phasing out", countdown to removal) in NavMinigames, via new phasingOutTooltip in countdown.ts. - In-game banner (PhasingOutBanner) on all 9 game pages, wired from getMinigameReleaseState (added the fetch to call-for-fire, which lacked it). - registry.ts status union + field; loadRegistry.ts maps the field; config status select + estimatedRemovalDate date field added. - Migration adds the enum value and column (idempotent); types + db schema regenerated. Adds tests for visibility, round-trip, and period scoring; updates the minigames domain guide.
46 lines
1.5 KiB
TypeScript
46 lines
1.5 KiB
TypeScript
"use client";
|
|
|
|
import { AlarmClockIcon } from "lucide-react";
|
|
|
|
import { useNow } from "@/hooks/useNow";
|
|
import { formatCountdown, formatReleaseInstant } from "@/lib/minigames/countdown";
|
|
import { cn } from "@/lib/utils";
|
|
|
|
interface PhasingOutBannerProps {
|
|
readonly estimatedRemovalDate?: string | null;
|
|
}
|
|
|
|
/**
|
|
* In-game notice for a minigame whose registry status is "phasingOut". The game
|
|
* stays fully playable and keeps scoring periods until it is removed; this just
|
|
* tells operators when it is leaving. Display only.
|
|
*/
|
|
export function PhasingOutBanner({ estimatedRemovalDate }: PhasingOutBannerProps) {
|
|
const now = useNow();
|
|
const instant = formatReleaseInstant(estimatedRemovalDate ?? null);
|
|
const countdown = formatCountdown(estimatedRemovalDate ?? null, new Date(now));
|
|
|
|
return (
|
|
<div
|
|
role="note"
|
|
aria-label="This minigame is being phased out"
|
|
className={cn(
|
|
"flex items-center gap-3 rounded-lg border px-4 py-3 text-sm",
|
|
"border-amber-500/30 bg-amber-500/10 text-amber-100",
|
|
)}
|
|
>
|
|
<AlarmClockIcon className="size-5 shrink-0 text-amber-400" />
|
|
<p className="min-w-0">
|
|
<span className="font-semibold">This game is being phased out.</span>{" "}
|
|
{instant ? (
|
|
<>
|
|
Leaving <span className="font-medium">{instant}</span>
|
|
{countdown ? ` (in ${countdown})` : "."}
|
|
</>
|
|
) : (
|
|
"No removal date has been set yet."
|
|
)}
|
|
</p>
|
|
</div>
|
|
);
|
|
}
|