From fe57d63311f7d2c8ee19f190f132498817433c35 Mon Sep 17 00:00:00 2001 From: Z8MB1E Date: Tue, 13 Oct 2026 16:43:16 -0400 Subject: [PATCH] fix(garage): always fit the vehicle bay grid to its container Cell size was computed from the wrapper width without subtracting the inventory frame's p-2 padding and borders, so the grid was ~16px wider than its container and grew a horizontal scrollbar. Subtract the 18px frame chrome, lower the cell floor 40->24 (legibility guard only), and switch the wrapper to overflow-hidden so no scrollbar can appear. --- src/components/frontend/garage/GarageGrid.tsx | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/components/frontend/garage/GarageGrid.tsx b/src/components/frontend/garage/GarageGrid.tsx index 322c74ef..46a7256f 100644 --- a/src/components/frontend/garage/GarageGrid.tsx +++ b/src/components/frontend/garage/GarageGrid.tsx @@ -264,14 +264,22 @@ export function GarageGrid({ const gridRef = useRef(null); const containerRef = useRef(null); - // Responsive cell size: fit the bay width into the container. + // Chrome between the measured wrapper and the grid: the inventory frame's + // p-2 padding (8+8) plus its 1px borders (1+1). + const FRAME_CHROME_PX = 18; + + // Responsive cell size: always fit the bay width into the container (the + // grid must never overflow, so no scrollbar can appear). The small floor is + // a legibility guard only; realistic containers never reach it. useEffect(() => { const el = containerRef.current; if (!el) return; const observer = new ResizeObserver((entries) => { const width = entries[0]?.contentRect.width ?? 0; - if (width > 0) { - setCellSize(Math.max(40, Math.min(96, Math.floor(width / gridWidth)))); + if (width > FRAME_CHROME_PX) { + setCellSize( + Math.max(24, Math.min(96, Math.floor((width - FRAME_CHROME_PX) / gridWidth))), + ); } }); observer.observe(el); @@ -388,7 +396,7 @@ export function GarageGrid({ onDragEnd={handleDragEnd} >
-
+