Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
size dashboard widgets to their content and float them into the space above
[._.]/ Adam Eivyad284fac0cec
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex df20537ee2..0c1f427a26 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -2,6 +2,12 @@## Changed+- **Dashboard widgets are sized by their content and float up into the space above them, and the "MODULE.04 // ALERTS" tabs are gone.** The grid used to lay every cell out at the row count stored in the layout, so a card with two lines in it still reserved five 80px rows and left the rest as dead space — with more of it wherever a gated widget dropped out or a hand-arranged row was uneven. Cells now measure their widget and pack in pixels: each one drops as high as it can go without landing on an already-placed cell that shares a column, which is what lets the space a short card doesn't use get reclaimed by whatever sits beneath it. Reading order (stored `y`, then `x`) still decides the packing order, so the result matches the arrangement that was saved rather than reshuffling to whatever fits best. Nothing gets clipped on the way in either — a widget taller than its declared rows used to be cut off by the cell's `overflow-hidden`, and now grows.++ Heights are still adjustable, they're just opt-in: dragging the ↘ handle's vertical axis pins that cell (`fixedH: true` on the grid item), and a ⌃⌄ handle appears on pinned cells in Arrange mode to hand the height back to the content. Stored `h` survives as the first-paint fallback and is refreshed from the measurement on every commit, which is also what a client too old to know about `fixedH` renders from — an install that hasn't updated yet reads a layout saved by one that has and lays it out close to right. The drag math moved into the pack's coordinate space along with it, because once heights are measured, stored `y` describes an ordering and not a position: reasoning in stored rows would have moved the cursor and the card at different speeds.++ The micrographic schematic tabs came off the eight widgets that carried them (and off the Apps empty state). They were pinned to the top border of the cell and the widget reserved a header strip to clear them, which is a fixed cost in the exact dimension this change is trying to reclaim — and a "MODULE.01 // HEALTH" label above a card already titled "System Health" is chrome, not information. `SchematicLabel` itself stays; the Chief of Staff task lists still use it.+- **Quota Burn's per-family "Provider ID" and "Window scope" boxes are gone.** Both were free-text overrides for decisions the page already makes correctly on its own: the family match already prefers the watchable TUI provider over the headless CLI (a hand-typed id could only ever pick a worse one), and window targeting already reads *every* window on the card — the broadest one as the target the reset horizon and dispatch cap key on, the narrowest as the one that will refuse first, the tightest as the one the reserve guards. Scope was a free-text filter over that, so its realistic uses were "type the same thing the classifier already picked" or "type a word this provider doesn't publish and silently never burn." A job still carries its own optional `providerId`, which is the level where naming a specific provider actually means something. Configs written before this load unchanged — the normalizer drops both keys on the next save — and migration 221 no longer carries them over from the retired per-app shape.- **Quota burn's dispatch cap is now opt-in — `-1` (unlimited) is the default, so a plan stops when the *quota* says so rather than when a tally runs out.** `maxDispatchesPerWindow` counted how many burns one target window could spend, and at its old default of 5 it was routinely the first gate to close: a weekly window with days left and headroom above the reserve would sit idle at "dispatch cap reached (5/5)" — the exact "allowance expires unused" outcome the feature exists to prevent. It read as a safety property, but the gates that actually bound spend all measure live numbers: the reset horizon (`resetWithinHours`), the reserve (`reservePercent`, checked against the *tightest* window on the card), and the provider's own refusal, which blocks the family outright when the short window empties underneath a weekly plan. A count stacked on top of those adds no protection they don't already give. A hard ceiling is still available — set 1–50 on the family card — and the window is charged either way, so the card still shows how many burns it has spent (with no denominator when uncapped). `0` is deliberately not accepted: "never burn" is what switching the family off means, and the client's number field collapses anything below 1 to the sentinel so stepping the spinner down can't 400. Migration 226 lifts an existing plan that still carries the old default of 5 — a changed default reaches nobody otherwise, since the normalizer has written that 5 into every install's `quota-burn.json` — while any other stored value is a number the user chose and is left alone.diff --git a/client/src/components/dashboard/CLAUDE.md b/client/src/components/dashboard/CLAUDE.mdindex 6605d80ae6..b2f4a84b0c 100644--- a/client/src/components/dashboard/CLAUDE.md+++ b/client/src/components/dashboard/CLAUDE.md@@ -2,7 +2,9 @@Dashboard widgets are registered in `widgetRegistry.jsx` — each entry has `{ id, label, Component, width, defaultH?, gate? }`. The Dashboard page renders the active layout's widget list from this registry; named layouts persist in `data/dashboard-layouts.json` and are managed via `GET/PUT/DELETE /api/dashboard/layouts`. Built-in layouts (`default`, `focus`, `morning-review`, `ops`) are seeded on first read and cannot be deleted.-**Grid positions:** layouts also carry a `grid: [{ id, x, y, w, h }]` array — free-form positions on a 12-column grid (rows ~80px each). When `grid` is empty (legacy/unmigrated layouts) the renderer auto-flows widgets using `synthesizeGrid` based on each widget's `width` keyword and `defaultH`. The "Arrange" button on the Dashboard enters edit mode where every widget exposes a move (top-right) and resize (bottom-right) handle; drag is snap-to-grid with collision-resolve via `placeAndCompact` (pins the moved item, slots others into the smallest non-colliding y). Save persists to the active layout's `grid`. The grid renderer collapses to a single-column stack below 640px container width, rendered in reading order (`y`, then `x`) — never grid-array order, which `placeAndCompact` deliberately scrambles by hoisting the moved item to the front.+**Grid positions:** layouts also carry a `grid: [{ id, x, y, w, h, fixedH? }]` array — free-form positions on a 12-column grid (rows ~80px each). When `grid` is empty (legacy/unmigrated layouts) the renderer auto-flows widgets using `synthesizeGrid` based on each widget's `width` keyword and `defaultH`. The "Arrange" button on the Dashboard enters edit mode where every widget exposes a move (top-right) and resize (bottom-right) handle; drag is snap-to-grid with collision-resolve via `placeAndCompact` (pins the moved item, slots others into the smallest non-colliding y). Save persists to the active layout's `grid`. The grid renderer collapses to a single-column stack below 640px container width, rendered in reading order (`y`, then `x`) — never grid-array order, which `placeAndCompact` deliberately scrambles by hoisting the moved item to the front.++**Height is measured, not declared.** `h` is NOT the rendered height. A cell measures its widget's natural height with a `ResizeObserver` and `packVertically` positions everything in pixels — each cell floats up to just below the nearest already-placed cell that shares a column. That's what stops an 80px card from reserving a 400px slot and leaving a band of dead whitespace across the row. `h` survives as the pre-measurement fallback (first paint) and as what an older client — which knows nothing about `fixedH` — reads out of a saved layout, so every drag commit refreshes it from the measurement via `toGridUnits`. A cell whose height the user actually dragged carries `fixedH: true` and keeps `h` exactly, clipping content the way the whole grid used to; the ⌃⌄ handle (edit mode, pinned cells only) hands the height back to the content. Stored `y` no longer sets the pixel offset — it only decides reading order, which is also the packing order, which is why the visual result still matches the arrangement the user saved. `defaultH` in the registry is likewise only a first-paint ballpark.**Mobile editing.** Free-form move/resize is desktop-only (a phone has no room for positional editing), but *reordering* works on mobile: edit mode swaps the two grid handles for a single reorder handle. The 1-D sort goes through **`@dnd-kit/sortable`** — the same `PointerSensor` + `KeyboardSensor` + `verticalListSortingStrategy` pairing as `cos/tabs/TasksTab.jsx` and `universeBuilder/InfluenceChipsInput.jsx` — which is what supplies touch, keyboard (space to lift, arrows to move), multi-pointer safety, screen-reader announcements and edge auto-scroll. **Do not hand-roll a pointer gesture for this**; the free-form 2-D drag stays hand-rolled only because arbitrary grid placement is not what a sortable list does. Use `dndTransformToCss` from `client/src/lib/dndTransform.js` in the style object, never `@dnd-kit/utilities`.@@ -13,7 +15,7 @@ On drop, `onDragEnd` re-flows the whole grid through `reflowToOrder` so its read**Widget order lives in the grid.** `saveGridEdit` rewrites the layout's `widgets` array into `readingOrderIds(grid)` so LayoutEditor lists widgets in the order the dashboard actually shows them. Note that `reconcileGrid` iterates the *grid* and uses `widgets` only for membership, so LayoutEditor's own Move up/down buttons currently do not move anything once a layout has a grid — see the PLAN.md item.**When adding a new dashboard widget:**-1. Add a `{ id, label, Component, width, defaultH?, gate? }` entry to `WIDGETS` in `widgetRegistry.jsx`. Use a stable `id` (kebab-case) — it's the contract stored in layouts. Pick `defaultH` based on the widget's natural content height (default `4`); this controls the size when it's first auto-placed into a grid.+1. Add a `{ id, label, Component, width, defaultH?, gate? }` entry to `WIDGETS` in `widgetRegistry.jsx`. Use a stable `id` (kebab-case) — it's the contract stored in layouts. Pick `defaultH` from the widget's rough content height (default `4`); it only has to be close, since the cell measures itself once painted.2. If the widget needs dashboard data (apps/usage/health), read it from the `dashboardState` prop — do NOT issue a duplicate fetch from inside the widget.3. If the widget only makes sense in some cases (e.g. only when apps exist), add a `gate: (state) => boolean` predicate.4. Add the widget id to the built-in `default` layout in `server/services/dashboardLayouts.js` if it should appear out of the box.diff --git a/client/src/components/dashboard/DashboardGrid.jsx b/client/src/components/dashboard/DashboardGrid.jsxindex c8e423b246..07449a8556 100644--- a/client/src/components/dashboard/DashboardGrid.jsx+++ b/client/src/components/dashboard/DashboardGrid.jsx@@ -1,5 +1,5 @@import { useState, useRef, useEffect, useMemo, useCallback, memo } from 'react';-import { GripVertical, MoveDiagonal2, GripHorizontal } from 'lucide-react';+import { GripVertical, MoveDiagonal2, GripHorizontal, ChevronsDownUp } from 'lucide-react';import {DndContext,KeyboardSensor,@@ -19,13 +19,29 @@ import { GRID_COLS, GRID_DEFAULT_H, WIDTH_TO_COLS, WIDGETS_BY_ID } from './widgeimport useContainerWidth from '../../hooks/useContainerWidth';import { dndTransformToCss } from '../../lib/dndTransform';-// Free-form 12-column grid with snap-to-grid drag and resize.+// Free-form 12-column grid with snap-to-grid drag, resize, and content-sized+// cells that float up into whatever whitespace is above them.//-// Items: [{ id, x, y, w, h }] where x/y/w/h are integer grid units+// Items: [{ id, x, y, w, h, fixedH? }] where x/y/w/h are integer grid units// - x: 0..11 (column origin)-// - y: 0..n (row origin; rows are uniform ROW_HEIGHT_PX tall)+// - y: 0..n (row origin; ordering/authoring coordinate — see below)// - w: 1..12 (column span)-// - h: 1..n (row span)+// - h: 1..n (row span, each row ROW_HEIGHT_PX tall)+// - fixedH: the user dragged a height onto this cell; honor `h` exactly+//+// HEIGHT IS MEASURED, NOT DECLARED. A widget's card is only as tall as its+// content, so `h` is not the rendered height — it's the pre-measurement+// fallback (first paint, and what older clients read out of a saved layout).+// Cells the user has explicitly resized carry `fixedH: true` and keep their+// declared height, clipping content the way the whole grid used to.+//+// Columns are laid out from x/w in grid units; vertical position is packed in+// PIXELS by `packVertically` — each cell drops as high as it can go without+// landing on an already-placed cell that shares a column. That's what+// reclaims dead whitespace: an 80px-tall card in a 5-row slot no longer+// reserves 400px, and the cards below it float up through the gap. Stored `y`+// still decides reading order (and therefore packing order), so the visual+// result always matches the order the user arranged.//// In edit mode each item exposes a top-right move handle and a bottom-right// resize handle. Pointer events power both so the same handlers work for@@ -50,6 +66,7 @@ import { dndTransformToCss } from '../../lib/dndTransform';const ROW_HEIGHT_PX = 80;const GAP_PX = 16;+const ROW_STEP_PX = ROW_HEIGHT_PX + GAP_PX;const MIN_W = 2;const MIN_H = 2;// Mobile breakpoint: below this width the grid collapses to a single column@@ -72,15 +89,81 @@ function byReadingOrder(a, b) {return a.y - b.y || a.x - b.x;}-function rectFor(item, colWidth) {+// Grid rows ↔ pixels. A span of `h` rows covers h row boxes plus the gaps+// between them; the inverse rounds so a measured height round-trips to the+// row count that renders closest to it.+export function rowsToPx(h) {+ return h * ROW_HEIGHT_PX + (h - 1) * GAP_PX;+}+export function pxToRows(px) {+ return Math.max(1, Math.round((px + GAP_PX) / ROW_STEP_PX));+}++// Rendered height of one cell. Auto-height cells (the default) are exactly as+// tall as they measured; `fixedH` cells keep the height the user dragged onto+// them. `h` is the fallback until the first measurement lands — which is also+// why every commit refreshes it (see `toPackSpace`).+export function itemHeightPx(item, heights = {}) {+ if (!item.fixedH) {+ const measured = heights[item.id];+ if (measured > 0) return measured;+ }+ return rowsToPx(item.h);+}++function shareColumns(a, b) {+ return !(a.x + a.w <= b.x || b.x + b.w <= a.x);+}++// Masonry float. Walk cells in reading order and drop each one as high as it+// will go without landing on an already-placed cell that shares a column.+// Returns Map<id, { top, height }> in pixels.+//+// This is the whole point of the auto-height grid: a card shorter than its+// slot no longer reserves the leftover rows, and whatever sits under it rises+// through the gap instead of leaving a band of dead space across the row.+// Reading order (not grid-array order) is what keeps the result stable — the+// caller must pass items already sorted by `byReadingOrder`.+export function packVertically(ordered, heights = {}) {+ const placed = [];+ const rects = new Map();+ for (const item of ordered) {+ const height = itemHeightPx(item, heights);+ let top = 0;+ for (const p of placed) {+ if (!shareColumns(item, p)) continue;+ top = Math.max(top, p.top + p.height + GAP_PX);+ }+ placed.push({ x: item.x, w: item.w, top, height });+ rects.set(item.id, { top, height });+ }+ return rects;+}++// Horizontal geometry — the only part still derived straight from grid units.+function columnRect(item, colWidth) {return {left: item.x * (colWidth + GAP_PX),- top: item.y * (ROW_HEIGHT_PX + GAP_PX),width: item.w * colWidth + (item.w - 1) * GAP_PX,- height: item.h * ROW_HEIGHT_PX + (item.h - 1) * GAP_PX,};}+// Re-express the layout in the pack's own coordinate space: `y` becomes the+// row the cell actually renders at and `h` the rows it actually occupies.+// Once heights are measured, stored y/h are only an ordering hint and a+// fallback — a drag that reasoned in them would move the cursor and the card+// at different speeds, and would compare the dragged cell's position against+// coordinates nothing is drawn at. Every commit goes through here, which is+// also what keeps persisted y/h honest for the next cold load (and for a+// client too old to know about `fixedH`).+function toPackSpace(items, rects) {+ return items.map((it) => {+ const rect = rects.get(it.id);+ if (!rect) return { ...it };+ return { ...it, y: Math.round(rect.top / ROW_STEP_PX), h: pxToRows(rect.height) };+ });+}+function overlaps(a, b) {return !(a.x + a.w <= b.x || b.x + b.w <= a.x || a.y + a.h <= b.y || b.y + b.h <= a.y);}@@ -95,6 +178,15 @@ function sameRect(a, b) {const HANDLE_KINDS = {move: { label: 'Move', Icon: GripVertical, size: 14, className: 'top-1.5 right-1.5 p-1 cursor-move' },resize: { label: 'Resize', Icon: MoveDiagonal2, size: 14, className: 'bottom-1 right-1 p-1 cursor-se-resize' },+ // Only rendered on a cell whose height the user pinned — clicking it hands+ // the height back to the content so the cell can shrink and let its+ // neighbours float up again.+ 'auto-height': {+ label: 'Auto-fit height',+ Icon: ChevronsDownUp,+ size: 14,+ className: 'bottom-1 left-1 p-1 cursor-pointer',+ },reorder: {label: 'Reorder',Icon: GripHorizontal,@@ -109,12 +201,13 @@ const HANDLE_KINDS = {// their own onPointerDown instead. `touchAction: 'none'` is what makes any of// them work under a finger — without it the browser claims the pointer stream// for scrolling.-function DragHandle({ kind, item, onPointerDown, handleProps }) {+function DragHandle({ kind, item, onPointerDown, onClick, handleProps }) {const { label, Icon, size, className } = HANDLE_KINDS[kind];return (<buttontype="button"onPointerDown={onPointerDown}+ onClick={onClick}// The registry label, not the raw id — this is read aloud.aria-label={`${label} ${WIDGETS_BY_ID[item.id]?.label ?? item.id}`}className={`absolute z-20 bg-port-bg/90 border border-port-border rounded text-gray-300 hover:text-white hover:border-port-accent ${className}`}@@ -224,20 +317,55 @@ export function readingOrderIds(grid) {// a drag re-renders the grid, and without this each tick would re-run// `renderItem` for all ~12 widgets to move one card.const GridCell = memo(function GridCell({- item, isMobile, editable, sortable, colWidth, isGridDragging, gridDragActive,- onStartGridDrag, renderItem,+ item, isMobile, editable, sortable, left, top, width, height, autoHeight, isGridDragging,+ suppressTransition, onStartGridDrag, onClearFixedHeight, onMeasure, renderItem,}) {const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable({id: item.id,disabled: !sortable,});-+ const measureRef = useRef(null);+ const pinned = Boolean(item.fixedH);++ // Report the widget's natural height so the parent can pack around it. The+ // measured node is INSIDE the clipping wrapper, so a pinned cell still+ // reports the size its content wants — it just gets clipped to `height`.+ // Off on mobile: the single-column stack measures at a totally different+ // width, and those numbers would be wrong for the desktop pack.+ useEffect(() => {+ const node = measureRef.current;+ if (!node || isMobile) return undefined;+ let raf = 0;+ const ro = new ResizeObserver((entries) => {+ if (!Number.isFinite(entries[0]?.contentRect?.height)) return;+ // Defer out of the observer callback: publishing a height re-packs every+ // cell below this one, and mutating layout synchronously from inside the+ // callback is what trips the "ResizeObserver loop" warning.+ if (raf) return;+ raf = requestAnimationFrame(() => {+ raf = 0;+ onMeasure(item.id, Math.ceil(node.offsetHeight));+ });+ });+ ro.observe(node);+ return () => {+ ro.disconnect();+ if (raf) cancelAnimationFrame(raf);+ };+ }, [isMobile, item.id, onMeasure]);++ // The cell is ALWAYS laid out at exactly the height the pack gave it, even+ // when that height is auto-derived. Letting an auto cell size itself would+ // mean that any moment its content outgrew the last measurement — first+ // paint, a lazy chunk landing, a list arriving — it would overlap whatever+ // was packed beneath it. Clipping for one frame until the observer catches+ // up is the strictly better failure.const itemStyle = isMobile? { transform: dndTransformToCss(transform), transition, opacity: isDragging ? 0.4 : undefined }- : rectFor(item, colWidth);+ : { left, top, width, height };const itemClass = isMobile? 'w-full'- : `absolute ${isGridDragging ? 'opacity-40' : ''} ${gridDragActive ? '' : 'transition-[left,top,width,height] duration-150'}`;+ : `absolute ${isGridDragging ? 'opacity-60' : ''} ${suppressTransition ? '' : 'transition-[left,top,width,height] duration-150'}`;const innerClass = isMobile? 'relative': `relative w-full h-full overflow-hidden rounded-xl ${editable ? 'ring-1 ring-port-border' : ''}`;@@ -245,11 +373,21 @@ const GridCell = memo(function GridCell({return (<div ref={setNodeRef} data-widget-id={item.id} className={itemClass} style={itemStyle}><div className={innerClass}>- {renderItem(item)}+ {/* Free of the cell's height so it reports what the widget WANTS, not+ what it currently gets — that number is the auto height. A pinned+ cell stretches its widget to fill instead (`h-full`), which is the+ one case where the declared height is the answer. `flow-root` keeps+ a widget root's margin from collapsing out of the measurement. */}+ <div ref={measureRef} className={autoHeight ? 'flow-root' : 'h-full flow-root'}>+ {renderItem(item)}+ </div>{editable && !isMobile && (<><DragHandle kind="move" item={item} onPointerDown={(e) => onStartGridDrag(e, item, 'move')} /><DragHandle kind="resize" item={item} onPointerDown={(e) => onStartGridDrag(e, item, 'resize')} />+ {pinned && (+ <DragHandle kind="auto-height" item={item} onClick={() => onClearFixedHeight(item)} />+ )}</>)}{sortable && (@@ -267,6 +405,17 @@ export default function DashboardGrid({ items, editable, onChange, onLayoutModeC// about the new ghost when we call setDragGhost, throttled by RAF.const dragRef = useRef(null);const [dragGhost, setDragGhost] = useState(null);+ // The layout as it stood when the gesture started, in pack space (see+ // `toPackSpace`). Everything the drag reasons about — the ghost, the live+ // preview, the committed grid — is relative to this, not to the stored+ // coordinates, which no longer describe where anything is drawn.+ const [dragBaseline, setDragBaseline] = useState(null);+ // Measured natural heights, px, keyed by widget id.+ const [heights, setHeights] = useState({});++ const onMeasure = useCallback((id, px) => {+ setHeights((prev) => (prev[id] === px ? prev : { ...prev, [id]: px }));+ }, []);const isMobile = containerWidth > 0 && containerWidth < MOBILE_BREAKPOINT_PX;// The mobile/desktop seam is measured off the CONTAINER, so a caller that@@ -282,11 +431,43 @@ export default function DashboardGrid({ items, editable, onChange, onLayoutModeCconst ordered = useMemo(() => [...items].sort(byReadingOrder), [items]);const orderedIds = useMemo(() => ordered.map((it) => it.id), [ordered]);- const totalRows = useMemo(- () => items.reduce((max, it) => Math.max(max, it.y + it.h), 0),- [items]+ // What the pack actually sees: the drag baseline with the item under the+ // cursor swapped for its snapped ghost, so every OTHER cell reflows live to+ // where it will land instead of waiting for the drop. A resize ghost packs+ // as a pinned cell — the drag is defining a height, so the preview must+ // show that height and not the content's.+ const previewItems = useMemo(() => {+ if (!dragGhost || !dragBaseline) return ordered;+ return dragBaseline+ .map((it) => (it.id === dragGhost.id+ ? { ...it, ...dragGhost, ...(dragGhost.kind === 'resize' ? { fixedH: true } : {}) }+ : it))+ .sort(byReadingOrder);+ }, [ordered, dragBaseline, dragGhost]);++ const rects = useMemo(+ () => (isMobile ? new Map() : packVertically(previewItems, heights)),+ [isMobile, previewItems, heights]+ );+ // Read by the drag handlers, which must not re-bind every time a widget+ // re-measures (that would churn every memoized cell mid-gesture).+ const rectsRef = useRef(rects);+ rectsRef.current = rects;++ const containerHeight = useMemo(() => {+ let bottom = 0;+ for (const rect of rects.values()) bottom = Math.max(bottom, rect.top + rect.height);+ return bottom;+ }, [rects]);++ // Until every auto cell has reported a height, the pack is still running on+ // declared-row fallbacks — animating the correction would make every page+ // load open with a 150ms shuffle. Cells snap into place instead, and the+ // transition switches on for genuine edits afterwards.+ const settled = useMemo(+ () => ordered.every((it) => it.fixedH || heights[it.id] > 0),+ [ordered, heights]);- const containerHeight = totalRows * (ROW_HEIGHT_PX + GAP_PX);const startDrag = useCallback((e, item, kind) => {if (!editable || isMobile) return;@@ -295,15 +476,22 @@ export default function DashboardGrid({ items, editable, onChange, onLayoutModeC// never let the pointer leave the gesture.e.preventDefault();e.stopPropagation();+ // Snapshot in pack space so the ghost starts exactly where the card is+ // drawn — grabbing the resize handle on an auto-height cell would+ // otherwise snap it to a stale row count before the pointer has moved.+ const baseline = toPackSpace(items, rectsRef.current);+ const startItem = { ...(baseline.find((it) => it.id === item.id) ?? item), kind };dragRef.current = {id: item.id,kind,startPointer: { x: e.clientX, y: e.clientY },- startItem: { ...item },- ghost: { ...item },+ startItem,+ ghost: { ...startItem },+ baseline,};- setDragGhost({ ...item });- }, [editable, isMobile]);+ setDragBaseline(baseline);+ setDragGhost({ ...startItem });+ }, [editable, isMobile, items]);useEffect(() => {if (!dragGhost) return undefined;@@ -347,11 +535,17 @@ export default function DashboardGrid({ items, editable, onChange, onLayoutModeCconst drag = dragRef.current;dragRef.current = null;setDragGhost(null);+ setDragBaseline(null);if (!drag || !commit) return;// Skip the write entirely when nothing actually changed — avoids a// 200 OK on every accidental click on the drag handle.if (sameRect(drag.startItem, drag.ghost)) return;- const updated = items.map((it) => (it.id === drag.id ? { ...it, ...drag.ghost } : it));+ // A resize that actually changed the HEIGHT is the user declaring one:+ // pin it. A width-only resize (or a move) leaves the cell auto-sized.+ const pins = drag.kind === 'resize' && drag.ghost.h !== drag.startItem.h;+ const updated = drag.baseline.map((it) => (it.id === drag.id+ ? { ...it, x: drag.ghost.x, y: drag.ghost.y, w: drag.ghost.w, h: drag.ghost.h, ...(pins ? { fixedH: true } : {}) }+ : it));onChange(placeAndCompact(updated, drag.id));};@@ -372,7 +566,7 @@ export default function DashboardGrid({ items, editable, onChange, onLayoutModeC};// dragGhost in the deps array re-installs the listeners only when the// gesture starts/ends — pointermove updates dragRef.current directly.- }, [dragGhost ? 'active' : 'idle', items, onChange, containerWidth]);+ }, [dragGhost ? 'active' : 'idle', onChange, containerWidth]);// A short activation distance keeps a tap on the handle from registering as// a drag; the keyboard sensor is what makes the handle usable without one.@@ -389,6 +583,15 @@ export default function DashboardGrid({ items, editable, onChange, onLayoutModeConChange(reflowToOrder(items, arrayMove(orderedIds, from, to)));}, [orderedIds, items, onChange]);+ // Hand a pinned cell's height back to its content. The cell re-renders+ // unconstrained, the observer reports its natural height, and the pack+ // closes the gap on the next frame.+ const clearFixedHeight = useCallback((item) => {+ const next = toPackSpace(items, rectsRef.current)+ .map((it) => (it.id === item.id ? { id: it.id, x: it.x, y: it.y, w: it.w, h: it.h } : it));+ onChange(placeAndCompact(next, item.id));+ }, [items, onChange]);+const sortable = editable && isMobile;const colWidth = isMobile ? 0 : getColWidth(containerWidth);@@ -411,28 +614,42 @@ export default function DashboardGrid({ items, editable, onChange, onLayoutModeCclassName={isMobile ? 'space-y-4' : 'relative w-full'}style={isMobile ? undefined : { height: containerWidth ? containerHeight : 'auto', minHeight: '4rem' }}>- {ordered.map((item) => (- <GridCell- key={item.id}- item={item}- isMobile={isMobile}- editable={editable && containerWidth > 0}- sortable={sortable}- colWidth={colWidth}- isGridDragging={!isMobile && dragGhost?.id === item.id}- gridDragActive={Boolean(dragGhost)}- onStartGridDrag={startDrag}- renderItem={renderItem}- />- ))}-- {/* Drop preview during the free-form drag — outline showing where- the item will land after snap. Pointer-events:none so it never- intercepts the gesture. */}- {!isMobile && dragGhost && containerWidth > 0 && (+ {ordered.map((item) => {+ const rect = rects.get(item.id);+ const { left, width } = columnRect(dragGhost?.id === item.id ? { ...item, ...dragGhost } : item, colWidth);+ // A cell's height comes from its content unless it is pinned OR is+ // the one currently being resized (where the drag, not the content,+ // is defining the height).+ const pinned = item.fixedH || (dragGhost?.id === item.id && dragGhost.kind === 'resize');+ return (+ <GridCell+ key={item.id}+ item={item}+ isMobile={isMobile}+ editable={editable && containerWidth > 0}+ sortable={sortable}+ left={left}+ top={rect?.top ?? 0}+ width={width}+ height={rect?.height ?? rowsToPx(item.h)}+ autoHeight={!pinned}+ isGridDragging={!isMobile && dragGhost?.id === item.id}+ suppressTransition={Boolean(dragGhost) || !settled}+ onStartGridDrag={startDrag}+ onClearFixedHeight={clearFixedHeight}+ onMeasure={onMeasure}+ renderItem={renderItem}+ />+ );+ })}++ {/* Drop preview during the free-form drag — outline over the packed+ position the item will actually land in. Pointer-events:none so+ it never intercepts the gesture. */}+ {!isMobile && dragGhost && containerWidth > 0 && rects.has(dragGhost.id) && (<divclassName="absolute pointer-events-none border-2 border-dashed border-port-accent rounded-xl bg-port-accent/10 z-30"- style={rectFor(dragGhost, colWidth)}+ style={{ ...columnRect(dragGhost, colWidth), ...rects.get(dragGhost.id) }}/>)}</div>diff --git a/client/src/components/dashboard/DashboardGrid.test.jsx b/client/src/components/dashboard/DashboardGrid.test.jsxindex 974f3b2f16..7a83dbe8bc 100644--- a/client/src/components/dashboard/DashboardGrid.test.jsx+++ b/client/src/components/dashboard/DashboardGrid.test.jsx@@ -1,5 +1,5 @@import { describe, it, expect, vi, beforeEach } from 'vitest';-import { render, screen } from '@testing-library/react';+import { fireEvent, render, screen } from '@testing-library/react';// Stub @dnd-kit/core's DndContext so drag-end can be fired imperatively. The// real implementation needs DOM measurement + pointer sensors, which jsdom@@ -41,7 +41,10 @@ vi.mock('@dnd-kit/sortable', async () => {});const DashboardGrid = (await import('./DashboardGrid.jsx')).default;-const { reflowToOrder, synthesizeGrid, reconcileGrid, readingOrderIds } = await import('./DashboardGrid.jsx');+const {+ reflowToOrder, synthesizeGrid, reconcileGrid, readingOrderIds,+ packVertically, itemHeightPx, rowsToPx, pxToRows,+} = await import('./DashboardGrid.jsx');// jsdom has no ResizeObserver, and useContainerWidth (which decides mobile vs// desktop) depends on one. Stand in a fake reporting whatever width the test@@ -78,6 +81,8 @@ function renderGrid(items = THREE) {return onChange;}+const cellFor = (id) => document.querySelector(`[data-widget-id="${id}"]`);+describe('reflowToOrder', () => {it('renumbers coordinates to match the requested order, keeping w/h', () => {const flowed = reflowToOrder(THREE, ['c', 'a', 'b']);@@ -114,6 +119,72 @@ describe('reflowToOrder', () => {});});+describe('row ↔ pixel conversion', () => {+ it('round-trips a row count through pixels', () => {+ for (const h of [1, 2, 5, 11]) expect(pxToRows(rowsToPx(h))).toBe(h);+ });++ it('never reports less than one row, even for a collapsed cell', () => {+ expect(pxToRows(0)).toBe(1);+ expect(pxToRows(-500)).toBe(1);+ });+});++describe('itemHeightPx', () => {+ const item = { id: 'a', x: 0, y: 0, w: 6, h: 4 };++ it('prefers the measured height so a short card stops reserving its whole slot', () => {+ expect(itemHeightPx(item, { a: 90 })).toBe(90);+ });++ it('falls back to the declared rows until a measurement lands', () => {+ expect(itemHeightPx(item, {})).toBe(rowsToPx(4));+ // A zero measurement means "not painted yet", not "zero tall".+ expect(itemHeightPx(item, { a: 0 })).toBe(rowsToPx(4));+ });++ it('ignores the measurement for a cell whose height the user pinned', () => {+ expect(itemHeightPx({ ...item, fixedH: true }, { a: 90 })).toBe(rowsToPx(4));+ });+});++describe('packVertically', () => {+ it('floats a cell up into the space a shorter neighbour left behind', () => {+ // b is declared 4 rows tall but only measures 100px — c must rise to just+ // under b rather than sitting at b's declared bottom edge.+ const rects = packVertically(+ [+ { id: 'b', x: 0, y: 0, w: 12, h: 4 },+ { id: 'c', x: 0, y: 4, w: 12, h: 2 },+ ],+ { b: 100, c: 100 }+ );+ expect(rects.get('b')).toEqual({ top: 0, height: 100 });+ expect(rects.get('c')).toEqual({ top: 116, height: 100 });+ });++ it('only stacks cells that share a column', () => {+ const rects = packVertically([+ { id: 'left', x: 0, y: 0, w: 6, h: 2 },+ { id: 'right', x: 6, y: 0, w: 6, h: 2 },+ { id: 'under', x: 6, y: 2, w: 6, h: 2 },+ ], { left: 400, right: 100, under: 100 });+ // `right` is beside `left`, not below it — a tall left column must not+ // push the whole right-hand stack down.+ expect(rects.get('right').top).toBe(0);+ expect(rects.get('under').top).toBe(116);+ });++ it('clears every cell it overlaps, not just the last one placed', () => {+ const rects = packVertically([+ { id: 'a', x: 0, y: 0, w: 4, h: 2 },+ { id: 'b', x: 4, y: 0, w: 4, h: 2 },+ { id: 'wide', x: 0, y: 2, w: 8, h: 2 },+ ], { a: 300, b: 100, wide: 100 });+ expect(rects.get('wide').top).toBe(316);+ });+});+describe('readingOrderIds', () => {it('sorts top-to-bottom then left-to-right without mutating the input', () => {const grid = [@@ -197,6 +268,92 @@ describe('DashboardGrid desktop', () => {});});+describe('DashboardGrid cell sizing', () => {+ beforeEach(() => { mockWidth = 1200; });++ // Every cell is laid out at exactly the height the pack assigned it — an+ // auto cell that sized itself would overlap its neighbours for every frame+ // its content was taller than the last measurement.+ it('lays every cell out at its packed height, and stacks from the pack', () => {+ renderGrid();+ expect(cellFor('a').style.height).toBe(`${rowsToPx(2)}px`);+ expect(cellFor('a').style.top).toBe('0px');+ expect(cellFor('b').style.top).toBe(`${rowsToPx(2) + 16}px`);+ });++ it('measures the widget free of the cell height, and stretches it when pinned', () => {+ renderGrid([+ { id: 'a', x: 0, y: 0, w: 12, h: 3 },+ { id: 'b', x: 0, y: 3, w: 12, h: 3, fixedH: true },+ ]);+ const measured = (id) => screen.getByTestId(`widget-${id}`).parentElement;+ expect(measured('a').className).toBe('flow-root');+ expect(measured('b').className).toBe('h-full flow-root');+ });++ it('honors an explicit height on a cell the user pinned', () => {+ renderGrid([{ id: 'a', x: 0, y: 0, w: 12, h: 3, fixedH: true }]);+ expect(cellFor('a').style.height).toBe(`${rowsToPx(3)}px`);+ });++ it('offers the auto-fit handle only on pinned cells', () => {+ renderGrid([+ { id: 'a', x: 0, y: 0, w: 12, h: 3, fixedH: true },+ { id: 'b', x: 0, y: 3, w: 12, h: 3 },+ ]);+ expect(screen.getByLabelText('Auto-fit height a')).toBeInTheDocument();+ expect(screen.queryByLabelText('Auto-fit height b')).not.toBeInTheDocument();+ });++ it('drops the pin — and keeps the last height as the new starting size — on auto-fit', () => {+ const onChange = renderGrid([+ { id: 'a', x: 0, y: 0, w: 12, h: 3, fixedH: true },+ { id: 'b', x: 0, y: 3, w: 12, h: 3 },+ ]);+ fireEvent.click(screen.getByLabelText('Auto-fit height a'));+ const next = onChange.mock.calls[0][0];+ expect(next.find((it) => it.id === 'a')).toEqual({ id: 'a', x: 0, y: 0, w: 12, h: 3 });+ expect(next.find((it) => it.id === 'b').fixedH).toBeUndefined();+ });+});++describe('DashboardGrid resize pins the height', () => {+ beforeEach(() => { mockWidth = 1200; });++ // One row step is ROW_HEIGHT_PX + GAP_PX; the drag rounds to it.+ const ROW_STEP = rowsToPx(2) - rowsToPx(1);++ const dragHandle = (label, { dx = 0, dy = 0 }) => {+ fireEvent.pointerDown(screen.getByLabelText(label), { clientX: 0, clientY: 0 });+ fireEvent.pointerMove(window, { clientX: dx, clientY: dy });+ fireEvent.pointerUp(window);+ };++ it('marks a cell fixedH once the user drags a height onto it', () => {+ const onChange = renderGrid();+ dragHandle('Resize a', { dy: ROW_STEP * 2 });+ const moved = onChange.mock.calls[0][0].find((it) => it.id === 'a');+ expect(moved.h).toBe(4);+ expect(moved.fixedH).toBe(true);+ });++ it('leaves a width-only resize auto-sized', () => {+ const onChange = renderGrid([{ id: 'a', x: 0, y: 0, w: 12, h: 2 }]);+ // Narrow by four columns; the height never moves.+ dragHandle('Resize a', { dx: -4 * (1200 - 16 * 11) / 12 - 4 * 16 });+ const moved = onChange.mock.calls[0][0].find((it) => it.id === 'a');+ expect(moved.w).toBe(8);+ expect(moved.fixedH).toBeUndefined();+ });++ it('leaves a move auto-sized', () => {+ const onChange = renderGrid();+ dragHandle('Move c', { dy: -ROW_STEP * 4 });+ expect(onChange).toHaveBeenCalled();+ for (const it of onChange.mock.calls[0][0]) expect(it.fixedH).toBeUndefined();+ });+});+describe('DashboardGrid scroll target', () => {beforeEach(() => { mockWidth = 1200; });diff --git a/client/src/components/dashboard/builtins/AppsGridWidget.jsx b/client/src/components/dashboard/builtins/AppsGridWidget.jsxindex e942e589b2..f84e4a0233 100644--- a/client/src/components/dashboard/builtins/AppsGridWidget.jsx+++ b/client/src/components/dashboard/builtins/AppsGridWidget.jsx@@ -1,6 +1,6 @@import { Link } from 'react-router';import AppTile from '../../AppTile';-import { SchematicLabel, MicroGlyph } from '../../micrographics';+import { MicroGlyph } from '../../micrographics';export default function AppsGridWidget({ dashboardState }) {const { apps, sortedApps, activeApps, refetch } = dashboardState;@@ -8,13 +8,6 @@ export default function AppsGridWidget({ dashboardState }) {if (apps.length === 0) {return (<div className="relative bg-port-card border border-port-border rounded-xl p-8 sm:p-12 text-center">- <SchematicLabel- module="03"- status="EMPTY"- glyph="bracket-pair"- state="idle"- variant="tab"- /><div className="flex justify-center mb-4 text-port-accent/70"><MicroGlyph variant="reticle" size={48} state="accent" /></div>diff --git a/client/src/components/dashboard/widgetRegistry.jsx b/client/src/components/dashboard/widgetRegistry.jsxindex 5f061734fe..a6b09579f6 100644--- a/client/src/components/dashboard/widgetRegistry.jsx+++ b/client/src/components/dashboard/widgetRegistry.jsx@@ -29,21 +29,15 @@ const MeatSpaceStreakWidget = lazyWithReload(() => import('./builtins/MeatSpaceSconst AutoFixMetricsWidget = lazyWithReload(() => import('./builtins/AutoFixMetricsWidget'));const DailyDriverWidget = lazyWithReload(() => import('./builtins/DailyDriverWidget'));-// Each entry: { id, label, Component, width, defaultH?, gate?, module? }.+// Each entry: { id, label, Component, width, defaultH?, gate? }.// `gate(state) => bool` skips the widget when it has nothing useful to show.// The Apps tile is intentionally un-gated — it renders its own empty-state// CTA so the "add your first app" path is always visible on a blank install.//-// `defaultH` is the row count (each row ≈ 80px) used when a widget is-// auto-placed into the grid for the first time — picked from the widget's-// natural content height so unmigrated layouts and newly-added widgets land-// at a usable size instead of the generic h=4 fallback. Once a layout has-// been edited, persisted h values win.-//-// `module` is optional micrographic chrome — when set, the dashboard-// renders a SchematicLabel ("MODULE.04 // ALERTS ●") as a tab on the-// widget's top border. Several widgets carry this by default; the rest are-// label-free so the dashboard doesn't turn into a wall of HUD chrome.+// `defaultH` is the row count (each row ≈ 80px) used when a widget is first+// auto-placed into a grid. It is a STARTING size, not the rendered height:+// dashboard cells measure their content and float up (see DashboardGrid), so+// this only has to be in the right ballpark for the first paint.export const WIDGETS = [// Daily Driver self-hides once the day is handled — gated on the per-day// first-visit/handled state so a handled day reserves no grid cell (#2666).@@ -52,26 +46,26 @@ export const WIDGETS = [{ id: 'quick-idea', label: 'Quick Idea (Catalog)', Component: QuickIdeaCapture, width: 'half', defaultH: 4 },{ id: 'quick-image', label: 'Quick Image Prompt', Component: QuickImagePrompt, width: 'half', defaultH: 6 },{ id: 'quick-task', label: 'Quick Task', Component: QuickTaskWidget, width: 'half', defaultH: 5 },- { id: 'apps', label: 'Apps Grid', Component: AppsGridWidget, width: 'full', defaultH: 5, module: { id: '03', status: 'APPS', glyph: 'matrix' } },- { id: 'cos', label: 'Chief of Staff', Component: CosDashboardWidget, width: 'third', defaultH: 6, module: { id: '02', status: 'STAFF', glyph: 'orbit' } },+ { id: 'apps', label: 'Apps Grid', Component: AppsGridWidget, width: 'full', defaultH: 5 },+ { id: 'cos', label: 'Chief of Staff', Component: CosDashboardWidget, width: 'third', defaultH: 6 },{ id: 'goal-progress', label: 'Goal Progress', Component: GoalProgressWidget, width: 'third', defaultH: 5 },{ id: 'upcoming-tasks', label: 'Upcoming Tasks', Component: UpcomingTasksWidget, width: 'third', defaultH: 5 },- { id: 'proactive-alerts', label: 'Proactive Alerts', Component: ProactiveAlertsWidget, width: 'quarter', defaultH: 4, module: { id: '04', status: 'ALERTS', glyph: 'warning-tri' } },- { id: 'review-hub', label: 'Review Hub', Component: ReviewHubCard, width: 'quarter', defaultH: 4, module: { id: '05', status: 'REVIEW', glyph: 'reticle' } },- { id: 'while-away', label: 'While You Were Away', Component: WhileAwayWidget, width: 'third', defaultH: 5, module: { id: '08', status: 'AWAY', glyph: 'orbit' } },- { id: 'system-health', label: 'System Health', Component: SystemHealthWidget, width: 'quarter', defaultH: 8, module: { id: '01', status: 'HEALTH', glyph: 'matrix' } },- { id: 'network-exposure', label: 'Network Exposure', Component: NetworkExposureWidget, width: 'quarter', defaultH: 5, module: { id: '07', status: 'EXPOSURE', glyph: 'reticle' } },+ { id: 'proactive-alerts', label: 'Proactive Alerts', Component: ProactiveAlertsWidget, width: 'quarter', defaultH: 4 },+ { id: 'review-hub', label: 'Review Hub', Component: ReviewHubCard, width: 'quarter', defaultH: 4 },+ { id: 'while-away', label: 'While You Were Away', Component: WhileAwayWidget, width: 'third', defaultH: 5 },+ { id: 'system-health', label: 'System Health', Component: SystemHealthWidget, width: 'quarter', defaultH: 8 },+ { id: 'network-exposure', label: 'Network Exposure', Component: NetworkExposureWidget, width: 'quarter', defaultH: 5 },{ id: 'backup', label: 'Backup', Component: BackupWidget, width: 'quarter', defaultH: 5 },{ id: 'death-clock', label: 'Death Clock', Component: DeathClockWidget, width: 'quarter', defaultH: 4 },{ id: 'daily-post', label: 'Daily POST', Component: DailyPostWidget, width: 'quarter', defaultH: 3 },{ id: 'tribe-care', label: 'Tribe Care', Component: TribeCareWidget, width: 'quarter', defaultH: 4, gate: (s) => !!s.tribeCare?.hasPeople },{ id: 'quick-stats', label: 'Quick Stats', Component: QuickStatsWidget, width: 'quarter', defaultH: 3, gate: (s) => s.apps.length > 0 },{ id: 'decision-log', label: 'Decision Log', Component: DecisionLogWidget, width: 'quarter', defaultH: 4 },- { id: 'activity-streak', label: 'Activity Streak', Component: ActivityStreakWidget, width: 'third', defaultH: 3, gate: (s) => s.usage?.currentStreak > 0 || s.usage?.longestStreak > 0, module: { id: '06', status: 'STREAK', glyph: 'spark' } },+ { id: 'activity-streak', label: 'Activity Streak', Component: ActivityStreakWidget, width: 'third', defaultH: 3, gate: (s) => s.usage?.currentStreak > 0 || s.usage?.longestStreak > 0 },{ id: 'hourly-activity', label: 'Activity by Hour', Component: HourlyActivityWidget, width: 'full', defaultH: 4, gate: (s) => !!s.usage?.hourlyActivity && s.usage.hourlyActivity.some((v) => v > 0) },{ id: 'feeds', label: 'Feeds Digest', Component: FeedsWidget, width: 'quarter', defaultH: 4, gate: (s) => (s.feeds?.totalFeeds ?? 0) > 0 },{ id: 'meatspace-streak', label: 'Health Logging Streak', Component: MeatSpaceStreakWidget, width: 'third', defaultH: 4, gate: (s) => (s.meatspaceLogging?.totalLogged ?? 0) > 0 },- { id: 'autofix-metrics', label: 'Auto-Fix Telemetry', Component: AutoFixMetricsWidget, width: 'quarter', defaultH: 5, module: { id: '09', status: 'AUTOFIX', glyph: 'warning-tri' } },+ { id: 'autofix-metrics', label: 'Auto-Fix Telemetry', Component: AutoFixMetricsWidget, width: 'quarter', defaultH: 5 },];export const WIDGETS_BY_ID = Object.fromEntries(WIDGETS.map((w) => [w.id, w]));diff --git a/client/src/pages/Dashboard.jsx b/client/src/pages/Dashboard.jsxindex 13b84f624e..08dac0eb8c 100644--- a/client/src/pages/Dashboard.jsx+++ b/client/src/pages/Dashboard.jsx@@ -8,9 +8,8 @@ import WidgetSuggestions from '../components/dashboard/WidgetSuggestions';import DashboardGrid, { readingOrderIds, reconcileGrid, synthesizeGrid } from '../components/dashboard/DashboardGrid.jsx';import { WIDGETS_BY_ID, FALLBACK_LAYOUT } from '../components/dashboard/widgetRegistry.jsx';import WidgetSkeleton from '../components/dashboard/WidgetSkeleton';-import { SchematicLabel } from '../components/micrographics';import { DASHBOARD_LAYOUT_CHANGED } from '../constants/events.js';-import { GripHorizontal, Monitor, Move, Save, X } from 'lucide-react';+import { ChevronsDownUp, GripHorizontal, Monitor, Move, Save, X } from 'lucide-react';import * as api from '../services/api';import socket from '../services/socket';import toast from '../components/ui/Toast';@@ -250,29 +249,11 @@ export default function Dashboard() {const meta = WIDGETS_BY_ID[item.id];if (!meta) return null;// Per-cell Suspense so a slow widget can't block sibling cells.- const widget = (+ return (<Suspense fallback={<WidgetSkeleton label={meta.label} />}><meta.Component dashboardState={dashboardState} /></Suspense>);- if (!meta.module) return widget;- // Tab sits inside the wrapper (DashboardGrid clips with overflow-hidden);- // sm:pt-4 reserves a header zone so the tab doesn't overlap widget- // header content.- return (- <div className="relative h-full sm:pt-4">- <span className="hidden sm:inline">- <SchematicLabel- module={meta.module.id}- status={meta.module.status}- glyph={meta.module.glyph}- state="active"- variant="tab"- />- </span>- {widget}- </div>- );}, [dashboardState]);// Once a just-added widget lands in the rendered grid, scroll it into view@@ -402,8 +383,6 @@ export default function Dashboard() {if (loading) {return (- // No BOOTING SchematicLabel here: it exists only while loading, so its- // height is exactly the shift this skeleton is meant to eliminate.<PageSkeletonlabel="Loading dashboard"headerRowClass="flex flex-row items-center justify-between gap-2 sm:gap-4"@@ -539,7 +518,10 @@ export default function Dashboard() {) : (<>Drag the <Move size={12} className="inline mx-0.5" /> handle to move widgets, or- the <span className="inline-block px-1">↘</span> handle to resize.+ the <span className="inline-block px-1">↘</span> handle to resize. Widgets size+ themselves to their content and float up into the space above — dragging a+ widget's height pins it, and the{' '}+ <ChevronsDownUp size={12} className="inline mx-0.5" /> handle hands it back.</>)}{' '}Click <strong className="text-white">Save layout</strong> when you're done.diff --git a/server/routes/dashboardLayouts.js b/server/routes/dashboardLayouts.jsindex e269cdab65..ad17c6442a 100644--- a/server/routes/dashboardLayouts.js+++ b/server/routes/dashboardLayouts.js@@ -28,6 +28,10 @@ const gridItemSchema = z.object({y: z.number().int().min(0).max(svc.GRID_ROW_MAX),w: z.number().int().min(1).max(svc.GRID_COLS),h: z.number().int().min(1).max(svc.GRID_ITEM_H_MAX),+ // Set when the user pinned this cell's height by dragging it. Absent means+ // the dashboard sizes the cell to its content (and treats `h` as the+ // first-paint fallback) — see DashboardGrid.jsx.+ fixedH: z.boolean().optional(),});// Time-window strings (HH:MM, 24h). The route accepts `null` to clear andiff --git a/server/services/dashboardLayouts.js b/server/services/dashboardLayouts.jsindex 895f750773..adecafa5dd 100644--- a/server/services/dashboardLayouts.js+++ b/server/services/dashboardLayouts.js@@ -238,6 +238,12 @@ const sanitizeActivateWindow = (w) => {// unusable (missing id, non-numeric coords, etc.). Numeric fields are// floored before clamping so JSON containing decimals can't smuggle in// off-grid positions that break the snap math in the client renderer.+//+// `fixedH` marks a cell whose height the user pinned by dragging it. Absent+// (the default) means the client sizes the cell to its content and floats it+// up, using `h` only as the first-paint fallback — which is also what a+// client too old to know about `fixedH` renders. Emitted only when true so a+// hand-read layouts file stays terse.const sanitizeGridItem = (g, validIds) => {if (!g || typeof g !== 'object') return null;if (typeof g.id !== 'string') return null;@@ -249,7 +255,7 @@ const sanitizeGridItem = (g, validIds) => {const wRaw = Math.max(1, Math.min(GRID_COLS, numOr(g.w, 1)));const w = Math.min(wRaw, GRID_COLS - x);const h = Math.max(1, Math.min(GRID_ITEM_H_MAX, numOr(g.h, 1)));- return { id, x, y, w, h };+ return { id, x, y, w, h, ...(g.fixedH === true ? { fixedH: true } : {}) };};// Sanitize a single layout entry — protect against hand-edits that producediff --git a/server/services/dashboardLayouts.test.js b/server/services/dashboardLayouts.test.jsindex 19efcf9df1..6ba39ae877 100644--- a/server/services/dashboardLayouts.test.js+++ b/server/services/dashboardLayouts.test.js@@ -176,6 +176,39 @@ describe('dashboardLayouts service', () => {});});+ describe('grid item fixedH', () => {+ it('round-trips the pin the user dragged onto a cell', async () => {+ await svc.saveLayout({+ id: 'my-custom',+ name: 'Custom',+ widgets: ['cos', 'backup'],+ grid: [+ { id: 'cos', x: 0, y: 0, w: 6, h: 4, fixedH: true },+ { id: 'backup', x: 6, y: 0, w: 6, h: 4 },+ ],+ });+ const saved = (await svc.getState()).layouts.find((l) => l.id === 'my-custom');+ expect(saved.grid[0].fixedH).toBe(true);+ // Absent means auto-height — the key must not materialize as `false`,+ // which would read as an explicit (and wrong) "pinned" flag elsewhere.+ expect('fixedH' in saved.grid[1]).toBe(false);+ });++ it('drops a non-boolean fixedH from a hand-edited file', async () => {+ writeJson(STATE_FILE, {+ activeLayoutId: 'my-custom',+ layouts: [{+ id: 'my-custom',+ name: 'Custom',+ widgets: ['cos'],+ grid: [{ id: 'cos', x: 0, y: 0, w: 6, h: 4, fixedH: 'yes' }],+ }],+ });+ const saved = (await svc.getState()).layouts.find((l) => l.id === 'my-custom');+ expect('fixedH' in saved.grid[0]).toBe(false);+ });+ });+describe('built-in layout grids have no overlapping cells', () => {// Regression: a hand-tuned grid edit can place two widgets in the same// rows/cols, so fresh installs render stacked cards. Every built-in