@@ -54,6 +54,10 @@ interface Version {
|
||||
duration: number | null;
|
||||
approvalStatus: string;
|
||||
notes: string | null;
|
||||
// Top-level high-res flags (normalised from either shot or task.shot)
|
||||
hasHighRes?: boolean;
|
||||
highResShotId?: string | null;
|
||||
highResFilename?: string | null;
|
||||
shot?: {
|
||||
id: string;
|
||||
shotCode: string;
|
||||
@@ -66,7 +70,7 @@ interface Version {
|
||||
title: string;
|
||||
type: string;
|
||||
project: { id: string; name: string; code: string };
|
||||
shot?: { shotCode: string } | null;
|
||||
shot?: { id: string; shotCode: string } | null;
|
||||
asset?: { assetCode: string; name: string } | null;
|
||||
} | null;
|
||||
}
|
||||
@@ -205,10 +209,11 @@ export default function ClientReviewPage({
|
||||
};
|
||||
|
||||
const handleDownloadHighRes = async () => {
|
||||
if (!version?.shot?.id || !token) return;
|
||||
const shotId = version?.highResShotId ?? version?.shot?.id;
|
||||
if (!shotId || !token) return;
|
||||
setDownloadingHighRes(true);
|
||||
try {
|
||||
const res = await fetch(`/api/client/${token}/shots/${version.shot.id}/highres/download`);
|
||||
const res = await fetch(`/api/client/${token}/shots/${shotId}/highres/download`);
|
||||
if (!res.ok) throw new Error("Could not get download link");
|
||||
const { url } = await res.json();
|
||||
// Open the presigned URL — the Content-Disposition header forces a download
|
||||
@@ -384,14 +389,14 @@ export default function ClientReviewPage({
|
||||
<CheckCircle2 className="h-3.5 w-3.5" />
|
||||
Approve
|
||||
</Button>
|
||||
{version.shot?.hasHighRes && (
|
||||
{(version.hasHighRes || version.shot?.hasHighRes) && (
|
||||
<Button
|
||||
size="sm"
|
||||
variant="outline"
|
||||
className="h-8 text-xs gap-1 text-sky-400 border-sky-500/30 hover:bg-sky-500/10"
|
||||
disabled={downloadingHighRes}
|
||||
onClick={handleDownloadHighRes}
|
||||
title={version.shot.highResFilename ?? "Download high-res file"}
|
||||
title={version.highResFilename ?? version.shot?.highResFilename ?? "Download high-res file"}
|
||||
>
|
||||
<Download className="h-3.5 w-3.5" />
|
||||
<span className="hidden sm:inline">{downloadingHighRes ? "Getting link…" : "High Res"}</span>
|
||||
|
||||
Reference in New Issue
Block a user