Capture canvas preview when admin sends design to customer

Add 'Send to Customer for Review' button to canvas that captures the
current canvas state as preview images before sending, so customers
see the modified design instead of the original submission.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
Andymick
2026-07-18 19:19:38 +01:00
co-authored by Claude Haiku 4.5
parent b97d015cd1
commit 87b269e57c
3 changed files with 76 additions and 16 deletions
@@ -7,6 +7,8 @@ export async function POST(
{ params }: { params: { id: string } }
) {
try {
const { designPreviewUrl, designPreviewUrlBack, placementPreviewUrl, placementPreviewUrlBack } = await req.json().catch(() => ({}));
const design = await prisma.designApproval.findUnique({
where: { id: params.id },
include: { product: true },
@@ -16,10 +18,16 @@ export async function POST(
return NextResponse.json({ error: 'Design not found' }, { status: 404 });
}
// Update status to IN_REVIEW
// Update status to IN_REVIEW and save new preview if provided
const updateData: any = { status: 'IN_REVIEW' };
if (designPreviewUrl) updateData.designPreviewUrl = designPreviewUrl;
if (designPreviewUrlBack) updateData.designPreviewUrlBack = designPreviewUrlBack;
if (placementPreviewUrl) updateData.placementPreviewUrl = placementPreviewUrl;
if (placementPreviewUrlBack) updateData.placementPreviewUrlBack = placementPreviewUrlBack;
const updated = await prisma.designApproval.update({
where: { id: params.id },
data: { status: 'IN_REVIEW' },
data: updateData,
include: { product: true, messages: { orderBy: { createdAt: 'asc' } } },
});