fix: enforce max screenshot limit (2) on upload area and existing remove button

This commit is contained in:
2026-05-16 19:13:16 +08:00
parent f4eab9c8e0
commit 88a098f387
+5 -1
View File
@@ -290,10 +290,12 @@ export function ReviewStep({
return opt?.label ?? environment.frameGenMethod return opt?.label ?? environment.frameGenMethod
})() })()
const totalScreenshots = (existingScreenshots?.length ?? 0) + (screenshotFiles?.length ?? 0)
const canUploadMore = const canUploadMore =
(!screenshotFiles || screenshotFiles.length < 2) && totalScreenshots < 2 &&
submitPhase !== "uploading" && submitPhase !== "uploading" &&
submitPhase !== "saving" submitPhase !== "saving"
const showExistingRemove = totalScreenshots >= 2
return ( return (
<div className='space-y-6'> <div className='space-y-6'>
@@ -559,6 +561,7 @@ export function ReviewStep({
draggable={false} draggable={false}
/> />
<div className="absolute inset-0 bg-linear-to-t from-black/60 via-transparent to-transparent opacity-0 group-hover:opacity-100 transition-opacity" /> <div className="absolute inset-0 bg-linear-to-t from-black/60 via-transparent to-transparent opacity-0 group-hover:opacity-100 transition-opacity" />
{showExistingRemove && (
<button <button
type="button" type="button"
onClick={() => onRemoveExistingScreenshot?.(ss.id)} onClick={() => onRemoveExistingScreenshot?.(ss.id)}
@@ -567,6 +570,7 @@ export function ReviewStep({
> >
<X className="h-3.5 w-3.5" /> <X className="h-3.5 w-3.5" />
</button> </button>
)}
<div className="absolute bottom-2 left-2 px-2 py-0.5 rounded-md bg-black/50 backdrop-blur-sm text-[10px] font-medium text-white/90 opacity-0 group-hover:opacity-100"> <div className="absolute bottom-2 left-2 px-2 py-0.5 rounded-md bg-black/50 backdrop-blur-sm text-[10px] font-medium text-white/90 opacity-0 group-hover:opacity-100">
Existing · #{ss.orderIndex + 1} Existing · #{ss.orderIndex + 1}
</div> </div>