feat(dashboard): episode delivery countdown

Turns "23 shots to go" into "you are not going to make it". One card per
episode from EpisodeDueDate (or the project's own date on a standard show):
days left, the episode's shots by where they actually are, and the only
comparison that matters - shots per day still needed against shots per day
the studio managed over the last week.

A shot counts as delivered when it appears in a DeliveryItem inside a
DELIVERED EXR_DELIVERY package. Shot.status is deliberately not the measure:
it says where the work is, not whether the client has the frames, and a
MOV_REVIEW package ships nothing.

The pace arithmetic is a pure function so the sentence a producer acts on is
testable: a rate that only just lands on the due date reports as "no slack"
rather than fine, and a week with no deliveries reports as stalled instead of
projecting infinity.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
twotalesanimation
2026-09-10 05:45:01 +02:00
parent f6a7f0ef5a
commit 6bfc013e35
4 changed files with 423 additions and 6 deletions
+40 -5
View File
@@ -3,10 +3,16 @@ import { db } from "@/lib/db";
import { StatsCards } from "@/components/dashboard/StatsCards";
import { BlockedQueue } from "@/components/dashboard/BlockedQueue";
import { FarmStrip } from "@/components/dashboard/FarmStrip";
import { DeliveryCountdown } from "@/components/dashboard/DeliveryCountdown";
import { ShotQueue } from "@/components/dashboard/ShotQueue";
import { TaskWidgets } from "@/components/dashboard/TaskWidgets";
import { ScheduleWidgets } from "@/components/dashboard/ScheduleWidgets";
import { getBlockedExports, getFarmStatus, getOpsCounts } from "@/lib/dashboard/ops";
import {
getBlockedExports,
getDeliveryCountdown,
getFarmStatus,
getOpsCounts,
} from "@/lib/dashboard/ops";
import type { DashboardStats } from "@/types";
export const metadata = { title: "Dashboard" };
@@ -23,10 +29,11 @@ async function getDashboardData(userId: string, role: string) {
const isArtist = role === "ARTIST";
const isClient = role === "CLIENT";
const [counts, blocked, farm] = await Promise.all([
const [counts, blocked, farm, episodes] = await Promise.all([
getOpsCounts(),
getBlockedExports(),
getFarmStatus(),
getDeliveryCountdown(),
]);
// An artist's own shots come first; everyone else sees the floor.
@@ -100,7 +107,17 @@ async function getDashboardData(userId: string, role: string) {
const stats: DashboardStats = counts;
return { stats, blocked, farm, shots, myTasks, reviewTasks, scheduledTasks, scheduleArtists };
return {
stats,
blocked,
farm,
episodes,
shots,
myTasks,
reviewTasks,
scheduledTasks,
scheduleArtists,
};
}
export default async function DashboardPage() {
@@ -109,8 +126,17 @@ export default async function DashboardPage() {
const isClient = session.user.role === "CLIENT";
const canSeeSchedule = ["ADMIN", "PRODUCER", "SUPERVISOR"].includes(session.user.role);
const { stats, blocked, farm, shots, myTasks, reviewTasks, scheduledTasks, scheduleArtists } =
await getDashboardData(session.user.id, session.user.role);
const {
stats,
blocked,
farm,
episodes,
shots,
myTasks,
reviewTasks,
scheduledTasks,
scheduleArtists,
} = await getDashboardData(session.user.id, session.user.role);
return (
<div className="p-8 space-y-6 max-w-[1600px] mx-auto">
@@ -123,6 +149,15 @@ export default async function DashboardPage() {
{!isClient && <StatsCards stats={stats} />}
{!isClient && (
<div className="space-y-3">
<h2 className="text-sm font-semibold text-muted-foreground uppercase tracking-wide">
Delivery countdown
</h2>
<DeliveryCountdown episodes={episodes} />
</div>
)}
{!isClient && (
<div id="blocked" className="grid grid-cols-1 xl:grid-cols-3 gap-6 items-start scroll-mt-6">
<div className="xl:col-span-2 space-y-3">