From 7d7d46af3201cbb58573099e17e9b9e3c0579aeb Mon Sep 17 00:00:00 2001 From: chris Date: Wed, 29 Apr 2026 23:14:42 -0400 Subject: [PATCH] Make vinyl an optional add-on with checkbox and additive pricing - Vinyl is now opt-in via a checkbox (unchecked by default) - Item's base price is preserved; vinyl cost is added on top - Checkbox label explains it's lettering on a separate 18" foil balloon - Price breakdown shows vinyl as an add-on, not a replacement - Validation only requires text/font when the checkbox is checked - Editing a vinyl cart entry pre-checks the checkbox Co-Authored-By: Claude Sonnet 4.6 --- estore/src/components/ColorPicker.tsx | 194 ++++++++++++++++---------- 1 file changed, 117 insertions(+), 77 deletions(-) diff --git a/estore/src/components/ColorPicker.tsx b/estore/src/components/ColorPicker.tsx index 707c045..b02e3f8 100644 --- a/estore/src/components/ColorPicker.tsx +++ b/estore/src/components/ColorPicker.tsx @@ -55,6 +55,7 @@ export default function ColorPicker({ product, maxColors, onClose, editingEntry // Vinyl state const [vinylConfig, setVinylConfig] = useState(null) + const [wantsVinyl, setWantsVinyl] = useState(!!(editingEntry?.vinylText)) const [vinylText, setVinylText] = useState(editingEntry?.vinylText ?? '') const [vinylFontId, setVinylFontId] = useState(editingEntry?.vinylFontId ?? '') const [vinylShape, setVinylShape] = useState(null) @@ -144,8 +145,8 @@ export default function ColorPicker({ product, maxColors, onClose, editingEntry const vinylPriceCents = product.vinylEnabled ? (vinylShape?.priceCents ?? 0) + vinylLetterCount * (vinylConfig?.pricePerLetterCents ?? 65) : 0 - const needsVinylText = product.vinylEnabled && vinylLetterCount === 0 - const needsVinylFont = product.vinylEnabled && !vinylFontId + const needsVinylText = product.vinylEnabled && wantsVinyl && vinylLetterCount === 0 + const needsVinylFont = product.vinylEnabled && wantsVinyl && !vinylFontId const canAdd = missingModifiers.length === 0 && !needsColors && !needsVinylText && !needsVinylFont @@ -189,8 +190,9 @@ export default function ColorPicker({ product, maxColors, onClose, editingEntry }, 0) const basePrice = activeVariation?.priceCents ?? product.price ?? 0 const chromeDelta = chromeCount * surchargePerColor - const unitPrice = product.vinylEnabled ? vinylPriceCents : basePrice + modDelta + chromeDelta - const total = unitPrice > 0 ? fmt(unitPrice * quantity) : product.vinylEnabled ? fmt(0) : 'Get Quote' + const vinylAddon = product.vinylEnabled && wantsVinyl ? vinylPriceCents : 0 + const unitPrice = basePrice + modDelta + chromeDelta + vinylAddon + const total = unitPrice > 0 ? fmt(unitPrice * quantity) : 'Get Quote' return (
@@ -540,86 +542,124 @@ export default function ColorPicker({ product, maxColors, onClose, editingEntry {/* ── Vinyl configurator ── */} {product.vinylEnabled && vinylConfig && ( -
-

Custom Vinyl Text

+
- {/* Shape picker */} -
- -
- {vinylConfig.shapes.map((shape) => ( - - ))} -
-
- - {/* Text input */} -
-