diff --git a/.claude/settings.local.json b/.claude/settings.local.json index cce4e2b..9b73261 100644 --- a/.claude/settings.local.json +++ b/.claude/settings.local.json @@ -102,7 +102,8 @@ "Bash(git commit -m 'Fix: Remove encType from product edit form with Server Action *)", "Bash(git commit -m 'Feature: Add file removal and print area edit toggles to photo upload *)", "Bash(git commit -m 'Fix: Show Remove and Modify print area buttons for existing images *)", - "Bash(git commit -m 'Fix: Handle image removal in product editor *)" + "Bash(git commit -m 'Fix: Handle image removal in product editor *)", + "Bash(git commit -m 'Refactor: Move image display into PhotoPrintAreaField component *)" ] } } diff --git a/src/app/admin/products/[id]/edit/page.tsx b/src/app/admin/products/[id]/edit/page.tsx index 098b06e..36bb2ae 100644 --- a/src/app/admin/products/[id]/edit/page.tsx +++ b/src/app/admin/products/[id]/edit/page.tsx @@ -260,27 +260,11 @@ export default async function EditProductPage({ params }: { params: { id: string
- {product.imageUrl && ( -
- {product.name} -

Current photo. Upload a new one below to replace it.

-
- )}
- {product.imageUrlBack && ( -
- {`${product.name} -

Current back photo and print area. Upload a new one below to replace both.

-
- )}
diff --git a/src/components/PhotoPrintAreaField.tsx b/src/components/PhotoPrintAreaField.tsx index 7d076a1..da6f5cc 100644 --- a/src/components/PhotoPrintAreaField.tsx +++ b/src/components/PhotoPrintAreaField.tsx @@ -102,6 +102,14 @@ export default function PhotoPrintAreaField({ return (
+ {currentImageUrl && !showPrintAreaEditor && ( +
+ {/* eslint-disable-next-line @next/next/no-img-element */} + Product preview +

Current photo. Upload a new one below to replace it.

+
+ )} + {!currentImageUrl || !showPrintAreaEditor ? ( <>