Clear old approval status when user starts designing new item
When user adds text or image after a previous submission, clear the old approval status and localStorage so they can design a fresh item on the same product without seeing the old approval message. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Haiku 4.5
parent
f64462c5fe
commit
63ae432793
@@ -640,6 +640,14 @@ export default function DesignCanvas({ product, isAdminEditing = false }: { prod
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const addText = () => {
|
const addText = () => {
|
||||||
|
// Clear old approval status when starting a new design
|
||||||
|
if (approvalStatus) {
|
||||||
|
setApprovalStatus(null);
|
||||||
|
setDesignApprovalId(null);
|
||||||
|
if (typeof window !== 'undefined') {
|
||||||
|
localStorage.removeItem(`designApproval_${product.id}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
const id = uuid();
|
const id = uuid();
|
||||||
setActiveElements((prev) => [
|
setActiveElements((prev) => [
|
||||||
...prev,
|
...prev,
|
||||||
@@ -669,6 +677,14 @@ export default function DesignCanvas({ product, isAdminEditing = false }: { prod
|
|||||||
const src = reader.result as string;
|
const src = reader.result as string;
|
||||||
const img = new window.Image();
|
const img = new window.Image();
|
||||||
img.onload = () => {
|
img.onload = () => {
|
||||||
|
// Clear old approval status when starting a new design
|
||||||
|
if (approvalStatus) {
|
||||||
|
setApprovalStatus(null);
|
||||||
|
setDesignApprovalId(null);
|
||||||
|
if (typeof window !== 'undefined') {
|
||||||
|
localStorage.removeItem(`designApproval_${product.id}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
const maxDim = Math.min(activeStageW, activeStageH) * 0.7;
|
const maxDim = Math.min(activeStageW, activeStageH) * 0.7;
|
||||||
const scale = Math.min(maxDim / img.width, maxDim / img.height, 1);
|
const scale = Math.min(maxDim / img.width, maxDim / img.height, 1);
|
||||||
const id = uuid();
|
const id = uuid();
|
||||||
|
|||||||
Reference in New Issue
Block a user