1
0
Fork 0
polaris-task-force/src/collections/voiceover/VoiceScripts.ts
Z8MB1E 92117374b7 feat(voiceover): add description and spoiler fields to voice scripts
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-09-07 00:34:32 -04:00

76 lines
2 KiB
TypeScript

import { CollectionConfig } from "payload";
import hasRoles from "@/utils/access-control/hasRoles";
export const VoiceScripts: CollectionConfig = {
slug: "voice-scripts",
admin: {
group: "Voiceover",
useAsTitle: "title",
defaultColumns: ["title", "xpAmount", "spoiler", "status", "createdAt"],
},
access: {
read: ({ req }) => Boolean(req.user),
create: ({ req }) => hasRoles(["admin", "developer"], req.user),
update: ({ req }) => hasRoles(["admin", "developer"], req.user),
delete: ({ req }) => hasRoles(["admin", "developer"], req.user),
},
fields: [
{
name: "title",
type: "text",
required: true,
},
{
name: "description",
label: "Context Description",
type: "textarea",
admin: {
description:
"Optional context for readers: who is speaking, where this line happens, and anything else they should know before recording.",
},
},
{
name: "script",
type: "textarea",
required: true,
admin: {
description:
"Voice talent reads this verbatim. Inline emotion tags like [calm] are stored as written.",
},
},
{
name: "xpAmount",
label: "XP Amount",
type: "number",
required: true,
defaultValue: 250,
min: 0,
admin: {
description: "XP awarded per accepted submission of this script.",
},
},
{
name: "spoiler",
label: "Potential Campaign Spoilers",
type: "checkbox",
defaultValue: false,
admin: {
description:
"Warns readers on the frontend that this script may include, infer, or expose campaign spoilers.",
},
},
{
name: "status",
type: "select",
required: true,
defaultValue: "open",
options: [
{ label: "Open", value: "open" },
{ label: "Closed", value: "closed" },
],
admin: {
description: "Closed scripts reject new submissions",
},
},
],
};