From 45459e4b127477aabb6527d2bfa0eb13f79cc53e Mon Sep 17 00:00:00 2001 From: twotalesanimation <80506065+twotalesanimation@users.noreply.github.com> Date: Fri, 18 Sep 2026 09:24:42 +0200 Subject: [PATCH] fix(review): Share with Client in the player shares the shot The review player's button only made the viewed version client-visible. It never set shot.sharedWithClient, and the client portal lists only shared shots (and only each task's latest version), so the button reported "Shared with Client" while the client saw nothing. It also skipped the internal approval the shot page requires. For a version that belongs to a shot (directly or through its task), the button now runs the shot page's shareWithClient: shot marked shared, latest version of each task visible, status to Client Review. It is disabled with an explanation until the shot is internally approved, and the player's Approve Internally button now appears for task versions too, only while the shot awaits approval. Asset versions keep the per-version share. Co-Authored-By: Claude Opus 5 --- app/review/[versionId]/ReviewPageClient.tsx | 17 +++++-- app/review/[versionId]/page.tsx | 2 +- components/versions/ShareWithClientButton.tsx | 45 +++++++++++++++---- 3 files changed, 51 insertions(+), 13 deletions(-) diff --git a/app/review/[versionId]/ReviewPageClient.tsx b/app/review/[versionId]/ReviewPageClient.tsx index a153cc5..85283f0 100644 --- a/app/review/[versionId]/ReviewPageClient.tsx +++ b/app/review/[versionId]/ReviewPageClient.tsx @@ -56,6 +56,8 @@ interface ReviewPageClientProps { shot?: { id: string; shotCode: string; + shotApprovalStatus: string; + sharedWithClient: boolean; project: { id: string; name: string; code: string }; versions: { id: string; @@ -73,7 +75,7 @@ interface ReviewPageClientProps { id: string; title: string; project: { id: string; name: string; code: string }; - shot?: { id: string; shotCode: string } | null; + shot?: { id: string; shotCode: string; shotApprovalStatus: string; sharedWithClient: boolean } | null; asset?: { id: string; assetCode: string; name: string } | null; versions: { id: string; @@ -127,6 +129,11 @@ export function ReviewPageClient({ const [commentsOpen, setCommentsOpen] = useState(true); const playerRef = useRef(null); + + // The shot this version belongs to, directly or through its task. Approval + // and client sharing are shot-level: the client portal only lists shots + // marked sharedWithClient, so sharing has to go through the shot. + const reviewShot = version.shot ?? version.task?.shot ?? null; const { toast } = useToast(); const router = useRouter(); @@ -194,7 +201,7 @@ export function ReviewPageClient({ }; const handleInternalApprove = async () => { - const shotId = version.shot?.id; + const shotId = reviewShot?.id; if (!shotId) return; setIsInternallyApproving(true); try { @@ -295,7 +302,8 @@ export function ReviewPageClient({ {/* router.refresh() handled inside component */}} + shot={reviewShot} + onShared={() => router.refresh()} /> )} @@ -320,7 +328,8 @@ export function ReviewPageClient({ Reject - {version.shot?.id && ( + {/* Same rule as the shot page: only while the shot awaits internal approval. */} + {reviewShot?.shotApprovalStatus === "PENDING" && ( ); + + // A disabled button takes no pointer events, so the explanation sits on a wrapper. + return needsApproval ? ( + + {button} + + ) : ( + button + ); }