Session A measured 159 targets under the WCAG 2.5.8 minimum on 42 routes; this brings that to zero. Mostly one-line spacing changes: small caption labels and text links were 14-21px tall because shadcn Label/Button use leading-none and bare text links carry no vertical padding. - shared Dialog close button: p-1 with right-3/top-3 so the 24px hit box keeps the icon where it was - tour card: Skip all tours (13 routes), All boards on standings cards (6) - detail pages: 27 Back links, journals All journals, wiki category links, voiceover card titles, factions batch link - dashboard: 7 View all / View full record links - account preferences: mute rows min-h-6, radio and tours labels, plus contacts filter labels and the campaigns show-completed label - ribbon studio: mirror label and stripe/module remove buttons - helpdesk ticket titles, radio tick-sound label
96 lines
3.8 KiB
TypeScript
96 lines
3.8 KiB
TypeScript
import type { Metadata } from "next";
|
|
import config from "@payload-config";
|
|
import { getPayload } from "payload";
|
|
import { headers as nextHeaders } from "next/headers";
|
|
import Link from "next/link";
|
|
import { notFound, redirect } from "next/navigation";
|
|
import { ArrowLeftIcon, EyeOffIcon, MicIcon, TriangleAlertIcon } from "lucide-react";
|
|
|
|
import { Card, CardContent } from "@/components/ui/card";
|
|
import { VoiceoverRecorder } from "@/components/frontend/voiceover/VoiceoverRecorder";
|
|
import { SpoilerDescription, SpoilerGate } from "@/components/frontend/voiceover/SpoilerGate";
|
|
import { getScriptForUser } from "@/lib/voiceover";
|
|
import { isPayloadUser } from "@/utils/access-control/isPayloadUser";
|
|
|
|
export const metadata: Metadata = {
|
|
title: "Record voiceover: Polaris Task Force",
|
|
description: "Read a Polaris Task Force voiceover script and submit a recording.",
|
|
};
|
|
|
|
export default async function VoiceoverScriptPage({
|
|
params,
|
|
}: {
|
|
readonly params: Promise<{ id: string }>;
|
|
}) {
|
|
const { id } = await params;
|
|
const scriptId = Number(id);
|
|
if (!Number.isInteger(scriptId) || scriptId < 1) notFound();
|
|
|
|
const headers = await nextHeaders();
|
|
const payloadConfig = await config;
|
|
const payload = await getPayload({ config: payloadConfig });
|
|
const { user } = await payload.auth({ headers, canSetHeaders: false });
|
|
|
|
if (!isPayloadUser(user)) {
|
|
redirect(`/login?returnTo=${encodeURIComponent(`/voiceover/${id}`)}`);
|
|
}
|
|
|
|
const script = await getScriptForUser(payload, user, scriptId);
|
|
if (!script) notFound();
|
|
|
|
return (
|
|
<SpoilerGate spoiler={script.spoiler}>
|
|
<div className="flex min-w-0 flex-col gap-6 p-5">
|
|
<Link
|
|
href="/voiceover"
|
|
className="flex w-fit items-center gap-1 py-1 text-sm text-muted-foreground transition-colors hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
|
|
>
|
|
<ArrowLeftIcon className="size-3" />
|
|
Voiceover scripts
|
|
</Link>
|
|
|
|
<div className="flex items-start gap-3">
|
|
<MicIcon className="mt-0.5 size-5 shrink-0 text-muted-foreground" />
|
|
<div className="flex min-w-0 flex-col gap-1">
|
|
<h1 className="text-lg font-semibold">{script.title}</h1>
|
|
<SpoilerDescription spoiler={script.spoiler} description={script.description} />
|
|
<p className="text-sm text-muted-foreground">
|
|
Read the script at your pace, then submit one clear take for review.
|
|
</p>
|
|
</div>
|
|
</div>
|
|
|
|
{script.status === "draft" && (
|
|
<Card className="border-dashed border-violet-500/50">
|
|
<CardContent className="flex items-start gap-3 p-4 text-sm">
|
|
<EyeOffIcon className="mt-0.5 size-4 shrink-0 text-violet-300" />
|
|
<div className="flex flex-col gap-1">
|
|
<p className="font-medium text-violet-300">Draft preview</p>
|
|
<p className="text-muted-foreground">
|
|
This script is still a draft and is hidden from other users.
|
|
</p>
|
|
</div>
|
|
</CardContent>
|
|
</Card>
|
|
)}
|
|
|
|
{script.spoiler && (
|
|
<Card className="border-amber-500/40">
|
|
<CardContent className="flex items-start gap-3 p-4 text-sm">
|
|
<TriangleAlertIcon className="mt-0.5 size-4 shrink-0 text-amber-400" />
|
|
<div className="flex flex-col gap-1">
|
|
<p className="font-medium text-amber-300">Potential campaign spoilers ahead</p>
|
|
<p className="text-muted-foreground">
|
|
This script may include, infer, or otherwise expose campaign spoilers. Read on
|
|
only if you are comfortable with that.
|
|
</p>
|
|
</div>
|
|
</CardContent>
|
|
</Card>
|
|
)}
|
|
|
|
<VoiceoverRecorder script={script} />
|
|
</div>
|
|
</SpoilerGate>
|
|
);
|
|
}
|