bada122f42
Deploy / deploy (push) Successful in 7m4s
Initialise Workspace built UNG_101..UNG_117 from a hardcoded range and
imported one hardcoded AEP, and fourteen findComp calls named UNG's comps
literally. None of it worked for a second show.
Comp names now follow a convention derived from the show id —
{showId}_VFX_OVERLAY, {showId}_EXPORT_TEMPLATE, _SHOW LUT — which
reproduces UNG's existing names exactly, so nothing changes for the show
it was written for. A project whose template departs from the pattern can
override any of the three.
Paths cannot be derived: UNG's show id is UNG while its folder is
UNGO_VFX. Those live on Project.pipelineConfig and are edited under
Project → Settings → Pipeline. They are resolved server-side and handed
to the panel with the project list, and read by buildPreviewManifest for
the headless build, so the panel and the farm cannot disagree about which
template — or which show LUT — a shot was built with. That mattered more
than the folder names: a preview rendered through another show's LUT is
quietly the wrong colour rather than obviously broken.
Episode folders come from the project's episode list, falling back to the
folders under its footage root for a show whose episodes are not entered
yet.
Panel 2.5.0. Adds migration 20260814010000_project_pipeline_config.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
225 lines
8.0 KiB
TypeScript
225 lines
8.0 KiB
TypeScript
import { notFound } from "next/navigation";
|
|
import Link from "next/link";
|
|
import { db } from "@/lib/db";
|
|
import { auth } from "@/auth";
|
|
import { Badge } from "@/components/ui/badge";
|
|
import { ProjectTabsClient } from "./ProjectTabsClient";
|
|
import {
|
|
Film,
|
|
Layers,
|
|
CheckCircle2,
|
|
ListTodo,
|
|
} from "lucide-react";
|
|
|
|
export async function generateMetadata({ params }: { params: Promise<{ id: string }> }) {
|
|
const { id } = await params;
|
|
const project = await db.project.findUnique({ where: { id }, select: { name: true } });
|
|
return { title: project?.name ?? "Project" };
|
|
}
|
|
|
|
async function getProject(id: string) {
|
|
return db.project.findUnique({
|
|
where: { id },
|
|
include: {
|
|
client: true,
|
|
producer: { select: { id: true, name: true, image: true, email: true } },
|
|
supervisor: { select: { id: true, name: true, image: true, email: true } },
|
|
shots: {
|
|
orderBy: { createdAt: "asc" },
|
|
include: {
|
|
artist: { select: { id: true, name: true, image: true, email: true } },
|
|
shotGroup: { select: { id: true, name: true } },
|
|
versions: {
|
|
take: 1,
|
|
orderBy: { versionNumber: "desc" },
|
|
include: {
|
|
comments: { select: { id: true, isResolved: true } },
|
|
},
|
|
},
|
|
},
|
|
},
|
|
assets: {
|
|
orderBy: { assetCode: "asc" },
|
|
include: {
|
|
lead: { select: { id: true, name: true, email: true, image: true } },
|
|
_count: { select: { tasks: true } },
|
|
tasks: {
|
|
orderBy: { sortOrder: "asc" },
|
|
include: {
|
|
assignedArtist: { select: { id: true, name: true, email: true, image: true } },
|
|
_count: { select: { versions: true } },
|
|
versions: {
|
|
take: 1,
|
|
orderBy: { versionNumber: "desc" },
|
|
select: { id: true, versionNumber: true, approvalStatus: true, createdAt: true },
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
tasks: {
|
|
orderBy: [{ status: "asc" }, { sortOrder: "asc" }],
|
|
include: {
|
|
shot: { select: { id: true, shotCode: true, thumbnailUrl: true } },
|
|
asset: { select: { id: true, assetCode: true, name: true } },
|
|
assignedArtist: { select: { id: true, name: true, email: true, image: true } },
|
|
_count: { select: { versions: true } },
|
|
versions: {
|
|
take: 1,
|
|
orderBy: { versionNumber: "desc" },
|
|
select: { id: true, versionNumber: true, approvalStatus: true, createdAt: true, thumbnailUrl: true, posterUrl: true },
|
|
},
|
|
},
|
|
},
|
|
shotGroups: {
|
|
orderBy: [{ sortOrder: "asc" }, { name: "asc" }],
|
|
select: { id: true, name: true },
|
|
},
|
|
},
|
|
});
|
|
}
|
|
|
|
async function getProjectArtists() {
|
|
return db.user.findMany({
|
|
where: { isActive: true },
|
|
select: { id: true, name: true, email: true },
|
|
orderBy: { name: "asc" },
|
|
});
|
|
}
|
|
|
|
async function getClients() {
|
|
return db.client.findMany({
|
|
where: { isActive: true },
|
|
select: { id: true, company: true },
|
|
orderBy: { company: "asc" },
|
|
});
|
|
}
|
|
|
|
async function getTeamMembers() {
|
|
return db.user.findMany({
|
|
where: { isActive: true, role: { in: ["ADMIN", "PRODUCER", "SUPERVISOR"] } },
|
|
select: { id: true, name: true, email: true, role: true },
|
|
orderBy: { name: "asc" },
|
|
});
|
|
}
|
|
|
|
export default async function ProjectPage({ params }: { params: Promise<{ id: string }> }) {
|
|
const { id } = await params;
|
|
const session = await auth();
|
|
const [project, artists, clients, teamMembers, episodeDueDates] = await Promise.all([
|
|
getProject(id),
|
|
getProjectArtists(),
|
|
getClients(),
|
|
getTeamMembers(),
|
|
db.episodeDueDate.findMany({ where: { projectId: id }, orderBy: { episode: "asc" } }),
|
|
]);
|
|
if (!project) notFound();
|
|
|
|
const canManage = session?.user && ["ADMIN", "PRODUCER", "SUPERVISOR"].includes(session.user.role);
|
|
|
|
const totalShots = project.shots.length;
|
|
const approvedShots = project.shots.filter((s) => s.status === "COMPLETE").length;
|
|
const totalTasks = project.tasks.length;
|
|
const doneTasks = project.tasks.filter((t) => t.status === "DONE").length;
|
|
|
|
return (
|
|
<div className="p-8 space-y-6 max-w-[1600px] mx-auto">
|
|
{/* Breadcrumb */}
|
|
<div className="flex items-center gap-2 text-sm text-zinc-500">
|
|
<Link href="/projects" className="hover:text-white transition-colors">
|
|
Projects
|
|
</Link>
|
|
<span>/</span>
|
|
<span className="text-white">{project.name}</span>
|
|
</div>
|
|
|
|
{/* Header */}
|
|
<div className="flex items-start justify-between gap-4">
|
|
<div>
|
|
<div className="flex items-center gap-3 mb-1">
|
|
<span className="font-mono text-sm text-muted-foreground">{project.code}</span>
|
|
{project.client && (
|
|
<span className="text-sm text-muted-foreground">• {project.client.company}</span>
|
|
)}
|
|
<Badge
|
|
className={
|
|
project.status === "ACTIVE"
|
|
? "bg-emerald-500/10 text-emerald-400 border-emerald-500/20"
|
|
: "bg-zinc-500/10 text-zinc-400"
|
|
}
|
|
>
|
|
{project.status.replace("_", " ")}
|
|
</Badge>
|
|
</div>
|
|
<h1 className="text-3xl font-bold text-white">{project.name}</h1>
|
|
{project.description && (
|
|
<p className="text-zinc-400 mt-1">{project.description}</p>
|
|
)}
|
|
</div>
|
|
</div>
|
|
|
|
{/* Stats row */}
|
|
<div className="grid grid-cols-4 gap-3 max-w-md">
|
|
<div className="flex flex-col items-center rounded-xl border border-zinc-800 bg-zinc-900 py-3">
|
|
<Layers className="h-4 w-4 text-zinc-400 mb-1" />
|
|
<span className="text-xl font-bold text-white">{totalShots}</span>
|
|
<span className="text-xs text-zinc-400">shots</span>
|
|
</div>
|
|
<div className="flex flex-col items-center rounded-xl border border-zinc-800 bg-zinc-900 py-3">
|
|
<CheckCircle2 className="h-4 w-4 text-green-400 mb-1" />
|
|
<span className="text-xl font-bold text-white">{approvedShots}</span>
|
|
<span className="text-xs text-zinc-400">approved</span>
|
|
</div>
|
|
<div className="flex flex-col items-center rounded-xl border border-zinc-800 bg-zinc-900 py-3">
|
|
<ListTodo className="h-4 w-4 text-amber-400 mb-1" />
|
|
<span className="text-xl font-bold text-white">{totalTasks}</span>
|
|
<span className="text-xs text-zinc-400">tasks</span>
|
|
</div>
|
|
<div className="flex flex-col items-center rounded-xl border border-zinc-800 bg-zinc-900 py-3">
|
|
<Film className="h-4 w-4 text-blue-400 mb-1" />
|
|
<span className="text-xl font-bold text-white">{doneTasks}</span>
|
|
<span className="text-xs text-zinc-400">done</span>
|
|
</div>
|
|
</div>
|
|
|
|
{/* Tabs */}
|
|
<ProjectTabsClient
|
|
projectId={id}
|
|
projectType={project.projectType}
|
|
projectSettings={{
|
|
id: project.id,
|
|
name: project.name,
|
|
code: project.code,
|
|
showId: project.showId,
|
|
projectType: project.projectType,
|
|
description: project.description,
|
|
status: project.status,
|
|
clientId: project.clientId,
|
|
producerId: project.producerId,
|
|
supervisorId: project.supervisorId,
|
|
dueDate: project.dueDate,
|
|
startDate: project.startDate,
|
|
slackWebhook: project.slackWebhook,
|
|
slackChannel: project.slackChannel,
|
|
pipelineConfig: project.pipelineConfig as {
|
|
templateAep?: string | null;
|
|
rendersRoot?: string | null;
|
|
overlayComp?: string | null;
|
|
previewComp?: string | null;
|
|
lutComp?: string | null;
|
|
} | null,
|
|
}}
|
|
clients={clients}
|
|
teamMembers={teamMembers}
|
|
shots={project.shots as any}
|
|
assets={project.assets as any}
|
|
tasks={project.tasks as any}
|
|
artists={artists}
|
|
shotGroups={project.shotGroups}
|
|
episodeDueDates={episodeDueDates}
|
|
canManage={!!canManage}
|
|
/>
|
|
</div>
|
|
);
|
|
}
|