feat(deliveries): delivery requests and upload/share evidence
Deploy / deploy (push) Successful in 5m17s

A built package used to become DELIVERED on one click with nothing behind
it, and nothing recorded what a client had asked for.

- Marking delivered is now two recorded steps: Record upload (the link on
  the client's portal, contents confirmed) then Share link (who it was sent
  to). The second is refused until the first is on record.
- Delivery requests log a client's ask by episode, pasted shot codes or a
  Shot Status selection. A line closes only when its shot goes out with
  evidence after the request was logged; a request can otherwise only be
  cancelled with a reason.
- Delivered Outside Pipeline takes an upload link and recipient, required
  for shots on an open request.
- The dashboard gains an Awaiting delivery section listing open requests
  and built packages the client does not have yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
twotalesanimation
2026-09-30 14:21:24 +02:00
parent 326d8cbefa
commit f30acef101
25 changed files with 2241 additions and 52 deletions
@@ -35,6 +35,7 @@ import { cn, getInitials } from "@/lib/utils";
import { updateShotNotes, bulkUpdateDueDates, bulkAssignArtist, bulkDeleteShots, bulkSetManualDelivery, toggleKeyShot, toggleScaledShot } from "@/actions/shots";
import { previewMovReview, buildMovReview } from "@/actions/deliveries";
import { useToast } from "@/components/ui/use-toast";
import { LogRequestDialog } from "@/components/delivery/LogRequestDialog";
import {
Film,
Clock,
@@ -55,6 +56,7 @@ import {
Scaling,
UserPlus,
PackageCheck,
ClipboardList,
} from "lucide-react";
import { format } from "date-fns";
import { shotThumbnail } from "@/lib/shot-thumbnail";
@@ -373,11 +375,17 @@ function ManualDeliveryDialog({
}: {
open: boolean;
onClose: () => void;
onApply: (deliveredOn: string | null, note: string) => Promise<void>;
onApply: (
deliveredOn: string | null,
note: string,
evidence: { uploadUrl: string; sharedWith: string },
) => Promise<void>;
count: number;
}) {
const [date, setDate] = useState("");
const [note, setNote] = useState("");
const [uploadUrl, setUploadUrl] = useState("");
const [sharedWith, setSharedWith] = useState("");
const [clearing, setClearing] = useState(false);
const [isPending, startTransition] = useTransition();
@@ -385,6 +393,8 @@ function ManualDeliveryDialog({
if (open) {
setDate("");
setNote("");
setUploadUrl("");
setSharedWith("");
setClearing(false);
}
}, [open]);
@@ -392,7 +402,7 @@ function ManualDeliveryDialog({
const handleApply = () => {
if (!clearing && !date) return;
startTransition(async () => {
await onApply(clearing ? null : date, note);
await onApply(clearing ? null : date, note, { uploadUrl, sharedWith });
});
};
@@ -444,6 +454,30 @@ function ManualDeliveryDialog({
className="w-full rounded-md border border-zinc-700 bg-zinc-900 px-3 py-2 text-sm text-zinc-100 [color-scheme:dark] focus:border-zinc-500 focus:outline-none focus:ring-1 focus:ring-zinc-500"
/>
</div>
<div className="space-y-1.5">
<label className="text-xs font-medium text-zinc-400">Upload link</label>
<input
type="url"
value={uploadUrl}
onChange={(e) => setUploadUrl(e.target.value)}
placeholder="https://…"
className="w-full rounded-md border border-zinc-700 bg-zinc-900 px-3 py-2 text-sm text-zinc-100 placeholder:text-zinc-600 focus:border-zinc-500 focus:outline-none focus:ring-1 focus:ring-zinc-500"
/>
</div>
<div className="space-y-1.5">
<label className="text-xs font-medium text-zinc-400">Link sent to</label>
<input
type="text"
value={sharedWith}
onChange={(e) => setSharedWith(e.target.value)}
placeholder="Name, and where it was sent"
className="w-full rounded-md border border-zinc-700 bg-zinc-900 px-3 py-2 text-sm text-zinc-100 placeholder:text-zinc-600 focus:border-zinc-500 focus:outline-none focus:ring-1 focus:ring-zinc-500"
/>
<p className="text-xs text-zinc-500">
Both are needed for shots on an open delivery request; a backfill of old deliveries can leave
them blank.
</p>
</div>
<div className="space-y-1.5">
<label className="text-xs font-medium text-zinc-400">Note (optional)</label>
<Textarea
@@ -1086,6 +1120,7 @@ export function ShotStatusClient({
const [deleteDialogOpen, setDeleteDialogOpen] = useState(false);
const [movReviewDialogOpen, setMovReviewDialogOpen] = useState(false);
const [manualDeliveryDialogOpen, setManualDeliveryDialogOpen] = useState(false);
const [requestDialogOpen, setRequestDialogOpen] = useState(false);
const toggleEpisode = (ep: string) =>
setExpandedEpisodes((prev) => {
@@ -1185,10 +1220,19 @@ export function ShotStatusClient({
}
};
const handleManualDelivery = async (deliveredOn: string | null, note: string) => {
const handleManualDelivery = async (
deliveredOn: string | null,
note: string,
evidence: { uploadUrl: string; sharedWith: string },
) => {
try {
const result = await bulkSetManualDelivery([...selectedIds], deliveredOn, note);
const n = `${result.updated} shot${result.updated !== 1 ? "s" : ""}`;
const result = await bulkSetManualDelivery([...selectedIds], deliveredOn, note, evidence);
if (!result.success) {
// The dialog stays open so the missing link and recipient can be added.
toast({ title: "Not marked delivered", description: result.error, variant: "destructive" });
return;
}
const n =`${result.updated} shot${result.updated !== 1 ? "s" : ""}`;
toast({ title: deliveredOn ? `${n} marked delivered` : `Manual delivery cleared on ${n}` });
setManualDeliveryDialogOpen(false);
clearSelection();
@@ -1384,6 +1428,10 @@ export function ShotStatusClient({
<Clapperboard className="h-3.5 w-3.5 mr-2" />
Build MOV Review Package
</DropdownMenuItem>
<DropdownMenuItem onClick={() => setRequestDialogOpen(true)}>
<ClipboardList className="h-3.5 w-3.5 mr-2" />
Log Delivery Request
</DropdownMenuItem>
<DropdownMenuItem onClick={() => setManualDeliveryDialogOpen(true)}>
<PackageCheck className="h-3.5 w-3.5 mr-2" />
Delivered Outside Pipeline
@@ -1610,6 +1658,16 @@ export function ShotStatusClient({
count={selectionCount}
/>
{/* A client asked for the selected shots */}
{selectedProjectId && (
<LogRequestDialog
open={requestDialogOpen}
onClose={() => setRequestDialogOpen(false)}
onLogged={clearSelection}
preset={{ projectId: selectedProjectId, shotIds: [...selectedIds] }}
/>
)}
{/* Bulk delete dialog */}
<BulkDeleteDialog
open={deleteDialogOpen}