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 { Spade } from "lucide-react"; import { PokerArena } from "@/components/frontend/minigames/poker/PokerArena"; import { readPokerStats } from "@/lib/minigames/poker/stats"; import { isSuperuser, superuserUserIds } from "@/utils/access-control/hasPermission"; export const metadata: Metadata = { title: "Poker: Polaris Task Force", description: "A multiplayer Texas Hold'em training table for Polaris Task Force operators.", }; interface PokerPageProps { searchParams: Promise<{ table?: string | string[]; }>; } export default async function PokerPage({ searchParams }: PokerPageProps) { const headers = await nextHeaders(); const payload = await getPayload({ config }); const { user } = await payload.auth({ headers, canSetHeaders: false }); if (!user) { redirect(`/login?returnTo=${encodeURIComponent("/minigames/poker")}`); } const superuser = await isSuperuser(payload, user); const superuserIds = await superuserUserIds(payload); const profileRes = await payload.find({ collection: "profiles", where: { user: { equals: Number(user.id) } }, limit: 1, depth: 0, overrideAccess: true, select: { progression: { minigames: true, chipBank: true, chipBankRefilledAt: true, }, }, }); const stats = readPokerStats(profileRes.docs[0]); const progressionDoc = (profileRes.docs[0]?.progression ?? {}) as { chipBank?: number | null; chipBankRefilledAt?: string | null; }; const initialChipBank = progressionDoc.chipBank ?? 0; const initialChipTopUpAt = progressionDoc.chipBankRefilledAt ?? null; const params = await searchParams; const tableValue = params.table; const initialTableId = Array.isArray(tableValue) ? tableValue[0] : tableValue; return (

Poker

Sit down for a multiplayer Texas Hold'em game. Read the table, manage your stack, and outlast the field.

); }