Fix price display issues and layout in design review page
- Add defensive checks in cart store to handle missing/NaN unitPrice values - Display '—' for items with invalid prices instead of NaN - Fix design review page grid layout to align buttons at top of page - Ensure buttons don't get pushed below images on review page
This commit is contained in:
@@ -62,7 +62,8 @@
|
|||||||
"Bash(rm \"D:\\\\Craft2Prints\\\\src\\\\app\\\\admin\\\\designs\\\\[id]\\\\send-button.tsx\")",
|
"Bash(rm \"D:\\\\Craft2Prints\\\\src\\\\app\\\\admin\\\\designs\\\\[id]\\\\send-button.tsx\")",
|
||||||
"Bash(git show *)",
|
"Bash(git show *)",
|
||||||
"Bash(git status *)",
|
"Bash(git status *)",
|
||||||
"Bash(git revert *)"
|
"Bash(git revert *)",
|
||||||
|
"Bash(git commit -m 'Fix price display issues and layout in design review page *)"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -147,7 +147,11 @@ export default function CartPage() {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="w-24 text-right font-mono text-sm">
|
<div className="w-24 text-right font-mono text-sm">
|
||||||
|
{Number.isFinite(item.unitPrice) ? (
|
||||||
<Price cents={item.unitPrice * item.quantity} />
|
<Price cents={item.unitPrice * item.quantity} />
|
||||||
|
) : (
|
||||||
|
<span className="text-muted">—</span>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ export default function DesignReviewPage({ params }: { params: { id: string } })
|
|||||||
<h1 className="font-display text-3xl mb-2">{design.product.name}</h1>
|
<h1 className="font-display text-3xl mb-2">{design.product.name}</h1>
|
||||||
<p className="text-muted mb-8">Review your personalized design</p>
|
<p className="text-muted mb-8">Review your personalized design</p>
|
||||||
|
|
||||||
<div className="grid gap-8 md:grid-cols-2">
|
<div className="grid gap-8 md:grid-cols-2 md:items-start">
|
||||||
{/* Design Preview */}
|
{/* Design Preview */}
|
||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
@@ -38,7 +38,10 @@ export const useCart = create<CartState>()(
|
|||||||
),
|
),
|
||||||
})),
|
})),
|
||||||
clear: () => set({ items: [] }),
|
clear: () => set({ items: [] }),
|
||||||
total: () => get().items.reduce((sum, i) => sum + i.unitPrice * i.quantity, 0),
|
total: () => get().items.reduce((sum, i) => {
|
||||||
|
const price = typeof i.unitPrice === 'number' && !isNaN(i.unitPrice) ? i.unitPrice : 0;
|
||||||
|
return sum + price * i.quantity;
|
||||||
|
}, 0),
|
||||||
}),
|
}),
|
||||||
{
|
{
|
||||||
name: 'personalize-studio-cart',
|
name: 'personalize-studio-cart',
|
||||||
|
|||||||
Reference in New Issue
Block a user