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} >
-
+