diff --git a/src/app/(frontend)/story/page.tsx b/src/app/(frontend)/story/page.tsx
index b6943915..a3e41ee2 100644
--- a/src/app/(frontend)/story/page.tsx
+++ b/src/app/(frontend)/story/page.tsx
@@ -4,11 +4,13 @@ import { headers as nextHeaders } from "next/headers";
import { RichText } from "@payloadcms/richtext-lexical/react";
import type { StoryBeat, StoryBeatState, StoryVoiceover } from "@/payload-types";
import { isPayloadUser } from "@/utils/access-control/isPayloadUser";
+import hasRoles from "@/utils/access-control/hasRoles";
import { cn } from "@/lib/utils";
import { BEAT_BODY_CLASSES } from "@/lib/story/richtextClasses";
import { BeatReactions } from "@/components/frontend/story/BeatReactions";
import { BeatReadMarker } from "@/components/frontend/story/BeatReadMarker";
import { BeatVoiceover } from "@/components/frontend/story/BeatVoiceover";
+import { DraftBadge } from "@/components/frontend/story/DraftBadge";
import { BookView } from "@/components/frontend/story/BookView";
import { StoryViewer, type StoryViewerBeat } from "@/components/frontend/story/StoryViewer";
import { StoryTableOfContents } from "@/components/frontend/story/StoryTableOfContents";
@@ -43,9 +45,14 @@ export default async function StoryPage() {
if (!isPayloadUser(user)) return null;
+ // Story staff (admin/developer) preview drafts on /story; everyone else sees
+ // published entries only. The collection's own read access is the backstop:
+ // overrideAccess stays false, so a non-staff request can never leak a draft.
+ const isStaff = hasRoles(["admin", "developer"], user);
+
const beatsResult = await payload.find({
collection: "story-beats",
- where: { status: { equals: "published" } },
+ ...(isStaff ? {} : { where: { status: { equals: "published" } } }),
limit: 200,
depth: 1,
overrideAccess: false,
@@ -98,6 +105,7 @@ export default async function StoryPage() {
initialRead: Boolean(stateByBeat.get(beat.id)?.readAt),
voiceoverUrl: voiceoverDoc(beat)?.url ?? null,
voiceoverAiGenerated: voiceoverDoc(beat)?.aiGenerated ?? false,
+ draft: beat.status !== "published",
}));
return (
@@ -108,9 +116,9 @@ export default async function StoryPage() {
The Unit Chronicle
- Story Chronicle
+ The Chronicle
- Every operation leaves a mark. These are the beats of our story, told in order.
+ Every operation leaves a mark. These are the entries of our chronicle, told in order.
{displayBeats.length > 0 && (
@@ -122,12 +130,13 @@ export default async function StoryPage() {
{displayBeats.length === 0 ? (
- No published chapters yet. Check back soon.
+ No chronicle entries to show yet. Check back soon.
) : (
{displayBeats.map((beat) => {
const state = stateByBeat.get(beat.id);
+ const isDraft = beat.status !== "published";
const mission =
beat.mission && typeof beat.mission !== "number" ? beat.mission : null;
const missionLabel = mission
@@ -149,7 +158,11 @@ export default async function StoryPage() {
Chapter {chapterById.get(beat.id) ?? 0}
-
+ {isDraft ? (
+
+ ) : (
+
+ )}
{beat.title}
@@ -174,11 +187,13 @@ export default async function StoryPage() {
-
+ {!isDraft && (
+
+ )}
);
})}
diff --git a/src/components/frontend/story/BookView.tsx b/src/components/frontend/story/BookView.tsx
index 570e444d..16d342e3 100644
--- a/src/components/frontend/story/BookView.tsx
+++ b/src/components/frontend/story/BookView.tsx
@@ -6,6 +6,7 @@ import { RichText } from "@payloadcms/richtext-lexical/react";
import { Button } from "@/components/ui/button";
import { BeatReadMarker } from "@/components/frontend/story/BeatReadMarker";
import { BeatVoiceover } from "@/components/frontend/story/BeatVoiceover";
+import { DraftBadge } from "@/components/frontend/story/DraftBadge";
import type { StoryViewerBeat } from "@/components/frontend/story/StoryViewer";
import {
BOOK_COLUMN_GAP,
@@ -258,7 +259,11 @@ export function BookView({ beats }: { readonly beats: readonly StoryViewerBeat[]
Chapter {beat.chapter}
-
+ {beat.draft ? (
+
+ ) : (
+
+ )}
diff --git a/src/components/frontend/story/DraftBadge.tsx b/src/components/frontend/story/DraftBadge.tsx
new file mode 100644
index 00000000..3b400109
--- /dev/null
+++ b/src/components/frontend/story/DraftBadge.tsx
@@ -0,0 +1,18 @@
+import { cn } from "@/lib/utils";
+
+/**
+ * Amber "Draft" pill marking a chronicle entry that is not yet published.
+ * Shown only to story staff, who can preview drafts on /story.
+ */
+export function DraftBadge({ className }: { className?: string }) {
+ return (
+
+ Draft
+
+ );
+}
diff --git a/src/components/frontend/story/StoryTableOfContents.tsx b/src/components/frontend/story/StoryTableOfContents.tsx
index 8dd3ba9e..6a384626 100644
--- a/src/components/frontend/story/StoryTableOfContents.tsx
+++ b/src/components/frontend/story/StoryTableOfContents.tsx
@@ -3,11 +3,12 @@
import { useEffect, useState } from "react";
import { Headphones } from "lucide-react";
import type { StoryViewerBeat } from "@/components/frontend/story/StoryViewer";
+import { DraftBadge } from "@/components/frontend/story/DraftBadge";
import { cn } from "@/lib/utils";
export type StoryTableOfContentsBeat = Pick<
StoryViewerBeat,
- "id" | "title" | "chapter" | "initialRead" | "voiceoverUrl"
+ "id" | "title" | "chapter" | "initialRead" | "voiceoverUrl" | "draft"
>;
export function StoryTableOfContents({
@@ -79,7 +80,7 @@ export function StoryTableOfContents({
{beats.map((beat) => {
const active = activeBeatId === beat.id;
- const readLabel = beat.initialRead ? "Read" : "Unread";
+ const readLabel = beat.draft ? "Draft" : beat.initialRead ? "Read" : "Unread";
const ariaLabel = beat.voiceoverUrl
? `Chapter ${beat.chapter}: ${beat.title}. ${readLabel}. Has audio.`
: `Chapter ${beat.chapter}: ${beat.title}. ${readLabel}.`;
@@ -115,13 +116,17 @@ export function StoryTableOfContents({
className="mt-1.5 size-3 shrink-0 text-muted-foreground"
/>
)}
-
+ {beat.draft ? (
+
+ ) : (
+
+ )}
);
diff --git a/src/components/frontend/story/StoryViewer.tsx b/src/components/frontend/story/StoryViewer.tsx
index 6744e653..bfa61b32 100644
--- a/src/components/frontend/story/StoryViewer.tsx
+++ b/src/components/frontend/story/StoryViewer.tsx
@@ -6,6 +6,7 @@ import { RichText } from "@payloadcms/richtext-lexical/react";
import { Button } from "@/components/ui/button";
import { BeatReadMarker } from "@/components/frontend/story/BeatReadMarker";
import { BeatVoiceover } from "@/components/frontend/story/BeatVoiceover";
+import { DraftBadge } from "@/components/frontend/story/DraftBadge";
import type { StoryBeat } from "@/payload-types";
import { cn } from "@/lib/utils";
import { READER_BODY_CLASSES } from "@/lib/story/richtextClasses";
@@ -19,6 +20,8 @@ export type StoryViewerBeat = {
readonly initialRead: boolean;
readonly voiceoverUrl: string | null;
readonly voiceoverAiGenerated: boolean;
+ /** True when the entry is still a draft (visible only to story staff). */
+ readonly draft: boolean;
};
export function StoryViewer({ beats }: { readonly beats: readonly StoryViewerBeat[] }) {
@@ -94,9 +97,13 @@ export function StoryViewer({ beats }: { readonly beats: readonly StoryViewerBea
Chapter {beat.chapter}
-
-
-
+ {beat.draft ? (
+
+ ) : (
+
+
+
+ )}
{beat.title}