Dashboard grid: 1-col min width for stats, vertical compaction for make-room dragging
- Stat widgets can now be resized down to a single column (minW 1) - Switch to vertical compaction so dragging a widget pushes others down to reveal the drop spot, then settles (fixes both the no-move and fly-off behaviours) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -45,7 +45,7 @@ const STAT_DEFS = {
|
|||||||
|
|
||||||
// Full widget registry: size defaults + palette label. Stats inherit from STAT_DEFS.
|
// Full widget registry: size defaults + palette label. Stats inherit from STAT_DEFS.
|
||||||
const WIDGETS = {
|
const WIDGETS = {
|
||||||
...Object.fromEntries(Object.entries(STAT_DEFS).map(([id, d]) => [id, { label: d.label, w: 2, h: 1, minW: 2, minH: 1 }])),
|
...Object.fromEntries(Object.entries(STAT_DEFS).map(([id, d]) => [id, { label: d.label, w: 2, h: 1, minW: 1, minH: 1 }])),
|
||||||
weekly: { label: 'Weekly distance', w: 6, h: 3, minW: 4, minH: 2 },
|
weekly: { label: 'Weekly distance', w: 6, h: 3, minW: 4, minH: 2 },
|
||||||
bodyBattery: { label: 'Body Battery', w: 4, h: 3, minW: 3, minH: 2 },
|
bodyBattery: { label: 'Body Battery', w: 4, h: 3, minW: 3, minH: 2 },
|
||||||
vo2maxTrend: { label: 'VO₂ max trend', w: 3, h: 3, minW: 2, minH: 2 },
|
vo2maxTrend: { label: 'VO₂ max trend', w: 3, h: 3, minW: 2, minH: 2 },
|
||||||
@@ -629,8 +629,7 @@ export default function DashboardPage() {
|
|||||||
isDraggable={editMode}
|
isDraggable={editMode}
|
||||||
isResizable={editMode}
|
isResizable={editMode}
|
||||||
onLayoutChange={handleLayoutChange}
|
onLayoutChange={handleLayoutChange}
|
||||||
compactType={null}
|
compactType="vertical"
|
||||||
preventCollision
|
|
||||||
draggableCancel=".widget-delete"
|
draggableCancel=".widget-delete"
|
||||||
>
|
>
|
||||||
{layout.filter(l => WIDGETS[l.i]).map(l => (
|
{layout.filter(l => WIDGETS[l.i]).map(l => (
|
||||||
|
|||||||
Reference in New Issue
Block a user