Appearance
Dashboard viewport contract
Platform-wide rules so dashboards render correctly on phone, tablet, and desktop.
Source of truth
DashboardViewportProvider (frontend/src/features/dashboards/context/DashboardViewportContext.tsx) classifies window width with fixed constants (DASHBOARD_PHONE_MAX_WIDTH_PX, DASHBOARD_STACK_MAX_WIDTH_PX). First paint and resize use the same rule (no flash of the desktop grid on tablets). The dashboard canvas is still measured for surfaceWidth.
| Mode | Window width | Layout |
|---|---|---|
phone | ≤ 640px | Full-width 1-column stack |
tablet | ≤ 1280px | Fluid multi-column flow (see below) |
desktop | > 1280px | 48-col grid |
Phones stay one column. Tablets do not get a second drag layout — they use CSS auto-fill + minmax(~300px, 1fr) so different tablet widths get different column counts automatically (portrait often 1–2, wide landscape 2–4). Compact widgets (gauges, LEDs, counts, switches) share a row; charts, maps, tables, alarms lists, and SCADA stay full width. Laptops about 1366 px and up keep the grid. There is no per-dashboard layout toggle in this release.
Hooks:
useDashboardViewport()→mode,isStacked,isDesktop, …useDashboardCompact()→ alias ofisStacked(legacy)useWidgetMobileLayout()→ body helpers for stack vs gridgetTabletStackSpan(type)→half|fullfor tablet flow
How tablet widths are handled
One rule for all tablets — column floor in CSS pixels, not a fixed “always 2”:
--tablet-flow-col-min(default 300px) viaTABLET_FLOW_COL_MIN_PX- Browser lays out as many columns as fit:
repeat(auto-fill, minmax(min(100%, 300px), 1fr)) - Full-span widgets use
grid-column: 1 / -1
So a narrow portrait tab and a 1280 px landscape Idea Tab share the same code path; only the column count changes with width.
Phone discipline (not a second layout)
Phone stays one column. Curation is configuration, not a new editor:
- Visible on mobile — turn on only the ops strip (summary, alarms, key gauges). New widgets default hidden on mobile until enabled.
- Position on mobile — lower number appears first. Order the short strip: status → alarms → controls → charts last if needed.
- Prefer Solutions / demos that ship a short phone order; do not dump the full desktop board onto the phone.
- Edit on phone: ↑ ↓ reorder only (same saved
mobile.order).
Shell rules (WidgetContainer)
- Stacked (phone + tablet): auto height, overflow visible (prefer one page scroll; avoid nested scrollbars). Compact tiles use smaller stack minimums so count cards are not taller than their content.
- Desktop grid: fill tile; body may scroll only if content exceeds the tile.
- Layout edit works in both modes. Stacked edit uses ↑ ↓ to reorder (same saved layout /
mobile.order); desktop edit keeps drag-and-resize on the 48-col grid. Configure and delete work in both. There is no “widen the window” block.
App shell (sidebar)
On desktop/tablet shell (≥992 px), the left nav can fully hide. Use the edge arrow mid-screen or the header fold control. Preference is stored in the browser (autoconnecto:sidebar-collapsed). Hiding frees canvas width on tablets; it does not change the stack-vs-grid rule.
Rollback
- Revert
DashboardViewportContext.tsx,WidgetGrid.tsx,mobileWidgetSupport.ts(getTabletStackSpan),dashboardWidgetSurface.css/index.csstablet rules, and theDashboardPageedit-mode guards if touched. - Or temporarily force desktop:
<DashboardViewportProvider forcedMode="desktop">.
Confirmed vs next
Confirmed:
- Fixed window-based
phone|tablet|desktopmode switch (DASHBOARD_STACK_MAX_WIDTH_PX = 1280) - Phone = 1-col stack; tablet = fluid multi-col flow with full-span for large widgets
- Shared
WidgetContaineroverflow policy - Shared stack CSS for all registered widget types (
dashboardWidgetSurface.css) - Per-mode defaults: min stack height, chart height, desktop min grid rows (
mobileWidgetSupport.ts) - Desktop tiles enforce type
desktopMinRowsso short saved layouts do not clip chrome - Chart widgets use
ChartResponsiveArea(explicit stack plot height); Recharts CSS fallback remains for stragglers - Coverage: all registry types mapped in
MOBILE_WIDGET_MODES
Tables / alarm lists intentionally keep inner scroll (data-scroll="allow").
Not in this release: per-dashboard “stack below N px” choice, or separate widget arrangements per breakpoint (ThingsBoard-style layouts). Tablet fluid flow + phone show/order are the answer — not a second layout editor.
ThingsBoard comparison (study note)
ThingsBoard does not auto-stack the same grid into a single column at one width. It uses named breakpoints on each dashboard state, each with its own widget arrangement:
| TB breakpoint | CSS width |
|---|---|
| Mobile (xs) | ≤ 599 |
| Tablet (sm) | 600–959 |
| Laptop (md) | 960–1279 |
| Desktop (lg) | 1280–1919 |
| Desktop (xl) | 1920–5000 |
Widths are window.innerWidth CSS pixels (zoom / OS scaling change which band you land in). Per breakpoint you can hide widgets, change order/height, and keep config by reference (shared settings, independent position) or as a full copy.
Vs Autoconnecto today: phone = 1-col; tablet = one fluid flow (column count follows width); desktop = 48-col grid. Same widgets, same config, no per-width rearrange editor. Closer product match later would still avoid five full layout copies unless a paying customer needs them.
