feat(minigames): add phasing-out status with estimated removal date
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.
This commit is contained in:
parent
43397f16cb
commit
33f3f7aa75
23 changed files with 443 additions and 5 deletions
|
|
@ -4,6 +4,7 @@ import { getPayload } from "payload";
|
||||||
import { headers as nextHeaders } from "next/headers";
|
import { headers as nextHeaders } from "next/headers";
|
||||||
import { redirect } from "next/navigation";
|
import { redirect } from "next/navigation";
|
||||||
import { MinigameComingSoon } from "@/components/frontend/minigames/MinigameComingSoon";
|
import { MinigameComingSoon } from "@/components/frontend/minigames/MinigameComingSoon";
|
||||||
|
import { PhasingOutBanner } from "@/components/frontend/minigames/PhasingOutBanner";
|
||||||
import { getMinigameReleaseState } from "@/lib/minigames/loadRegistry";
|
import { getMinigameReleaseState } from "@/lib/minigames/loadRegistry";
|
||||||
import { Club } from "lucide-react";
|
import { Club } from "lucide-react";
|
||||||
import { BlackjackArena } from "@/components/frontend/minigames/blackjack/BlackjackArena";
|
import { BlackjackArena } from "@/components/frontend/minigames/blackjack/BlackjackArena";
|
||||||
|
|
@ -66,6 +67,9 @@ export default async function BlackjackPage({ searchParams }: BlackjackPageProps
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col gap-6 p-5">
|
<div className="flex flex-col gap-6 p-5">
|
||||||
|
{release.game?.status === "phasingOut" && (
|
||||||
|
<PhasingOutBanner estimatedRemovalDate={release.game.estimatedRemovalDate} />
|
||||||
|
)}
|
||||||
<div className="flex flex-col gap-1">
|
<div className="flex flex-col gap-1">
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<Club className="size-5 text-muted-foreground" />
|
<Club className="size-5 text-muted-foreground" />
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import { headers as nextHeaders } from "next/headers";
|
||||||
import { redirect } from "next/navigation";
|
import { redirect } from "next/navigation";
|
||||||
import { Swords } from "lucide-react";
|
import { Swords } from "lucide-react";
|
||||||
import { MinigameComingSoon } from "@/components/frontend/minigames/MinigameComingSoon";
|
import { MinigameComingSoon } from "@/components/frontend/minigames/MinigameComingSoon";
|
||||||
|
import { PhasingOutBanner } from "@/components/frontend/minigames/PhasingOutBanner";
|
||||||
import { getMinigameReleaseState } from "@/lib/minigames/loadRegistry";
|
import { getMinigameReleaseState } from "@/lib/minigames/loadRegistry";
|
||||||
import { CallForFireVersusArena } from "@/components/frontend/minigames/call-for-fire-versus/CallForFireVersusArena";
|
import { CallForFireVersusArena } from "@/components/frontend/minigames/call-for-fire-versus/CallForFireVersusArena";
|
||||||
|
|
||||||
|
|
@ -62,6 +63,9 @@ export default async function CallForFireVersusPage({ searchParams }: VersusPage
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex min-w-0 flex-col gap-6 p-5">
|
<div className="flex min-w-0 flex-col gap-6 p-5">
|
||||||
|
{release.game?.status === "phasingOut" && (
|
||||||
|
<PhasingOutBanner estimatedRemovalDate={release.game.estimatedRemovalDate} />
|
||||||
|
)}
|
||||||
<div className="flex flex-col gap-1">
|
<div className="flex flex-col gap-1">
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<Swords className="size-5 text-muted-foreground" />
|
<Swords className="size-5 text-muted-foreground" />
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@ import { redirect } from "next/navigation";
|
||||||
import { Target } from "lucide-react";
|
import { Target } from "lucide-react";
|
||||||
import { CallForFireArena } from "@/components/frontend/minigames/call-for-fire/CallForFireArena";
|
import { CallForFireArena } from "@/components/frontend/minigames/call-for-fire/CallForFireArena";
|
||||||
import { PeriodStandingsCard } from "@/components/frontend/minigames/PeriodStandingsCard";
|
import { PeriodStandingsCard } from "@/components/frontend/minigames/PeriodStandingsCard";
|
||||||
|
import { PhasingOutBanner } from "@/components/frontend/minigames/PhasingOutBanner";
|
||||||
|
import { getMinigameReleaseState } from "@/lib/minigames/loadRegistry";
|
||||||
|
|
||||||
export const metadata: Metadata = {
|
export const metadata: Metadata = {
|
||||||
title: "Call for Fire (Polaris Task Force)",
|
title: "Call for Fire (Polaris Task Force)",
|
||||||
|
|
@ -22,6 +24,8 @@ export default async function CallForFirePage() {
|
||||||
redirect(`/login?returnTo=${encodeURIComponent("/minigames/call-for-fire")}`);
|
redirect(`/login?returnTo=${encodeURIComponent("/minigames/call-for-fire")}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const release = await getMinigameReleaseState(payload, "callForFire");
|
||||||
|
|
||||||
const profileRes = await payload.find({
|
const profileRes = await payload.find({
|
||||||
collection: "profiles",
|
collection: "profiles",
|
||||||
where: { user: { equals: user.id as number } },
|
where: { user: { equals: user.id as number } },
|
||||||
|
|
@ -50,6 +54,9 @@ export default async function CallForFirePage() {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex min-w-0 flex-col gap-6 p-5">
|
<div className="flex min-w-0 flex-col gap-6 p-5">
|
||||||
|
{release.game?.status === "phasingOut" && (
|
||||||
|
<PhasingOutBanner estimatedRemovalDate={release.game.estimatedRemovalDate} />
|
||||||
|
)}
|
||||||
<div className="flex flex-col gap-1">
|
<div className="flex flex-col gap-1">
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<Target className="size-5 text-muted-foreground" />
|
<Target className="size-5 text-muted-foreground" />
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import { getPayload } from "payload";
|
||||||
import { headers as nextHeaders } from "next/headers";
|
import { headers as nextHeaders } from "next/headers";
|
||||||
import { redirect } from "next/navigation";
|
import { redirect } from "next/navigation";
|
||||||
import { MinigameComingSoon } from "@/components/frontend/minigames/MinigameComingSoon";
|
import { MinigameComingSoon } from "@/components/frontend/minigames/MinigameComingSoon";
|
||||||
|
import { PhasingOutBanner } from "@/components/frontend/minigames/PhasingOutBanner";
|
||||||
import { getMinigameReleaseState } from "@/lib/minigames/loadRegistry";
|
import { getMinigameReleaseState } from "@/lib/minigames/loadRegistry";
|
||||||
import { Bomb } from "lucide-react";
|
import { Bomb } from "lucide-react";
|
||||||
import { EodArena } from "@/components/frontend/minigames/eod/EodArena";
|
import { EodArena } from "@/components/frontend/minigames/eod/EodArena";
|
||||||
|
|
@ -57,6 +58,9 @@ export default async function EodPage() {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex min-w-0 flex-col gap-6 p-5">
|
<div className="flex min-w-0 flex-col gap-6 p-5">
|
||||||
|
{release.game?.status === "phasingOut" && (
|
||||||
|
<PhasingOutBanner estimatedRemovalDate={release.game.estimatedRemovalDate} />
|
||||||
|
)}
|
||||||
<div className="flex flex-col gap-1">
|
<div className="flex flex-col gap-1">
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<Bomb className="size-5 text-muted-foreground" />
|
<Bomb className="size-5 text-muted-foreground" />
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import { getPayload } from "payload";
|
||||||
import { headers as nextHeaders } from "next/headers";
|
import { headers as nextHeaders } from "next/headers";
|
||||||
import { redirect } from "next/navigation";
|
import { redirect } from "next/navigation";
|
||||||
import { MinigameComingSoon } from "@/components/frontend/minigames/MinigameComingSoon";
|
import { MinigameComingSoon } from "@/components/frontend/minigames/MinigameComingSoon";
|
||||||
|
import { PhasingOutBanner } from "@/components/frontend/minigames/PhasingOutBanner";
|
||||||
import { getMinigameReleaseState } from "@/lib/minigames/loadRegistry";
|
import { getMinigameReleaseState } from "@/lib/minigames/loadRegistry";
|
||||||
import { Bird } from "lucide-react";
|
import { Bird } from "lucide-react";
|
||||||
import { FlappyArena } from "@/components/frontend/minigames/flappy/FlappyArena";
|
import { FlappyArena } from "@/components/frontend/minigames/flappy/FlappyArena";
|
||||||
|
|
@ -54,6 +55,9 @@ export default async function FlappyPage() {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="p-5 flex flex-col gap-6">
|
<div className="p-5 flex flex-col gap-6">
|
||||||
|
{release.game?.status === "phasingOut" && (
|
||||||
|
<PhasingOutBanner estimatedRemovalDate={release.game.estimatedRemovalDate} />
|
||||||
|
)}
|
||||||
<div className="flex flex-col gap-1">
|
<div className="flex flex-col gap-1">
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<Bird className="size-5 text-muted-foreground" />
|
<Bird className="size-5 text-muted-foreground" />
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import { getPayload } from "payload";
|
||||||
import { headers as nextHeaders } from "next/headers";
|
import { headers as nextHeaders } from "next/headers";
|
||||||
import { redirect } from "next/navigation";
|
import { redirect } from "next/navigation";
|
||||||
import { MinigameComingSoon } from "@/components/frontend/minigames/MinigameComingSoon";
|
import { MinigameComingSoon } from "@/components/frontend/minigames/MinigameComingSoon";
|
||||||
|
import { PhasingOutBanner } from "@/components/frontend/minigames/PhasingOutBanner";
|
||||||
import { getMinigameReleaseState } from "@/lib/minigames/loadRegistry";
|
import { getMinigameReleaseState } from "@/lib/minigames/loadRegistry";
|
||||||
import { ScrollText } from "lucide-react";
|
import { ScrollText } from "lucide-react";
|
||||||
import { OpordArena } from "@/components/frontend/minigames/opord/OpordArena";
|
import { OpordArena } from "@/components/frontend/minigames/opord/OpordArena";
|
||||||
|
|
@ -58,6 +59,9 @@ export default async function OpordPage() {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex min-w-0 flex-col gap-6 p-5">
|
<div className="flex min-w-0 flex-col gap-6 p-5">
|
||||||
|
{release.game?.status === "phasingOut" && (
|
||||||
|
<PhasingOutBanner estimatedRemovalDate={release.game.estimatedRemovalDate} />
|
||||||
|
)}
|
||||||
<div className="flex flex-col gap-1">
|
<div className="flex flex-col gap-1">
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<ScrollText className="size-5 text-muted-foreground" />
|
<ScrollText className="size-5 text-muted-foreground" />
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import { getPayload } from "payload";
|
||||||
import { headers as nextHeaders } from "next/headers";
|
import { headers as nextHeaders } from "next/headers";
|
||||||
import { redirect } from "next/navigation";
|
import { redirect } from "next/navigation";
|
||||||
import { MinigameComingSoon } from "@/components/frontend/minigames/MinigameComingSoon";
|
import { MinigameComingSoon } from "@/components/frontend/minigames/MinigameComingSoon";
|
||||||
|
import { PhasingOutBanner } from "@/components/frontend/minigames/PhasingOutBanner";
|
||||||
import { getMinigameReleaseState } from "@/lib/minigames/loadRegistry";
|
import { getMinigameReleaseState } from "@/lib/minigames/loadRegistry";
|
||||||
import { Spade } from "lucide-react";
|
import { Spade } from "lucide-react";
|
||||||
import { PokerArena } from "@/components/frontend/minigames/poker/PokerArena";
|
import { PokerArena } from "@/components/frontend/minigames/poker/PokerArena";
|
||||||
|
|
@ -66,6 +67,9 @@ export default async function PokerPage({ searchParams }: PokerPageProps) {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col gap-6 p-5">
|
<div className="flex flex-col gap-6 p-5">
|
||||||
|
{release.game?.status === "phasingOut" && (
|
||||||
|
<PhasingOutBanner estimatedRemovalDate={release.game.estimatedRemovalDate} />
|
||||||
|
)}
|
||||||
<div className="flex flex-col gap-1">
|
<div className="flex flex-col gap-1">
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<Spade className="size-5 text-muted-foreground" />
|
<Spade className="size-5 text-muted-foreground" />
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import { getPayload } from "payload";
|
||||||
import { headers as nextHeaders } from "next/headers";
|
import { headers as nextHeaders } from "next/headers";
|
||||||
import { redirect } from "next/navigation";
|
import { redirect } from "next/navigation";
|
||||||
import { MinigameComingSoon } from "@/components/frontend/minigames/MinigameComingSoon";
|
import { MinigameComingSoon } from "@/components/frontend/minigames/MinigameComingSoon";
|
||||||
|
import { PhasingOutBanner } from "@/components/frontend/minigames/PhasingOutBanner";
|
||||||
import { getMinigameReleaseState } from "@/lib/minigames/loadRegistry";
|
import { getMinigameReleaseState } from "@/lib/minigames/loadRegistry";
|
||||||
import { Crosshair } from "lucide-react";
|
import { Crosshair } from "lucide-react";
|
||||||
|
|
||||||
|
|
@ -62,6 +63,9 @@ export default async function QualificationPage() {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex min-w-0 flex-col gap-6 p-5">
|
<div className="flex min-w-0 flex-col gap-6 p-5">
|
||||||
|
{release.game?.status === "phasingOut" && (
|
||||||
|
<PhasingOutBanner estimatedRemovalDate={release.game.estimatedRemovalDate} />
|
||||||
|
)}
|
||||||
<div className="flex flex-col gap-1">
|
<div className="flex flex-col gap-1">
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<Crosshair className="size-5 text-muted-foreground" />
|
<Crosshair className="size-5 text-muted-foreground" />
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import { getPayload } from "payload";
|
||||||
import { headers as nextHeaders } from "next/headers";
|
import { headers as nextHeaders } from "next/headers";
|
||||||
import { redirect } from "next/navigation";
|
import { redirect } from "next/navigation";
|
||||||
import { MinigameComingSoon } from "@/components/frontend/minigames/MinigameComingSoon";
|
import { MinigameComingSoon } from "@/components/frontend/minigames/MinigameComingSoon";
|
||||||
|
import { PhasingOutBanner } from "@/components/frontend/minigames/PhasingOutBanner";
|
||||||
import { getMinigameReleaseState } from "@/lib/minigames/loadRegistry";
|
import { getMinigameReleaseState } from "@/lib/minigames/loadRegistry";
|
||||||
import { Radio } from "lucide-react";
|
import { Radio } from "lucide-react";
|
||||||
import { RadioArena } from "@/components/frontend/minigames/radio/RadioArena";
|
import { RadioArena } from "@/components/frontend/minigames/radio/RadioArena";
|
||||||
|
|
@ -66,6 +67,9 @@ export default async function RadioPage() {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex min-w-0 flex-col gap-6 p-5">
|
<div className="flex min-w-0 flex-col gap-6 p-5">
|
||||||
|
{release.game?.status === "phasingOut" && (
|
||||||
|
<PhasingOutBanner estimatedRemovalDate={release.game.estimatedRemovalDate} />
|
||||||
|
)}
|
||||||
<div className="flex flex-col gap-1">
|
<div className="flex flex-col gap-1">
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<Radio className="size-5 text-muted-foreground" />
|
<Radio className="size-5 text-muted-foreground" />
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,7 @@ export const Minigames: CollectionConfig = {
|
||||||
{ label: "Active", value: "active" },
|
{ label: "Active", value: "active" },
|
||||||
{ label: "Upcoming", value: "upcoming" },
|
{ label: "Upcoming", value: "upcoming" },
|
||||||
{ label: "Retired", value: "retired" },
|
{ label: "Retired", value: "retired" },
|
||||||
|
{ label: "Phasing out", value: "phasingOut" },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -83,6 +84,15 @@ export const Minigames: CollectionConfig = {
|
||||||
"Optional target for an upcoming game. Shown as a countdown in the sidebar and on the game page. Display only: the game goes live when status changes to Active.",
|
"Optional target for an upcoming game. Shown as a countdown in the sidebar and on the game page. Display only: the game goes live when status changes to Active.",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "estimatedRemovalDate",
|
||||||
|
type: "date",
|
||||||
|
admin: {
|
||||||
|
date: { pickerAppearance: "dayAndTime" },
|
||||||
|
description:
|
||||||
|
"Optional target for a phasing-out game. Shown as a countdown in the sidebar and on the game page so operators know when it leaves. Display only: the game stays playable until status changes to Retired.",
|
||||||
|
},
|
||||||
|
},
|
||||||
{ name: "order", type: "number", required: true, defaultValue: 0 },
|
{ name: "order", type: "number", required: true, defaultValue: 0 },
|
||||||
{
|
{
|
||||||
name: "countsForPeriods",
|
name: "countsForPeriods",
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import Link from "next/link";
|
||||||
|
|
||||||
import { minigameIcon } from "@/components/frontend/minigames/minigameIcon";
|
import { minigameIcon } from "@/components/frontend/minigames/minigameIcon";
|
||||||
import { UpcomingCountdown } from "@/components/frontend/minigames/UpcomingCountdown";
|
import { UpcomingCountdown } from "@/components/frontend/minigames/UpcomingCountdown";
|
||||||
|
import { phasingOutTooltip } from "@/lib/minigames/countdown";
|
||||||
import type { RegistryGame } from "@/lib/minigames/registry";
|
import type { RegistryGame } from "@/lib/minigames/registry";
|
||||||
import {
|
import {
|
||||||
DropdownMenu,
|
DropdownMenu,
|
||||||
|
|
@ -31,6 +32,8 @@ import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip
|
||||||
* links: they render as a plain hoverable row rather than a disabled
|
* links: they render as a plain hoverable row rather than a disabled
|
||||||
* `DropdownMenuItem`, because that item sets `pointer-events: none` when
|
* `DropdownMenuItem`, because that item sets `pointer-events: none` when
|
||||||
* disabled, which would suppress the hover that reveals the tooltip.
|
* disabled, which would suppress the hover that reveals the tooltip.
|
||||||
|
* `phasingOut` games stay clickable but carry an amber "Phasing out" badge and a
|
||||||
|
* tooltip showing the optional `estimatedRemovalDate`.
|
||||||
*/
|
*/
|
||||||
export function NavMinigames({ games }: { games: RegistryGame[] }) {
|
export function NavMinigames({ games }: { games: RegistryGame[] }) {
|
||||||
const { isMobile } = useSidebar();
|
const { isMobile } = useSidebar();
|
||||||
|
|
@ -65,6 +68,27 @@ export function NavMinigames({ games }: { games: RegistryGame[] }) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (game.status === "phasingOut") {
|
||||||
|
return (
|
||||||
|
<Tooltip key={game.key}>
|
||||||
|
<TooltipTrigger asChild>
|
||||||
|
<DropdownMenuItem asChild>
|
||||||
|
<Link href={game.route}>
|
||||||
|
<Icon />
|
||||||
|
<span className="truncate">{game.label}</span>
|
||||||
|
<span className="ml-auto shrink-0 text-[10px] font-normal uppercase tracking-wide text-amber-400">
|
||||||
|
Phasing out
|
||||||
|
</span>
|
||||||
|
</Link>
|
||||||
|
</DropdownMenuItem>
|
||||||
|
</TooltipTrigger>
|
||||||
|
<TooltipContent side={isMobile ? "bottom" : "right"}>
|
||||||
|
<span>{phasingOutTooltip(game.estimatedRemovalDate)}</span>
|
||||||
|
</TooltipContent>
|
||||||
|
</Tooltip>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DropdownMenuItem key={game.key} asChild>
|
<DropdownMenuItem key={game.key} asChild>
|
||||||
<Link href={game.route}>
|
<Link href={game.route}>
|
||||||
|
|
|
||||||
46
src/components/frontend/minigames/PhasingOutBanner.tsx
Normal file
46
src/components/frontend/minigames/PhasingOutBanner.tsx
Normal file
|
|
@ -0,0 +1,46 @@
|
||||||
|
"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>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -58,3 +58,4 @@ code; the invariants are:
|
||||||
leaderboards, and their page renders `MinigameComingSoon` instead of the arena. The date is
|
leaderboards, and their page renders `MinigameComingSoon` instead of the arena. The date is
|
||||||
display only: the game goes live when an admin flips `status` to active. Countdown formatting:
|
display only: the game goes live when an admin flips `status` to active. Countdown formatting:
|
||||||
`src/lib/minigames/countdown.ts`; page gate: `getMinigameReleaseState` plus a per-page check.
|
`src/lib/minigames/countdown.ts`; page gate: `getMinigameReleaseState` plus a per-page check.
|
||||||
|
- **Phasing-out games**: a registry row with `status: "phasingOut"` stays fully playable and keeps scoring periods until it is removed. It shows an amber "Phasing out" badge in the sidebar (tooltip over the optional `estimatedRemovalDate`, via `phasingOutTooltip`) and a banner (`PhasingOutBanner`) on its game page, both rendering the countdown to removal. Unlike `retired` games, phasing-out games stay visible in the nav (`visibleRegistryGames` does not filter them) and on the leaderboards (`buildLeaderboardPayload` only excludes `upcoming`). The date is display only: the game keeps playing until an admin flips `status` to `retired`.
|
||||||
|
|
|
||||||
|
|
@ -68,3 +68,20 @@ export function upcomingTooltip(
|
||||||
const countdown = formatCountdown(estimatedReleaseDate, now);
|
const countdown = formatCountdown(estimatedReleaseDate, now);
|
||||||
return countdown ? `Upcoming · releases ${instant} (${countdown})` : `Upcoming · releases ${instant}`;
|
return countdown ? `Upcoming · releases ${instant} (${countdown})` : `Upcoming · releases ${instant}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Full tooltip line for a phasing-out game, e.g.
|
||||||
|
* "Phasing out · leaves Dec 3, 2026 18:00 UTC (in 12d 3h)". Reduces to just
|
||||||
|
* "Phasing out" when no estimate is set.
|
||||||
|
*/
|
||||||
|
export function phasingOutTooltip(
|
||||||
|
estimatedRemovalDate: string | null | undefined,
|
||||||
|
now: Date = new Date(),
|
||||||
|
): string {
|
||||||
|
const instant = formatReleaseInstant(estimatedRemovalDate);
|
||||||
|
if (!instant) return "Phasing out";
|
||||||
|
const countdown = formatCountdown(estimatedRemovalDate, now);
|
||||||
|
return countdown
|
||||||
|
? `Phasing out · leaves ${instant} (${countdown})`
|
||||||
|
: `Phasing out · leaves ${instant}`;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@ export async function loadMinigameRegistry(payload: Payload): Promise<BuiltinMin
|
||||||
countsForPeriods: Boolean(doc.countsForPeriods),
|
countsForPeriods: Boolean(doc.countsForPeriods),
|
||||||
scoreLabel: doc.scoreLabel || "Score",
|
scoreLabel: doc.scoreLabel || "Score",
|
||||||
estimatedReleaseDate: doc.estimatedReleaseDate ?? null,
|
estimatedReleaseDate: doc.estimatedReleaseDate ?? null,
|
||||||
|
estimatedRemovalDate: doc.estimatedRemovalDate ?? null,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
if (rows.length > 0) return rows;
|
if (rows.length > 0) return rows;
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export type MinigameCategory = "core" | "cardtable" | "multiplayer";
|
export type MinigameCategory = "core" | "cardtable" | "multiplayer";
|
||||||
export type MinigameStatus = "active" | "retired" | "upcoming";
|
export type MinigameStatus = "active" | "retired" | "upcoming" | "phasingOut";
|
||||||
|
|
||||||
/** The six period-scoring games. Poker and Blackjack stay out of periods. */
|
/** The six period-scoring games. Poker and Blackjack stay out of periods. */
|
||||||
export const CORE_MINIGAME_KEYS = [
|
export const CORE_MINIGAME_KEYS = [
|
||||||
|
|
@ -50,6 +50,12 @@ export interface BuiltinMinigame {
|
||||||
* changes `status` to "active", so a slipped estimate never exposes it.
|
* changes `status` to "active", so a slipped estimate never exposes it.
|
||||||
*/
|
*/
|
||||||
estimatedReleaseDate?: string | null;
|
estimatedReleaseDate?: string | null;
|
||||||
|
/**
|
||||||
|
* Optional target removal instant (ISO 8601, UTC) shown as a countdown while
|
||||||
|
* `status` is "phasingOut". Display only: the game stays fully playable and
|
||||||
|
* keeps scoring periods until an admin sets `status` to "retired".
|
||||||
|
*/
|
||||||
|
estimatedRemovalDate?: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The seven built-in games, seeded into the `minigames` registry collection. */
|
/** The seven built-in games, seeded into the `minigames` registry collection. */
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
import { MigrateUpArgs, MigrateDownArgs, sql } from "@payloadcms/db-postgres";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds `phasingOut` to the minigames status enum and the
|
||||||
|
* `estimated_removal_date` column so a game can be marked as leaving soon while
|
||||||
|
* staying playable. Follows the precedent of 20261011_221250 (column) and
|
||||||
|
* 20261014_135614 (enum value): idempotent via IF NOT EXISTS, safe to re-run.
|
||||||
|
*/
|
||||||
|
export async function up({ db }: MigrateUpArgs): Promise<void> {
|
||||||
|
await db.execute(sql`
|
||||||
|
ALTER TYPE "public"."enum_minigames_status" ADD VALUE IF NOT EXISTS 'phasingOut';
|
||||||
|
`);
|
||||||
|
await db.execute(sql`
|
||||||
|
ALTER TABLE "minigames" ADD COLUMN "estimated_removal_date" timestamp(3) with time zone;
|
||||||
|
`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Postgres cannot remove values from an enum type; down drops the column only.
|
||||||
|
export async function down({ db }: MigrateDownArgs): Promise<void> {
|
||||||
|
await db.execute(sql`
|
||||||
|
ALTER TABLE "minigames" DROP COLUMN "estimated_removal_date";
|
||||||
|
`);
|
||||||
|
}
|
||||||
|
|
@ -136,6 +136,7 @@ import * as migration_20261013_183041_add_journal_contribution_type from './2026
|
||||||
import * as migration_20261013_184745_add_garage_fields from './20261013_184745_add_garage_fields';
|
import * as migration_20261013_184745_add_garage_fields from './20261013_184745_add_garage_fields';
|
||||||
import * as migration_20261014_134620_add_analytics_tables from './20261014_134620_add_analytics_tables';
|
import * as migration_20261014_134620_add_analytics_tables from './20261014_134620_add_analytics_tables';
|
||||||
import * as migration_20261014_135614_add_analytics_permission_enum_value from './20261014_135614_add_analytics_permission_enum_value';
|
import * as migration_20261014_135614_add_analytics_permission_enum_value from './20261014_135614_add_analytics_permission_enum_value';
|
||||||
|
import * as migration_20261014_140500_add_minigame_phasing_out_status from './20261014_140500_add_minigame_phasing_out_status';
|
||||||
|
|
||||||
export const migrations = [
|
export const migrations = [
|
||||||
{
|
{
|
||||||
|
|
@ -828,4 +829,9 @@ export const migrations = [
|
||||||
down: migration_20261014_135614_add_analytics_permission_enum_value.down,
|
down: migration_20261014_135614_add_analytics_permission_enum_value.down,
|
||||||
name: '20261014_135614_add_analytics_permission_enum_value'
|
name: '20261014_135614_add_analytics_permission_enum_value'
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
up: migration_20261014_140500_add_minigame_phasing_out_status.up,
|
||||||
|
down: migration_20261014_140500_add_minigame_phasing_out_status.down,
|
||||||
|
name: '20261014_140500_add_minigame_phasing_out_status'
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -130,6 +130,16 @@ export const enum_game_event_logs_required_permissions = pgEnum(
|
||||||
"awards:update",
|
"awards:update",
|
||||||
"awards:delete",
|
"awards:delete",
|
||||||
"admin:awards:manage",
|
"admin:awards:manage",
|
||||||
|
"journals:create",
|
||||||
|
"journals:read",
|
||||||
|
"journals:update",
|
||||||
|
"journals:delete",
|
||||||
|
"admin:journals:manage",
|
||||||
|
"award-rules:create",
|
||||||
|
"award-rules:read",
|
||||||
|
"award-rules:update",
|
||||||
|
"award-rules:delete",
|
||||||
|
"admin:award-rules:manage",
|
||||||
"qualifications:create",
|
"qualifications:create",
|
||||||
"qualifications:read",
|
"qualifications:read",
|
||||||
"qualifications:update",
|
"qualifications:update",
|
||||||
|
|
@ -444,6 +454,8 @@ export const enum_game_event_logs_required_permissions = pgEnum(
|
||||||
"tickets:staff",
|
"tickets:staff",
|
||||||
"discord:staff",
|
"discord:staff",
|
||||||
"discord:announce",
|
"discord:announce",
|
||||||
|
"discord:rp:read",
|
||||||
|
"discord:rp:update",
|
||||||
"custom-minefields:update",
|
"custom-minefields:update",
|
||||||
"custom-minefields:delete",
|
"custom-minefields:delete",
|
||||||
"custom-minefield-scores:delete",
|
"custom-minefield-scores:delete",
|
||||||
|
|
@ -471,6 +483,7 @@ export const enum_game_event_logs_required_permissions = pgEnum(
|
||||||
"achievements:update",
|
"achievements:update",
|
||||||
"achievements:delete",
|
"achievements:delete",
|
||||||
"admin:achievements:manage",
|
"admin:achievements:manage",
|
||||||
|
"admin:analytics:manage",
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
export const enum_game_event_logs_visibility = pgEnum("enum_game_event_logs_visibility", [
|
export const enum_game_event_logs_visibility = pgEnum("enum_game_event_logs_visibility", [
|
||||||
|
|
@ -516,6 +529,8 @@ export const enum_game_event_logs_target_collection = pgEnum(
|
||||||
"voice-scripts",
|
"voice-scripts",
|
||||||
"voice-submissions",
|
"voice-submissions",
|
||||||
"story-beats",
|
"story-beats",
|
||||||
|
"journals",
|
||||||
|
"awards",
|
||||||
"story-beat-states",
|
"story-beat-states",
|
||||||
"custom-minefields",
|
"custom-minefields",
|
||||||
"custom-minefield-scores",
|
"custom-minefield-scores",
|
||||||
|
|
@ -635,6 +650,16 @@ export const enum_roles_permissions = pgEnum("enum_roles_permissions", [
|
||||||
"awards:update",
|
"awards:update",
|
||||||
"awards:delete",
|
"awards:delete",
|
||||||
"admin:awards:manage",
|
"admin:awards:manage",
|
||||||
|
"journals:create",
|
||||||
|
"journals:read",
|
||||||
|
"journals:update",
|
||||||
|
"journals:delete",
|
||||||
|
"admin:journals:manage",
|
||||||
|
"award-rules:create",
|
||||||
|
"award-rules:read",
|
||||||
|
"award-rules:update",
|
||||||
|
"award-rules:delete",
|
||||||
|
"admin:award-rules:manage",
|
||||||
"qualifications:create",
|
"qualifications:create",
|
||||||
"qualifications:read",
|
"qualifications:read",
|
||||||
"qualifications:update",
|
"qualifications:update",
|
||||||
|
|
@ -949,6 +974,8 @@ export const enum_roles_permissions = pgEnum("enum_roles_permissions", [
|
||||||
"tickets:staff",
|
"tickets:staff",
|
||||||
"discord:staff",
|
"discord:staff",
|
||||||
"discord:announce",
|
"discord:announce",
|
||||||
|
"discord:rp:read",
|
||||||
|
"discord:rp:update",
|
||||||
"custom-minefields:update",
|
"custom-minefields:update",
|
||||||
"custom-minefields:delete",
|
"custom-minefields:delete",
|
||||||
"custom-minefield-scores:delete",
|
"custom-minefield-scores:delete",
|
||||||
|
|
@ -976,6 +1003,7 @@ export const enum_roles_permissions = pgEnum("enum_roles_permissions", [
|
||||||
"achievements:update",
|
"achievements:update",
|
||||||
"achievements:delete",
|
"achievements:delete",
|
||||||
"admin:achievements:manage",
|
"admin:achievements:manage",
|
||||||
|
"admin:analytics:manage",
|
||||||
]);
|
]);
|
||||||
export const enum_awards_grant_config_allowed_grantor_assignment_types = pgEnum(
|
export const enum_awards_grant_config_allowed_grantor_assignment_types = pgEnum(
|
||||||
"enum_awards_grant_config_allowed_grantor_assignment_types",
|
"enum_awards_grant_config_allowed_grantor_assignment_types",
|
||||||
|
|
@ -986,6 +1014,13 @@ export const enum_awards_grant_config_recipient_scope = pgEnum(
|
||||||
"enum_awards_grant_config_recipient_scope",
|
"enum_awards_grant_config_recipient_scope",
|
||||||
["same_command", "whitelist", "anyone"],
|
["same_command", "whitelist", "anyone"],
|
||||||
);
|
);
|
||||||
|
export const enum_award_rules_metric = pgEnum("enum_award_rules_metric", [
|
||||||
|
"yearsOfService",
|
||||||
|
"accountAge",
|
||||||
|
"missionsAttended",
|
||||||
|
"xpTotal",
|
||||||
|
]);
|
||||||
|
export const enum_award_rules_operator = pgEnum("enum_award_rules_operator", ["gte", "gt"]);
|
||||||
export const enum_assignments_type = pgEnum("enum_assignments_type", [
|
export const enum_assignments_type = pgEnum("enum_assignments_type", [
|
||||||
"division",
|
"division",
|
||||||
"squad",
|
"squad",
|
||||||
|
|
@ -1017,6 +1052,7 @@ export const enum_contribution_entries_type = pgEnum("enum_contribution_entries_
|
||||||
"wiki-page-edit",
|
"wiki-page-edit",
|
||||||
"mission-map-marker",
|
"mission-map-marker",
|
||||||
"survey-completion",
|
"survey-completion",
|
||||||
|
"journal-publish",
|
||||||
"manual",
|
"manual",
|
||||||
]);
|
]);
|
||||||
export const enum_contribution_entries_status = pgEnum("enum_contribution_entries_status", [
|
export const enum_contribution_entries_status = pgEnum("enum_contribution_entries_status", [
|
||||||
|
|
@ -1027,7 +1063,7 @@ export const enum_contribution_entries_status = pgEnum("enum_contribution_entrie
|
||||||
]);
|
]);
|
||||||
export const enum_contribution_entries_source_collection = pgEnum(
|
export const enum_contribution_entries_source_collection = pgEnum(
|
||||||
"enum_contribution_entries_source_collection",
|
"enum_contribution_entries_source_collection",
|
||||||
["wiki-pages", "mission-map-markers", "form-submissions", "manual"],
|
["wiki-pages", "mission-map-markers", "form-submissions", "journals", "manual"],
|
||||||
);
|
);
|
||||||
export const enum_evaluations_kind = pgEnum("enum_evaluations_kind", [
|
export const enum_evaluations_kind = pgEnum("enum_evaluations_kind", [
|
||||||
"leader-direct",
|
"leader-direct",
|
||||||
|
|
@ -1477,6 +1513,7 @@ export const enum_story_beat_states_reaction = pgEnum("enum_story_beat_states_re
|
||||||
"heart",
|
"heart",
|
||||||
"salute",
|
"salute",
|
||||||
]);
|
]);
|
||||||
|
export const enum_journals_status = pgEnum("enum_journals_status", ["draft", "published"]);
|
||||||
export const enum_game_servers_status = pgEnum("enum_game_servers_status", ["online", "offline"]);
|
export const enum_game_servers_status = pgEnum("enum_game_servers_status", ["online", "offline"]);
|
||||||
export const enum_arma_commands_status = pgEnum("enum_arma_commands_status", [
|
export const enum_arma_commands_status = pgEnum("enum_arma_commands_status", [
|
||||||
"queued",
|
"queued",
|
||||||
|
|
@ -1534,6 +1571,7 @@ export const enum_minigames_status = pgEnum("enum_minigames_status", [
|
||||||
"active",
|
"active",
|
||||||
"upcoming",
|
"upcoming",
|
||||||
"retired",
|
"retired",
|
||||||
|
"phasingOut",
|
||||||
]);
|
]);
|
||||||
export const enum_minigame_periods_status = pgEnum("enum_minigame_periods_status", [
|
export const enum_minigame_periods_status = pgEnum("enum_minigame_periods_status", [
|
||||||
"open",
|
"open",
|
||||||
|
|
@ -1589,6 +1627,14 @@ export const enum_shims_shims_paths_match_type = pgEnum("enum_shims_shims_paths_
|
||||||
"include",
|
"include",
|
||||||
"exclude",
|
"exclude",
|
||||||
]);
|
]);
|
||||||
|
export const enum_discord_presence_activity_type = pgEnum("enum_discord_presence_activity_type", [
|
||||||
|
"playing",
|
||||||
|
"streaming",
|
||||||
|
"listening",
|
||||||
|
"watching",
|
||||||
|
"competing",
|
||||||
|
"custom",
|
||||||
|
]);
|
||||||
|
|
||||||
export const media = pgTable(
|
export const media = pgTable(
|
||||||
"media",
|
"media",
|
||||||
|
|
@ -2148,6 +2194,10 @@ export const game_vehicles = pgTable(
|
||||||
deployedAt: integer("deployed_at_id").references(() => game_structures.id, {
|
deployedAt: integer("deployed_at_id").references(() => game_structures.id, {
|
||||||
onDelete: "set null",
|
onDelete: "set null",
|
||||||
}),
|
}),
|
||||||
|
garageGridX: numeric("garage_grid_x", { mode: "number" }),
|
||||||
|
garageGridY: numeric("garage_grid_y", { mode: "number" }),
|
||||||
|
garageRotated: boolean("garage_rotated").default(false),
|
||||||
|
bridgeUid: varchar("bridge_uid"),
|
||||||
faction: integer("faction_id").references(() => factions.id, {
|
faction: integer("faction_id").references(() => factions.id, {
|
||||||
onDelete: "set null",
|
onDelete: "set null",
|
||||||
}),
|
}),
|
||||||
|
|
@ -2164,6 +2214,7 @@ export const game_vehicles = pgTable(
|
||||||
(columns) => [
|
(columns) => [
|
||||||
index("game_vehicles_type_idx").on(columns.type),
|
index("game_vehicles_type_idx").on(columns.type),
|
||||||
index("game_vehicles_deployed_at_idx").on(columns.deployedAt),
|
index("game_vehicles_deployed_at_idx").on(columns.deployedAt),
|
||||||
|
uniqueIndex("game_vehicles_bridge_uid_idx").on(columns.bridgeUid),
|
||||||
index("game_vehicles_faction_idx").on(columns.faction),
|
index("game_vehicles_faction_idx").on(columns.faction),
|
||||||
index("game_vehicles_updated_at_idx").on(columns.updatedAt),
|
index("game_vehicles_updated_at_idx").on(columns.updatedAt),
|
||||||
index("game_vehicles_created_at_idx").on(columns.createdAt),
|
index("game_vehicles_created_at_idx").on(columns.createdAt),
|
||||||
|
|
@ -2591,6 +2642,7 @@ export const users = pgTable(
|
||||||
preferences_display_showBackgroundTexture: boolean(
|
preferences_display_showBackgroundTexture: boolean(
|
||||||
"preferences_display_show_background_texture",
|
"preferences_display_show_background_texture",
|
||||||
).default(true),
|
).default(true),
|
||||||
|
preferences_display_sidebarOrder: jsonb("preferences_display_sidebar_order"),
|
||||||
preferences_discord_enabled: boolean("preferences_discord_enabled").default(false),
|
preferences_discord_enabled: boolean("preferences_discord_enabled").default(false),
|
||||||
preferences_dashboard_layout: jsonb("preferences_dashboard_layout"),
|
preferences_dashboard_layout: jsonb("preferences_dashboard_layout"),
|
||||||
updatedAt: timestamp("updated_at", { mode: "string", withTimezone: true, precision: 3 })
|
updatedAt: timestamp("updated_at", { mode: "string", withTimezone: true, precision: 3 })
|
||||||
|
|
@ -3264,6 +3316,36 @@ export const awards_rels = pgTable(
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
export const award_rules = pgTable(
|
||||||
|
"award_rules",
|
||||||
|
{
|
||||||
|
id: serial("id").primaryKey(),
|
||||||
|
label: varchar("label").notNull(),
|
||||||
|
award: integer("award_id")
|
||||||
|
.notNull()
|
||||||
|
.references(() => awards.id, {
|
||||||
|
onDelete: "set null",
|
||||||
|
}),
|
||||||
|
metric: enum_award_rules_metric("metric").notNull(),
|
||||||
|
operator: enum_award_rules_operator("operator").notNull().default("gte"),
|
||||||
|
value: numeric("value", { mode: "number" }).notNull(),
|
||||||
|
autoRetireLowerTiers: boolean("auto_retire_lower_tiers").default(false),
|
||||||
|
oncePerSeries: boolean("once_per_series").default(false),
|
||||||
|
active: boolean("active").default(true),
|
||||||
|
updatedAt: timestamp("updated_at", { mode: "string", withTimezone: true, precision: 3 })
|
||||||
|
.defaultNow()
|
||||||
|
.notNull(),
|
||||||
|
createdAt: timestamp("created_at", { mode: "string", withTimezone: true, precision: 3 })
|
||||||
|
.defaultNow()
|
||||||
|
.notNull(),
|
||||||
|
},
|
||||||
|
(columns) => [
|
||||||
|
index("award_rules_award_idx").on(columns.award),
|
||||||
|
index("award_rules_updated_at_idx").on(columns.updatedAt),
|
||||||
|
index("award_rules_created_at_idx").on(columns.createdAt),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
|
||||||
export const qualifications = pgTable(
|
export const qualifications = pgTable(
|
||||||
"qualifications",
|
"qualifications",
|
||||||
{
|
{
|
||||||
|
|
@ -4861,6 +4943,8 @@ export const vehicles = pgTable(
|
||||||
transportMode: enum_vehicles_transport_mode("transport_mode").notNull().default("ground"),
|
transportMode: enum_vehicles_transport_mode("transport_mode").notNull().default("ground"),
|
||||||
width: numeric("width", { mode: "number" }),
|
width: numeric("width", { mode: "number" }),
|
||||||
height: numeric("height", { mode: "number" }),
|
height: numeric("height", { mode: "number" }),
|
||||||
|
garageWidth: numeric("garage_width", { mode: "number" }),
|
||||||
|
garageHeight: numeric("garage_height", { mode: "number" }),
|
||||||
maxMass: numeric("max_mass", { mode: "number" }),
|
maxMass: numeric("max_mass", { mode: "number" }),
|
||||||
aceCargoSlots: numeric("ace_cargo_slots", { mode: "number" }),
|
aceCargoSlots: numeric("ace_cargo_slots", { mode: "number" }),
|
||||||
maxHealth: numeric("max_health", { mode: "number" }),
|
maxHealth: numeric("max_health", { mode: "number" }),
|
||||||
|
|
@ -5291,6 +5375,8 @@ export const structures = pgTable(
|
||||||
restrictToAllowed: boolean("restrict_to_allowed").default(false),
|
restrictToAllowed: boolean("restrict_to_allowed").default(false),
|
||||||
xSize: numeric("x_size", { mode: "number" }),
|
xSize: numeric("x_size", { mode: "number" }),
|
||||||
ySize: numeric("y_size", { mode: "number" }),
|
ySize: numeric("y_size", { mode: "number" }),
|
||||||
|
vehicleBay_xSize: numeric("vehicle_bay_x_size", { mode: "number" }),
|
||||||
|
vehicleBay_ySize: numeric("vehicle_bay_y_size", { mode: "number" }),
|
||||||
maxHealth: numeric("max_health", { mode: "number" }).notNull(),
|
maxHealth: numeric("max_health", { mode: "number" }).notNull(),
|
||||||
repairSpeed: numeric("repair_speed", { mode: "number" }),
|
repairSpeed: numeric("repair_speed", { mode: "number" }),
|
||||||
updatedAt: timestamp("updated_at", { mode: "string", withTimezone: true, precision: 3 })
|
updatedAt: timestamp("updated_at", { mode: "string", withTimezone: true, precision: 3 })
|
||||||
|
|
@ -6666,6 +6752,38 @@ export const story_voiceovers = pgTable(
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
export const journals = pgTable(
|
||||||
|
"journals",
|
||||||
|
{
|
||||||
|
id: serial("id").primaryKey(),
|
||||||
|
title: varchar("title").notNull(),
|
||||||
|
author: integer("author_id")
|
||||||
|
.notNull()
|
||||||
|
.references(() => users.id, {
|
||||||
|
onDelete: "set null",
|
||||||
|
}),
|
||||||
|
status: enum_journals_status("status").notNull().default("draft"),
|
||||||
|
occurredAt: timestamp("occurred_at", { mode: "string", withTimezone: true, precision: 3 }),
|
||||||
|
mission: integer("mission_id").references(() => missions.id, {
|
||||||
|
onDelete: "set null",
|
||||||
|
}),
|
||||||
|
body: jsonb("body").notNull(),
|
||||||
|
updatedAt: timestamp("updated_at", { mode: "string", withTimezone: true, precision: 3 })
|
||||||
|
.defaultNow()
|
||||||
|
.notNull(),
|
||||||
|
createdAt: timestamp("created_at", { mode: "string", withTimezone: true, precision: 3 })
|
||||||
|
.defaultNow()
|
||||||
|
.notNull(),
|
||||||
|
},
|
||||||
|
(columns) => [
|
||||||
|
index("journals_author_idx").on(columns.author),
|
||||||
|
index("journals_status_idx").on(columns.status),
|
||||||
|
index("journals_mission_idx").on(columns.mission),
|
||||||
|
index("journals_updated_at_idx").on(columns.updatedAt),
|
||||||
|
index("journals_created_at_idx").on(columns.createdAt),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
|
||||||
export const mission_files = pgTable(
|
export const mission_files = pgTable(
|
||||||
"mission_files",
|
"mission_files",
|
||||||
{
|
{
|
||||||
|
|
@ -7333,6 +7451,11 @@ export const minigames = pgTable(
|
||||||
withTimezone: true,
|
withTimezone: true,
|
||||||
precision: 3,
|
precision: 3,
|
||||||
}),
|
}),
|
||||||
|
estimatedRemovalDate: timestamp("estimated_removal_date", {
|
||||||
|
mode: "string",
|
||||||
|
withTimezone: true,
|
||||||
|
precision: 3,
|
||||||
|
}),
|
||||||
order: numeric("order", { mode: "number" }).notNull().default(0),
|
order: numeric("order", { mode: "number" }).notNull().default(0),
|
||||||
countsForPeriods: boolean("counts_for_periods").default(false),
|
countsForPeriods: boolean("counts_for_periods").default(false),
|
||||||
scoreLabel: varchar("score_label").default("Score"),
|
scoreLabel: varchar("score_label").default("Score"),
|
||||||
|
|
@ -8061,6 +8184,10 @@ export const payload_mcp_api_keys = pgTable(
|
||||||
awards_create: boolean("awards_create").default(false),
|
awards_create: boolean("awards_create").default(false),
|
||||||
awards_update: boolean("awards_update").default(false),
|
awards_update: boolean("awards_update").default(false),
|
||||||
awards_delete: boolean("awards_delete").default(false),
|
awards_delete: boolean("awards_delete").default(false),
|
||||||
|
awardRules_find: boolean("award_rules_find").default(false),
|
||||||
|
awardRules_create: boolean("award_rules_create").default(false),
|
||||||
|
awardRules_update: boolean("award_rules_update").default(false),
|
||||||
|
awardRules_delete: boolean("award_rules_delete").default(false),
|
||||||
qualifications_find: boolean("qualifications_find").default(false),
|
qualifications_find: boolean("qualifications_find").default(false),
|
||||||
qualifications_create: boolean("qualifications_create").default(false),
|
qualifications_create: boolean("qualifications_create").default(false),
|
||||||
qualifications_update: boolean("qualifications_update").default(false),
|
qualifications_update: boolean("qualifications_update").default(false),
|
||||||
|
|
@ -8261,6 +8388,10 @@ export const payload_mcp_api_keys = pgTable(
|
||||||
storyVoiceovers_create: boolean("story_voiceovers_create").default(false),
|
storyVoiceovers_create: boolean("story_voiceovers_create").default(false),
|
||||||
storyVoiceovers_update: boolean("story_voiceovers_update").default(false),
|
storyVoiceovers_update: boolean("story_voiceovers_update").default(false),
|
||||||
storyVoiceovers_delete: boolean("story_voiceovers_delete").default(false),
|
storyVoiceovers_delete: boolean("story_voiceovers_delete").default(false),
|
||||||
|
journals_find: boolean("journals_find").default(false),
|
||||||
|
journals_create: boolean("journals_create").default(false),
|
||||||
|
journals_update: boolean("journals_update").default(false),
|
||||||
|
journals_delete: boolean("journals_delete").default(false),
|
||||||
missionFiles_find: boolean("mission_files_find").default(false),
|
missionFiles_find: boolean("mission_files_find").default(false),
|
||||||
missionFiles_create: boolean("mission_files_create").default(false),
|
missionFiles_create: boolean("mission_files_create").default(false),
|
||||||
missionFiles_update: boolean("mission_files_update").default(false),
|
missionFiles_update: boolean("mission_files_update").default(false),
|
||||||
|
|
@ -8411,6 +8542,7 @@ export const payload_locked_documents_rels = pgTable(
|
||||||
ranksID: integer("ranks_id"),
|
ranksID: integer("ranks_id"),
|
||||||
profilesID: integer("profiles_id"),
|
profilesID: integer("profiles_id"),
|
||||||
awardsID: integer("awards_id"),
|
awardsID: integer("awards_id"),
|
||||||
|
"award-rulesID": integer("award_rules_id"),
|
||||||
qualificationsID: integer("qualifications_id"),
|
qualificationsID: integer("qualifications_id"),
|
||||||
assignmentsID: integer("assignments_id"),
|
assignmentsID: integer("assignments_id"),
|
||||||
"assignment-transfersID": integer("assignment_transfers_id"),
|
"assignment-transfersID": integer("assignment_transfers_id"),
|
||||||
|
|
@ -8461,6 +8593,7 @@ export const payload_locked_documents_rels = pgTable(
|
||||||
"story-beatsID": integer("story_beats_id"),
|
"story-beatsID": integer("story_beats_id"),
|
||||||
"story-beat-statesID": integer("story_beat_states_id"),
|
"story-beat-statesID": integer("story_beat_states_id"),
|
||||||
"story-voiceoversID": integer("story_voiceovers_id"),
|
"story-voiceoversID": integer("story_voiceovers_id"),
|
||||||
|
journalsID: integer("journals_id"),
|
||||||
"mission-filesID": integer("mission_files_id"),
|
"mission-filesID": integer("mission_files_id"),
|
||||||
"mod-listsID": integer("mod_lists_id"),
|
"mod-listsID": integer("mod_lists_id"),
|
||||||
"game-serversID": integer("game_servers_id"),
|
"game-serversID": integer("game_servers_id"),
|
||||||
|
|
@ -8513,6 +8646,7 @@ export const payload_locked_documents_rels = pgTable(
|
||||||
index("payload_locked_documents_rels_ranks_id_idx").on(columns.ranksID),
|
index("payload_locked_documents_rels_ranks_id_idx").on(columns.ranksID),
|
||||||
index("payload_locked_documents_rels_profiles_id_idx").on(columns.profilesID),
|
index("payload_locked_documents_rels_profiles_id_idx").on(columns.profilesID),
|
||||||
index("payload_locked_documents_rels_awards_id_idx").on(columns.awardsID),
|
index("payload_locked_documents_rels_awards_id_idx").on(columns.awardsID),
|
||||||
|
index("payload_locked_documents_rels_award_rules_id_idx").on(columns["award-rulesID"]),
|
||||||
index("payload_locked_documents_rels_qualifications_id_idx").on(columns.qualificationsID),
|
index("payload_locked_documents_rels_qualifications_id_idx").on(columns.qualificationsID),
|
||||||
index("payload_locked_documents_rels_assignments_id_idx").on(columns.assignmentsID),
|
index("payload_locked_documents_rels_assignments_id_idx").on(columns.assignmentsID),
|
||||||
index("payload_locked_documents_rels_assignment_transfers_id_idx").on(
|
index("payload_locked_documents_rels_assignment_transfers_id_idx").on(
|
||||||
|
|
@ -8593,6 +8727,7 @@ export const payload_locked_documents_rels = pgTable(
|
||||||
index("payload_locked_documents_rels_story_voiceovers_id_idx").on(
|
index("payload_locked_documents_rels_story_voiceovers_id_idx").on(
|
||||||
columns["story-voiceoversID"],
|
columns["story-voiceoversID"],
|
||||||
),
|
),
|
||||||
|
index("payload_locked_documents_rels_journals_id_idx").on(columns.journalsID),
|
||||||
index("payload_locked_documents_rels_mission_files_id_idx").on(columns["mission-filesID"]),
|
index("payload_locked_documents_rels_mission_files_id_idx").on(columns["mission-filesID"]),
|
||||||
index("payload_locked_documents_rels_mod_lists_id_idx").on(columns["mod-listsID"]),
|
index("payload_locked_documents_rels_mod_lists_id_idx").on(columns["mod-listsID"]),
|
||||||
index("payload_locked_documents_rels_game_servers_id_idx").on(columns["game-serversID"]),
|
index("payload_locked_documents_rels_game_servers_id_idx").on(columns["game-serversID"]),
|
||||||
|
|
@ -8735,6 +8870,11 @@ export const payload_locked_documents_rels = pgTable(
|
||||||
foreignColumns: [awards.id],
|
foreignColumns: [awards.id],
|
||||||
name: "payload_locked_documents_rels_awards_fk",
|
name: "payload_locked_documents_rels_awards_fk",
|
||||||
}).onDelete("cascade"),
|
}).onDelete("cascade"),
|
||||||
|
foreignKey({
|
||||||
|
columns: [columns["award-rulesID"]],
|
||||||
|
foreignColumns: [award_rules.id],
|
||||||
|
name: "payload_locked_documents_rels_award_rules_fk",
|
||||||
|
}).onDelete("cascade"),
|
||||||
foreignKey({
|
foreignKey({
|
||||||
columns: [columns["qualificationsID"]],
|
columns: [columns["qualificationsID"]],
|
||||||
foreignColumns: [qualifications.id],
|
foreignColumns: [qualifications.id],
|
||||||
|
|
@ -8985,6 +9125,11 @@ export const payload_locked_documents_rels = pgTable(
|
||||||
foreignColumns: [story_voiceovers.id],
|
foreignColumns: [story_voiceovers.id],
|
||||||
name: "payload_locked_documents_rels_story_voiceovers_fk",
|
name: "payload_locked_documents_rels_story_voiceovers_fk",
|
||||||
}).onDelete("cascade"),
|
}).onDelete("cascade"),
|
||||||
|
foreignKey({
|
||||||
|
columns: [columns["journalsID"]],
|
||||||
|
foreignColumns: [journals.id],
|
||||||
|
name: "payload_locked_documents_rels_journals_fk",
|
||||||
|
}).onDelete("cascade"),
|
||||||
foreignKey({
|
foreignKey({
|
||||||
columns: [columns["mission-filesID"]],
|
columns: [columns["mission-filesID"]],
|
||||||
foreignColumns: [mission_files.id],
|
foreignColumns: [mission_files.id],
|
||||||
|
|
@ -9378,6 +9523,26 @@ export const minigame_rules = pgTable("minigame_rules", {
|
||||||
createdAt: timestamp("created_at", { mode: "string", withTimezone: true, precision: 3 }),
|
createdAt: timestamp("created_at", { mode: "string", withTimezone: true, precision: 3 }),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const discord_presence = pgTable("discord_presence", {
|
||||||
|
id: serial("id").primaryKey(),
|
||||||
|
enabled: boolean("enabled").default(false),
|
||||||
|
activityType: enum_discord_presence_activity_type("activity_type").notNull().default("playing"),
|
||||||
|
state: varchar("state"),
|
||||||
|
details: varchar("details"),
|
||||||
|
startTimestamp: numeric("start_timestamp", { mode: "number" }),
|
||||||
|
endTimestamp: numeric("end_timestamp", { mode: "number" }),
|
||||||
|
largeImageKey: varchar("large_image_key"),
|
||||||
|
largeImageText: varchar("large_image_text"),
|
||||||
|
smallImageKey: varchar("small_image_key"),
|
||||||
|
smallImageText: varchar("small_image_text"),
|
||||||
|
partyId: varchar("party_id"),
|
||||||
|
partySize: numeric("party_size", { mode: "number" }),
|
||||||
|
partyMax: numeric("party_max", { mode: "number" }),
|
||||||
|
joinSecret: varchar("join_secret"),
|
||||||
|
updatedAt: timestamp("updated_at", { mode: "string", withTimezone: true, precision: 3 }),
|
||||||
|
createdAt: timestamp("created_at", { mode: "string", withTimezone: true, precision: 3 }),
|
||||||
|
});
|
||||||
|
|
||||||
export const relations_media = relations(media, () => ({}));
|
export const relations_media = relations(media, () => ({}));
|
||||||
export const relations_announcements_buttons = relations(announcements_buttons, ({ one }) => ({
|
export const relations_announcements_buttons = relations(announcements_buttons, ({ one }) => ({
|
||||||
_parentID: one(announcements, {
|
_parentID: one(announcements, {
|
||||||
|
|
@ -9996,6 +10161,13 @@ export const relations_awards = relations(awards, ({ one, many }) => ({
|
||||||
relationName: "_rels",
|
relationName: "_rels",
|
||||||
}),
|
}),
|
||||||
}));
|
}));
|
||||||
|
export const relations_award_rules = relations(award_rules, ({ one }) => ({
|
||||||
|
award: one(awards, {
|
||||||
|
fields: [award_rules.award],
|
||||||
|
references: [awards.id],
|
||||||
|
relationName: "award",
|
||||||
|
}),
|
||||||
|
}));
|
||||||
export const relations_qualifications = relations(qualifications, () => ({}));
|
export const relations_qualifications = relations(qualifications, () => ({}));
|
||||||
export const relations_assignments_rels = relations(assignments_rels, ({ one }) => ({
|
export const relations_assignments_rels = relations(assignments_rels, ({ one }) => ({
|
||||||
parent: one(assignments, {
|
parent: one(assignments, {
|
||||||
|
|
@ -11538,6 +11710,18 @@ export const relations_story_beat_states = relations(story_beat_states, ({ one }
|
||||||
}),
|
}),
|
||||||
}));
|
}));
|
||||||
export const relations_story_voiceovers = relations(story_voiceovers, () => ({}));
|
export const relations_story_voiceovers = relations(story_voiceovers, () => ({}));
|
||||||
|
export const relations_journals = relations(journals, ({ one }) => ({
|
||||||
|
author: one(users, {
|
||||||
|
fields: [journals.author],
|
||||||
|
references: [users.id],
|
||||||
|
relationName: "author",
|
||||||
|
}),
|
||||||
|
mission: one(missions, {
|
||||||
|
fields: [journals.mission],
|
||||||
|
references: [missions.id],
|
||||||
|
relationName: "mission",
|
||||||
|
}),
|
||||||
|
}));
|
||||||
export const relations_mission_files = relations(mission_files, ({ one }) => ({
|
export const relations_mission_files = relations(mission_files, ({ one }) => ({
|
||||||
author: one(users, {
|
author: one(users, {
|
||||||
fields: [mission_files.author],
|
fields: [mission_files.author],
|
||||||
|
|
@ -12129,6 +12313,11 @@ export const relations_payload_locked_documents_rels = relations(
|
||||||
references: [awards.id],
|
references: [awards.id],
|
||||||
relationName: "awards",
|
relationName: "awards",
|
||||||
}),
|
}),
|
||||||
|
"award-rulesID": one(award_rules, {
|
||||||
|
fields: [payload_locked_documents_rels["award-rulesID"]],
|
||||||
|
references: [award_rules.id],
|
||||||
|
relationName: "award-rules",
|
||||||
|
}),
|
||||||
qualificationsID: one(qualifications, {
|
qualificationsID: one(qualifications, {
|
||||||
fields: [payload_locked_documents_rels.qualificationsID],
|
fields: [payload_locked_documents_rels.qualificationsID],
|
||||||
references: [qualifications.id],
|
references: [qualifications.id],
|
||||||
|
|
@ -12379,6 +12568,11 @@ export const relations_payload_locked_documents_rels = relations(
|
||||||
references: [story_voiceovers.id],
|
references: [story_voiceovers.id],
|
||||||
relationName: "story-voiceovers",
|
relationName: "story-voiceovers",
|
||||||
}),
|
}),
|
||||||
|
journalsID: one(journals, {
|
||||||
|
fields: [payload_locked_documents_rels.journalsID],
|
||||||
|
references: [journals.id],
|
||||||
|
relationName: "journals",
|
||||||
|
}),
|
||||||
"mission-filesID": one(mission_files, {
|
"mission-filesID": one(mission_files, {
|
||||||
fields: [payload_locked_documents_rels["mission-filesID"]],
|
fields: [payload_locked_documents_rels["mission-filesID"]],
|
||||||
references: [mission_files.id],
|
references: [mission_files.id],
|
||||||
|
|
@ -12618,6 +12812,7 @@ export const relations_shims = relations(shims, ({ many }) => ({
|
||||||
}),
|
}),
|
||||||
}));
|
}));
|
||||||
export const relations_minigame_rules = relations(minigame_rules, () => ({}));
|
export const relations_minigame_rules = relations(minigame_rules, () => ({}));
|
||||||
|
export const relations_discord_presence = relations(discord_presence, () => ({}));
|
||||||
|
|
||||||
type DatabaseSchema = {
|
type DatabaseSchema = {
|
||||||
enum_announcements_buttons_style: typeof enum_announcements_buttons_style;
|
enum_announcements_buttons_style: typeof enum_announcements_buttons_style;
|
||||||
|
|
@ -12644,6 +12839,8 @@ type DatabaseSchema = {
|
||||||
enum_awards_grant_config_allowed_grantor_assignment_types: typeof enum_awards_grant_config_allowed_grantor_assignment_types;
|
enum_awards_grant_config_allowed_grantor_assignment_types: typeof enum_awards_grant_config_allowed_grantor_assignment_types;
|
||||||
enum_awards_type: typeof enum_awards_type;
|
enum_awards_type: typeof enum_awards_type;
|
||||||
enum_awards_grant_config_recipient_scope: typeof enum_awards_grant_config_recipient_scope;
|
enum_awards_grant_config_recipient_scope: typeof enum_awards_grant_config_recipient_scope;
|
||||||
|
enum_award_rules_metric: typeof enum_award_rules_metric;
|
||||||
|
enum_award_rules_operator: typeof enum_award_rules_operator;
|
||||||
enum_assignments_type: typeof enum_assignments_type;
|
enum_assignments_type: typeof enum_assignments_type;
|
||||||
enum_assignment_transfers_status: typeof enum_assignment_transfers_status;
|
enum_assignment_transfers_status: typeof enum_assignment_transfers_status;
|
||||||
enum_assignment_transfers_escalation_reason: typeof enum_assignment_transfers_escalation_reason;
|
enum_assignment_transfers_escalation_reason: typeof enum_assignment_transfers_escalation_reason;
|
||||||
|
|
@ -12731,6 +12928,7 @@ type DatabaseSchema = {
|
||||||
enum_narrative_events_triggers_type: typeof enum_narrative_events_triggers_type;
|
enum_narrative_events_triggers_type: typeof enum_narrative_events_triggers_type;
|
||||||
enum_story_beats_status: typeof enum_story_beats_status;
|
enum_story_beats_status: typeof enum_story_beats_status;
|
||||||
enum_story_beat_states_reaction: typeof enum_story_beat_states_reaction;
|
enum_story_beat_states_reaction: typeof enum_story_beat_states_reaction;
|
||||||
|
enum_journals_status: typeof enum_journals_status;
|
||||||
enum_game_servers_status: typeof enum_game_servers_status;
|
enum_game_servers_status: typeof enum_game_servers_status;
|
||||||
enum_arma_commands_status: typeof enum_arma_commands_status;
|
enum_arma_commands_status: typeof enum_arma_commands_status;
|
||||||
enum_supply_boxes_status: typeof enum_supply_boxes_status;
|
enum_supply_boxes_status: typeof enum_supply_boxes_status;
|
||||||
|
|
@ -12755,6 +12953,7 @@ type DatabaseSchema = {
|
||||||
enum_shims_shims_type: typeof enum_shims_shims_type;
|
enum_shims_shims_type: typeof enum_shims_shims_type;
|
||||||
enum_shims_shims_targeting_audience: typeof enum_shims_shims_targeting_audience;
|
enum_shims_shims_targeting_audience: typeof enum_shims_shims_targeting_audience;
|
||||||
enum_shims_shims_paths_match_type: typeof enum_shims_shims_paths_match_type;
|
enum_shims_shims_paths_match_type: typeof enum_shims_shims_paths_match_type;
|
||||||
|
enum_discord_presence_activity_type: typeof enum_discord_presence_activity_type;
|
||||||
media: typeof media;
|
media: typeof media;
|
||||||
announcements_buttons: typeof announcements_buttons;
|
announcements_buttons: typeof announcements_buttons;
|
||||||
announcements: typeof announcements;
|
announcements: typeof announcements;
|
||||||
|
|
@ -12802,6 +13001,7 @@ type DatabaseSchema = {
|
||||||
awards_grant_config_allowed_grantor_assignment_types: typeof awards_grant_config_allowed_grantor_assignment_types;
|
awards_grant_config_allowed_grantor_assignment_types: typeof awards_grant_config_allowed_grantor_assignment_types;
|
||||||
awards: typeof awards;
|
awards: typeof awards;
|
||||||
awards_rels: typeof awards_rels;
|
awards_rels: typeof awards_rels;
|
||||||
|
award_rules: typeof award_rules;
|
||||||
qualifications: typeof qualifications;
|
qualifications: typeof qualifications;
|
||||||
assignments: typeof assignments;
|
assignments: typeof assignments;
|
||||||
assignments_rels: typeof assignments_rels;
|
assignments_rels: typeof assignments_rels;
|
||||||
|
|
@ -12906,6 +13106,7 @@ type DatabaseSchema = {
|
||||||
story_beats: typeof story_beats;
|
story_beats: typeof story_beats;
|
||||||
story_beat_states: typeof story_beat_states;
|
story_beat_states: typeof story_beat_states;
|
||||||
story_voiceovers: typeof story_voiceovers;
|
story_voiceovers: typeof story_voiceovers;
|
||||||
|
journals: typeof journals;
|
||||||
mission_files: typeof mission_files;
|
mission_files: typeof mission_files;
|
||||||
mod_lists: typeof mod_lists;
|
mod_lists: typeof mod_lists;
|
||||||
game_servers: typeof game_servers;
|
game_servers: typeof game_servers;
|
||||||
|
|
@ -12964,6 +13165,7 @@ type DatabaseSchema = {
|
||||||
shims_texts: typeof shims_texts;
|
shims_texts: typeof shims_texts;
|
||||||
shims_rels: typeof shims_rels;
|
shims_rels: typeof shims_rels;
|
||||||
minigame_rules: typeof minigame_rules;
|
minigame_rules: typeof minigame_rules;
|
||||||
|
discord_presence: typeof discord_presence;
|
||||||
relations_media: typeof relations_media;
|
relations_media: typeof relations_media;
|
||||||
relations_announcements_buttons: typeof relations_announcements_buttons;
|
relations_announcements_buttons: typeof relations_announcements_buttons;
|
||||||
relations_announcements_texts: typeof relations_announcements_texts;
|
relations_announcements_texts: typeof relations_announcements_texts;
|
||||||
|
|
@ -13011,6 +13213,7 @@ type DatabaseSchema = {
|
||||||
relations_awards_grant_config_allowed_grantor_assignment_types: typeof relations_awards_grant_config_allowed_grantor_assignment_types;
|
relations_awards_grant_config_allowed_grantor_assignment_types: typeof relations_awards_grant_config_allowed_grantor_assignment_types;
|
||||||
relations_awards_rels: typeof relations_awards_rels;
|
relations_awards_rels: typeof relations_awards_rels;
|
||||||
relations_awards: typeof relations_awards;
|
relations_awards: typeof relations_awards;
|
||||||
|
relations_award_rules: typeof relations_award_rules;
|
||||||
relations_qualifications: typeof relations_qualifications;
|
relations_qualifications: typeof relations_qualifications;
|
||||||
relations_assignments_rels: typeof relations_assignments_rels;
|
relations_assignments_rels: typeof relations_assignments_rels;
|
||||||
relations_assignments: typeof relations_assignments;
|
relations_assignments: typeof relations_assignments;
|
||||||
|
|
@ -13115,6 +13318,7 @@ type DatabaseSchema = {
|
||||||
relations_story_beats: typeof relations_story_beats;
|
relations_story_beats: typeof relations_story_beats;
|
||||||
relations_story_beat_states: typeof relations_story_beat_states;
|
relations_story_beat_states: typeof relations_story_beat_states;
|
||||||
relations_story_voiceovers: typeof relations_story_voiceovers;
|
relations_story_voiceovers: typeof relations_story_voiceovers;
|
||||||
|
relations_journals: typeof relations_journals;
|
||||||
relations_mission_files: typeof relations_mission_files;
|
relations_mission_files: typeof relations_mission_files;
|
||||||
relations_mod_lists: typeof relations_mod_lists;
|
relations_mod_lists: typeof relations_mod_lists;
|
||||||
relations_game_servers: typeof relations_game_servers;
|
relations_game_servers: typeof relations_game_servers;
|
||||||
|
|
@ -13173,6 +13377,7 @@ type DatabaseSchema = {
|
||||||
relations_shims_rels: typeof relations_shims_rels;
|
relations_shims_rels: typeof relations_shims_rels;
|
||||||
relations_shims: typeof relations_shims;
|
relations_shims: typeof relations_shims;
|
||||||
relations_minigame_rules: typeof relations_minigame_rules;
|
relations_minigame_rules: typeof relations_minigame_rules;
|
||||||
|
relations_discord_presence: typeof relations_discord_presence;
|
||||||
};
|
};
|
||||||
|
|
||||||
declare module "@payloadcms/db-postgres" {
|
declare module "@payloadcms/db-postgres" {
|
||||||
|
|
|
||||||
|
|
@ -6171,11 +6171,15 @@ export interface Minigame {
|
||||||
*/
|
*/
|
||||||
icon?: string | null;
|
icon?: string | null;
|
||||||
category: 'core' | 'cardtable' | 'multiplayer';
|
category: 'core' | 'cardtable' | 'multiplayer';
|
||||||
status: 'active' | 'upcoming' | 'retired';
|
status: 'active' | 'upcoming' | 'retired' | 'phasingOut';
|
||||||
/**
|
/**
|
||||||
* Optional target for an upcoming game. Shown as a countdown in the sidebar and on the game page. Display only: the game goes live when status changes to Active.
|
* Optional target for an upcoming game. Shown as a countdown in the sidebar and on the game page. Display only: the game goes live when status changes to Active.
|
||||||
*/
|
*/
|
||||||
estimatedReleaseDate?: string | null;
|
estimatedReleaseDate?: string | null;
|
||||||
|
/**
|
||||||
|
* Optional target for a phasing-out game. Shown as a countdown in the sidebar and on the game page so operators know when it leaves. Display only: the game stays playable until status changes to Retired.
|
||||||
|
*/
|
||||||
|
estimatedRemovalDate?: string | null;
|
||||||
order: number;
|
order: number;
|
||||||
/**
|
/**
|
||||||
* When on, ledger entries for this game feed anchored period boards.
|
* When on, ledger entries for this game feed anchored period boards.
|
||||||
|
|
@ -11015,6 +11019,7 @@ export interface MinigamesSelect<T extends boolean = true> {
|
||||||
category?: T;
|
category?: T;
|
||||||
status?: T;
|
status?: T;
|
||||||
estimatedReleaseDate?: T;
|
estimatedReleaseDate?: T;
|
||||||
|
estimatedRemovalDate?: T;
|
||||||
order?: T;
|
order?: T;
|
||||||
countsForPeriods?: T;
|
countsForPeriods?: T;
|
||||||
scoreLabel?: T;
|
scoreLabel?: T;
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ import { describe, expect, it } from "vitest";
|
||||||
import {
|
import {
|
||||||
formatCountdown,
|
formatCountdown,
|
||||||
formatReleaseInstant,
|
formatReleaseInstant,
|
||||||
|
phasingOutTooltip,
|
||||||
upcomingTooltip,
|
upcomingTooltip,
|
||||||
} from "@/lib/minigames/countdown";
|
} from "@/lib/minigames/countdown";
|
||||||
|
|
||||||
|
|
@ -37,4 +38,11 @@ describe("Minigame release countdown", () => {
|
||||||
);
|
);
|
||||||
expect(upcomingTooltip(null)).toBe("Upcoming");
|
expect(upcomingTooltip(null)).toBe("Upcoming");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("builds the phasing-out tooltip line, with and without an estimate", () => {
|
||||||
|
expect(phasingOutTooltip(TARGET, new Date(targetMs - (12 * DAY + 3 * HOUR)))).toBe(
|
||||||
|
"Phasing out · leaves Dec 3, 2026 18:00 UTC (in 12d 3h)",
|
||||||
|
);
|
||||||
|
expect(phasingOutTooltip(null)).toBe("Phasing out");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -122,13 +122,36 @@ describe("Minigame registry", () => {
|
||||||
expect(achievements.docs[0]?.value).toBe(10);
|
expect(achievements.docs[0]?.value).toBe(10);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("keeps a phasing-out game in the nav, scoring, and round-trips its removal date", async () => {
|
||||||
|
await clearMinigameData();
|
||||||
|
await createGame({
|
||||||
|
key: "leaving",
|
||||||
|
label: "Leaving Soon",
|
||||||
|
category: "core",
|
||||||
|
status: "phasingOut",
|
||||||
|
order: 1,
|
||||||
|
countsForPeriods: true,
|
||||||
|
estimatedRemovalDate: "2027-01-15T00:00:00.000Z",
|
||||||
|
});
|
||||||
|
|
||||||
|
const games = await loadMinigameRegistry(payload);
|
||||||
|
const leaving = games.find((game) => game.key === "leaving");
|
||||||
|
// Still visible in the nav (unlike retired) with its removal date attached.
|
||||||
|
expect(leaving?.status).toBe("phasingOut");
|
||||||
|
expect(leaving?.estimatedRemovalDate).toBe("2027-01-15T00:00:00.000Z");
|
||||||
|
expect(visibleRegistryGames(games).map((game) => game.key)).toContain("leaving");
|
||||||
|
// Still scores periods while it is playable.
|
||||||
|
expect(periodScoringGameKeys(games)).toContain("leaving");
|
||||||
|
});
|
||||||
|
|
||||||
async function createGame(data: {
|
async function createGame(data: {
|
||||||
key: string;
|
key: string;
|
||||||
label: string;
|
label: string;
|
||||||
category: "core" | "cardtable";
|
category: "core" | "cardtable";
|
||||||
status: "active" | "retired" | "upcoming";
|
status: "active" | "retired" | "upcoming" | "phasingOut";
|
||||||
order: number;
|
order: number;
|
||||||
countsForPeriods?: boolean;
|
countsForPeriods?: boolean;
|
||||||
|
estimatedRemovalDate?: string;
|
||||||
}) {
|
}) {
|
||||||
await payload.create({
|
await payload.create({
|
||||||
collection: "minigames",
|
collection: "minigames",
|
||||||
|
|
|
||||||
|
|
@ -69,12 +69,36 @@ describe("Upcoming minigames", () => {
|
||||||
expect(keys).not.toContain("signals");
|
expect(keys).not.toContain("signals");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("keeps a phasing-out game playable: round-trips the removal date and leaderboard row", async () => {
|
||||||
|
await clearMinigameData();
|
||||||
|
await createGame({
|
||||||
|
key: "retire-me",
|
||||||
|
label: "Retire Me",
|
||||||
|
status: "phasingOut",
|
||||||
|
order: 1,
|
||||||
|
estimatedRemovalDate: RELEASE,
|
||||||
|
});
|
||||||
|
|
||||||
|
const games = await loadMinigameRegistry(payload);
|
||||||
|
const leaving = games.find((game) => game.key === "retire-me");
|
||||||
|
expect(leaving?.estimatedRemovalDate).toBe(RELEASE);
|
||||||
|
|
||||||
|
// Not a coming-soon gate: it renders the arena rather than the coming-soon screen.
|
||||||
|
const gate = await getMinigameReleaseState(payload, "retire-me");
|
||||||
|
expect(gate.upcoming).toBe(false);
|
||||||
|
|
||||||
|
// Still scores periods while it is playable.
|
||||||
|
const data = await buildLeaderboardPayload(payload, { scope: "period" });
|
||||||
|
expect(data.boards.map((board) => board.key)).toContain("retire-me");
|
||||||
|
});
|
||||||
|
|
||||||
async function createGame(data: {
|
async function createGame(data: {
|
||||||
key: string;
|
key: string;
|
||||||
label: string;
|
label: string;
|
||||||
status: "active" | "upcoming" | "retired";
|
status: "active" | "upcoming" | "retired" | "phasingOut";
|
||||||
order: number;
|
order: number;
|
||||||
estimatedReleaseDate?: string;
|
estimatedReleaseDate?: string;
|
||||||
|
estimatedRemovalDate?: string;
|
||||||
}) {
|
}) {
|
||||||
await payload.create({
|
await payload.create({
|
||||||
collection: "minigames",
|
collection: "minigames",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue