Expose vinylEnabled toggle in admin panel

item-overrides.json is gitignored (runtime data), so vinylEnabled must
be settable from the admin UI rather than committed directly. Adds the
"Enable vinyl configurator" checkbox alongside the existing vinyl promo
toggle so production overrides can be managed without touching files.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
chris 2026-04-29 13:11:59 -04:00
parent 1f1dabdb31
commit 68bfe79db8

View File

@ -595,6 +595,7 @@ function ItemEditor({
const ov = item._override const ov = item._override
const [hidden, setHidden] = useState(ov.hidden ?? false) const [hidden, setHidden] = useState(ov.hidden ?? false)
const [vinylEnabled, setVinylEnabled] = useState(ov.vinylEnabled ?? false)
const [vinylPromo, setVinylPromo] = useState(ov.vinylPromo ?? false) const [vinylPromo, setVinylPromo] = useState(ov.vinylPromo ?? false)
const [catOverride, setCatOverride] = useState(ov.categoryOverride ?? '') const [catOverride, setCatOverride] = useState(ov.categoryOverride ?? '')
const [catLabel, setCatLabel] = useState(ov.categoryLabelOverride ?? '') const [catLabel, setCatLabel] = useState(ov.categoryLabelOverride ?? '')
@ -643,7 +644,8 @@ function ItemEditor({
const patch: Partial<ItemOverride> = { const patch: Partial<ItemOverride> = {
hidden, hidden,
hiddenModifierIds: hiddenMods, hiddenModifierIds: hiddenMods,
vinylPromo: vinylPromo || undefined, vinylEnabled: vinylEnabled || undefined,
vinylPromo: vinylPromo || undefined,
} }
if (catOverride) patch.categoryOverride = catOverride if (catOverride) patch.categoryOverride = catOverride
if (catLabel) patch.categoryLabelOverride = catLabel if (catLabel) patch.categoryLabelOverride = catLabel
@ -677,6 +679,7 @@ function ItemEditor({
const res = await fetch(`/api/admin/items/${item.id}`, { method: 'DELETE' }) const res = await fetch(`/api/admin/items/${item.id}`, { method: 'DELETE' })
if (res.ok) { if (res.ok) {
setHidden(false) setHidden(false)
setVinylEnabled(false)
setVinylPromo(false) setVinylPromo(false)
setCatOverride('') setCatOverride('')
setCatLabel('') setCatLabel('')
@ -739,7 +742,19 @@ function ItemEditor({
</label> </label>
</div> </div>
{/* Vinyl promo */} {/* Vinyl options */}
<div className="field">
<label className="checkbox">
<input
type="checkbox"
checked={vinylEnabled}
onChange={(e) => setVinylEnabled(e.target.checked)}
style={{ marginRight: 6 }}
/>
Enable vinyl configurator
</label>
<p className="help">Shows the shape picker, text input, and font selector on this item (use for the Custom Vinyl product).</p>
</div>
<div className="field"> <div className="field">
<label className="checkbox"> <label className="checkbox">
<input <input