The six period-scored game pages (flappy, eod, opord, radio, qualification, call-for-fire) now render their current-period PeriodStandingsCard directly under the game board, in the slot the lifetime board used to occupy. Each game's all-time leaderboard moves below it into a collapsed AllTimeLeaderboard disclosure (shadcn Collapsible) that expands on click, so period standings are centered and primary and the lifetime board is opt-in. PeriodStandingsCard drops its period/all-time toggle and keeps the current period only, now with the presence line the pages previously omitted. The old "Anchored period standings" heading and card block are removed from the six page.tsx files. The e2e spec covers the collapsed all-time section on /minigames/flappy.
77 lines
2.7 KiB
TypeScript
77 lines
2.7 KiB
TypeScript
import type { Metadata } from "next";
|
|
import config from "@payload-config";
|
|
import { getPayload } from "payload";
|
|
import { headers as nextHeaders } from "next/headers";
|
|
import { redirect } from "next/navigation";
|
|
import { MinigameComingSoon } from "@/components/frontend/minigames/MinigameComingSoon";
|
|
import { PhasingOutBanner } from "@/components/frontend/minigames/PhasingOutBanner";
|
|
import { getMinigameReleaseState } from "@/lib/minigames/loadRegistry";
|
|
import { ScrollText } from "lucide-react";
|
|
import { OpordArena } from "@/components/frontend/minigames/opord/OpordArena";
|
|
|
|
export const metadata: Metadata = {
|
|
title: "OPORD Recall (Polaris Task Force)",
|
|
description: "Study a live operations order, then recall the details under pressure.",
|
|
};
|
|
|
|
export default async function OpordPage() {
|
|
const headers = await nextHeaders();
|
|
const payloadConfig = await config;
|
|
const payload = await getPayload({ config: payloadConfig });
|
|
const { user } = await payload.auth({ headers, canSetHeaders: false });
|
|
|
|
if (!user) {
|
|
redirect(`/login?returnTo=${encodeURIComponent("/minigames/opord")}`);
|
|
}
|
|
|
|
const release = await getMinigameReleaseState(payload, "opord");
|
|
if (release.upcoming && release.game) {
|
|
return <MinigameComingSoon game={release.game} />;
|
|
}
|
|
|
|
const profileRes = await payload.find({
|
|
collection: "profiles",
|
|
where: { user: { equals: user.id as number } },
|
|
limit: 1,
|
|
depth: 0,
|
|
overrideAccess: true,
|
|
select: {
|
|
progression: {
|
|
minigames: true,
|
|
},
|
|
},
|
|
});
|
|
|
|
const opordRecall = profileRes.docs[0]?.progression?.minigames?.opordRecall ?? {};
|
|
const stats = {
|
|
gamesPlayed: opordRecall.gamesPlayed ?? 0,
|
|
bestScore: opordRecall.bestScore ?? 0,
|
|
bestAccuracy: opordRecall.bestAccuracy ?? 0,
|
|
recruitBestScore: opordRecall.recruitBestScore ?? 0,
|
|
veteranBestScore: opordRecall.veteranBestScore ?? 0,
|
|
eliteBestScore: opordRecall.eliteBestScore ?? 0,
|
|
opordRecallXp: opordRecall.xpEarned ?? 0,
|
|
xpEarned: 0,
|
|
score: 0,
|
|
accuracy: 0,
|
|
};
|
|
|
|
return (
|
|
<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 items-center gap-2">
|
|
<ScrollText className="size-5 text-muted-foreground" />
|
|
<h1 className="text-lg font-semibold">OPORD Recall</h1>
|
|
</div>
|
|
<p className="text-sm text-muted-foreground">
|
|
Study a live operations order, then recall the details under pressure.
|
|
</p>
|
|
</div>
|
|
|
|
<OpordArena initialStats={stats} currentUserId={user.id as number} />
|
|
</div>
|
|
);
|
|
}
|