bac525ddd0
Deploy / deploy (push) Successful in 7m28s
Two small board additions. The shot version now shows next to the shot code. It is Shot.shotVersion — the value the AE panel burns into overlays and queueExport renders under, and the one the shot detail page edits — not a count of uploaded review Versions, so the board agrees with what the artist has in the panel. Shot.isScaled records that a shot is scaled in the edit: the plate is not used at its native size, which changes how the shot is comped and reviewed. That makes it a standing property of the shot rather than something buried in the notes, so it is flagged the way isKeyShot is — a cyan pill next to the shot name, and a Scaled toggle column beside Key. toggleScaledShot() (actions/shots.ts) mirrors toggleKeyShot, same roles. KeyShotToggle's switch markup would have been duplicated verbatim for the second flag, so both now sit on a shared FlagToggle taking a colour tone and a setter. The key-shot switch behaves exactly as before, optimistic update and rollback included. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
84 lines
2.3 KiB
TypeScript
84 lines
2.3 KiB
TypeScript
import { db } from "@/lib/db";
|
|
import { auth } from "@/auth";
|
|
import { redirect } from "next/navigation";
|
|
import { ShotStatusClient } from "./ShotStatusClient";
|
|
|
|
async function getProjects() {
|
|
return db.project.findMany({
|
|
where: { status: { in: ["ACTIVE", "ON_HOLD"] } },
|
|
select: { id: true, name: true, code: true, projectType: true },
|
|
orderBy: { name: "asc" },
|
|
});
|
|
}
|
|
|
|
async function getEpisodeDueDatesForProject(projectId: string) {
|
|
return db.episodeDueDate.findMany({
|
|
where: { projectId },
|
|
select: { episode: true, dueDate: true },
|
|
orderBy: { episode: "asc" },
|
|
});
|
|
}
|
|
|
|
async function getShotsForProject(projectId: string) {
|
|
return db.shot.findMany({
|
|
where: { projectId },
|
|
orderBy: [
|
|
{ episode: { sort: "asc", nulls: "last" } },
|
|
{ scene: "asc" },
|
|
{ shotNumber: "asc" },
|
|
],
|
|
select: {
|
|
id: true,
|
|
shotCode: true,
|
|
scene: true,
|
|
episode: true,
|
|
shotNumber: true,
|
|
status: true,
|
|
priority: true,
|
|
dueDate: true,
|
|
thumbnailUrl: true,
|
|
generatedThumbnailUrl: true,
|
|
notes: true,
|
|
description: true,
|
|
isKeyShot: true,
|
|
isScaled: true,
|
|
// The shot-level version the panel burns into overlays and queueExport
|
|
// renders under — not the count of review Versions uploaded.
|
|
shotVersion: true,
|
|
artist: { select: { id: true, name: true, image: true, email: true } },
|
|
shotGroup: { select: { id: true, name: true } },
|
|
},
|
|
});
|
|
}
|
|
|
|
export default async function ShotStatusPage({
|
|
searchParams,
|
|
}: {
|
|
searchParams: Promise<{ projectId?: string }>;
|
|
}) {
|
|
const session = await auth();
|
|
if (!session?.user) redirect("/login");
|
|
|
|
const { projectId } = await searchParams;
|
|
const canManage = ["ADMIN", "PRODUCER", "SUPERVISOR"].includes(session.user.role);
|
|
|
|
const [projects, shots, episodeDueDates] = await Promise.all([
|
|
getProjects(),
|
|
projectId ? getShotsForProject(projectId) : Promise.resolve([]),
|
|
projectId ? getEpisodeDueDatesForProject(projectId) : Promise.resolve([]),
|
|
]);
|
|
|
|
const selectedProject = projects.find((p) => p.id === projectId) ?? null;
|
|
|
|
return (
|
|
<ShotStatusClient
|
|
projects={projects}
|
|
selectedProjectId={projectId ?? null}
|
|
selectedProject={selectedProject}
|
|
shots={shots as any}
|
|
episodeDueDates={episodeDueDates}
|
|
canManage={canManage}
|
|
/>
|
|
);
|
|
}
|