Factions gain a discovered checkbox plus a read-time mask so players see the entry (UNDISCOVERED card, classified detail stub) without its name, description, standing, relationships, campaigns or cover image. The mask runs in the Factions afterRead hook, so every reader path is covered: pages, REST, and populated relationships. Readers holding the new factions:view-undiscovered permission or system:admin-access see the real record; admin panel reads are exempt so a masked edit form can never write the placeholder name back over a record.
55 lines
1.8 KiB
TypeScript
55 lines
1.8 KiB
TypeScript
import config from "@payload-config";
|
|
import { getPayload } from "payload";
|
|
import { headers as nextHeaders } from "next/headers";
|
|
import type { GameNpc } from "@/payload-types";
|
|
import { UsersIcon } from "lucide-react";
|
|
import { NpcDirectory } from "@/components/frontend/personnel/NpcDirectory";
|
|
import { ClassificationStrip, CornerBrackets, DOSSIER } from "@/components/frontend/operations";
|
|
|
|
export const metadata = {
|
|
title: "Contacts: Polaris Task Force",
|
|
};
|
|
|
|
export default async function ContactsPage() {
|
|
const payload = await getPayload({ config });
|
|
const { user } = await payload.auth({
|
|
headers: await nextHeaders(),
|
|
canSetHeaders: false,
|
|
});
|
|
const npcsRes = await payload.find({
|
|
collection: "game-npcs",
|
|
limit: 200,
|
|
depth: 1,
|
|
user,
|
|
});
|
|
const npcs = npcsRes.docs as unknown as GameNpc[];
|
|
|
|
return (
|
|
<div className="flex flex-col gap-6 p-5">
|
|
<header className="group relative overflow-hidden rounded-none border border-border/70 bg-card">
|
|
<div
|
|
aria-hidden="true"
|
|
className="pointer-events-none absolute inset-0 z-[5] opacity-[0.04]"
|
|
style={DOSSIER.gridTexture}
|
|
/>
|
|
<ClassificationStrip
|
|
left="Theater Contacts // Personnel"
|
|
right={`${npcs.length} Recorded`}
|
|
/>
|
|
<CornerBrackets />
|
|
<div className="relative z-10 flex items-center gap-3 px-5 py-4">
|
|
<UsersIcon className="size-5 shrink-0 text-white/50" />
|
|
<div className="flex flex-col gap-0.5">
|
|
<h1 className="text-xl font-bold tracking-tight text-white">Contacts</h1>
|
|
<p className="text-sm text-white/60">
|
|
{npcs.length} contact{npcs.length !== 1 ? "s" : ""} recorded in the theater of
|
|
operations.
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</header>
|
|
|
|
<NpcDirectory npcs={npcs} />
|
|
</div>
|
|
);
|
|
}
|