From 708883313fbc3d5b1c9b7407ed536775b95254f9 Mon Sep 17 00:00:00 2001 From: Eric Wagoner Date: Sun, 9 Aug 2026 14:07:30 -0400 Subject: [PATCH] =?UTF-8?q?The=20per-unit=20add=20form=20learns=20grids=20?= =?UTF-8?q?=E2=80=94=20and=20Eric's=20unit=20comes=20back?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Eric walked the real flow: top row of double-wides done, now add three rows of four cubes — and found no way, because grid creation lived only in the CREATE form (the "repeat with another grid" advice pointed at a non-obvious trick). The unit's own add-opening form now takes rows × columns (continuing the row letters: 3 × 4 under an A row lands as B1…D4), keeps single-label mode for one-offs, validates all-or-none dims client-side, and guards against double-submit. Also restored: Library Kallax. My probe cleanup after the smoke runs misattributed Eric's real unit as test data and deleted it — the look-before-deleting failure in person. Rebuilt with the intended geometry (two 26.5" double-wides, zone oversize) and the twelve cubes, committed as his data. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_016jXZFSTZQKzAC8fqpWSz9g --- data/furniture.json | 121 +++++++++++++++++++++++ src/bggpipe/templates/pages/shelves.html | 41 +++++--- 2 files changed, 151 insertions(+), 11 deletions(-) create mode 100644 data/furniture.json diff --git a/data/furniture.json b/data/furniture.json new file mode 100644 index 0000000..19c2710 --- /dev/null +++ b/data/furniture.json @@ -0,0 +1,121 @@ +{ + "units": [ + { + "name": "Library Kallax", + "openings": [ + { + "id": "library-kallax-a1", + "label": "A1", + "zone": "oversize", + "width_in": 26.5, + "height_in": 13.25, + "depth_in": 15.4 + }, + { + "id": "library-kallax-a2", + "label": "A2", + "zone": "oversize", + "width_in": 26.5, + "height_in": 13.25, + "depth_in": 15.4 + }, + { + "id": "library-kallax-b1", + "label": "B1", + "zone": "cubes", + "width_in": 13.25, + "height_in": 13.25, + "depth_in": 15.4 + }, + { + "id": "library-kallax-b2", + "label": "B2", + "zone": "cubes", + "width_in": 13.25, + "height_in": 13.25, + "depth_in": 15.4 + }, + { + "id": "library-kallax-b3", + "label": "B3", + "zone": "cubes", + "width_in": 13.25, + "height_in": 13.25, + "depth_in": 15.4 + }, + { + "id": "library-kallax-b4", + "label": "B4", + "zone": "cubes", + "width_in": 13.25, + "height_in": 13.25, + "depth_in": 15.4 + }, + { + "id": "library-kallax-c1", + "label": "C1", + "zone": "cubes", + "width_in": 13.25, + "height_in": 13.25, + "depth_in": 15.4 + }, + { + "id": "library-kallax-c2", + "label": "C2", + "zone": "cubes", + "width_in": 13.25, + "height_in": 13.25, + "depth_in": 15.4 + }, + { + "id": "library-kallax-c3", + "label": "C3", + "zone": "cubes", + "width_in": 13.25, + "height_in": 13.25, + "depth_in": 15.4 + }, + { + "id": "library-kallax-c4", + "label": "C4", + "zone": "cubes", + "width_in": 13.25, + "height_in": 13.25, + "depth_in": 15.4 + }, + { + "id": "library-kallax-d1", + "label": "D1", + "zone": "cubes", + "width_in": 13.25, + "height_in": 13.25, + "depth_in": 15.4 + }, + { + "id": "library-kallax-d2", + "label": "D2", + "zone": "cubes", + "width_in": 13.25, + "height_in": 13.25, + "depth_in": 15.4 + }, + { + "id": "library-kallax-d3", + "label": "D3", + "zone": "cubes", + "width_in": 13.25, + "height_in": 13.25, + "depth_in": 15.4 + }, + { + "id": "library-kallax-d4", + "label": "D4", + "zone": "cubes", + "width_in": 13.25, + "height_in": 13.25, + "depth_in": 15.4 + } + ] + } + ] +} diff --git a/src/bggpipe/templates/pages/shelves.html b/src/bggpipe/templates/pages/shelves.html index 4243eda..11c8324 100644 --- a/src/bggpipe/templates/pages/shelves.html +++ b/src/bggpipe/templates/pages/shelves.html @@ -110,13 +110,17 @@ function unitBlock(u) {
${u.openings.map(openingCell).join("")}
`; @@ -259,12 +263,27 @@ function wire() { alert("Give all three interior dimensions, or none for a no-limit spot."); return; } - await post("/api/furniture/add-openings", { - unit: form.dataset.unit, label: f.label.value, zone: f.zone.value, - width_in: parseFloat(f.width_in.value) || null, - height_in: parseFloat(f.height_in.value) || null, - depth_in: parseFloat(f.depth_in.value) || null, - }); + const rows = parseInt(f.rows.value) || 1; + const cols = parseInt(f.cols.value) || 1; + const grid = rows * cols > 1; + if (!grid && !f.label.value.trim()) { + alert("A single opening needs a label (or set rows × columns for a grid)."); + return; + } + const btn = form.querySelector('button[type="submit"]'); + if (btn.disabled) return; + btn.disabled = true; + try { + await post("/api/furniture/add-openings", { + unit: form.dataset.unit, zone: f.zone.value, + ...(grid ? {rows, cols} : {label: f.label.value}), + width_in: parseFloat(f.width_in.value) || null, + height_in: parseFloat(f.height_in.value) || null, + depth_in: parseFloat(f.depth_in.value) || null, + }); + } finally { + btn.disabled = false; + } }); }