feat(webui): layout schema for mobile overview + topbar items (B2)

Schema foundation for the B2 dashboard batch, mirroring the navItems shape:

- `overviewMobile: UiLayoutItem[]` — a separate single-column (id+visible)
  ordering for phones, kept fully disjoint from the desktop 2D `overviewBlocks`
  grid so mobile ordering never pollutes grid coords.
- `topbarItems: UiLayoutItem[]` — show/hide list for toggleable top-bar
  elements (status badge, theme toggle, kiosk button); essential elements stay
  pinned in the consumer.

Server `normalizeLayout` round-trips both (idOr + dedup, total over corrupt
input); defaults seed first run. `LayoutContext` exposes them with
setOverviewMobile/setTopbarItems setters and reconcile-on-consume semantics, so
adding a widget/element later just appears. Old configs lacking the fields fall
back to defaults on load.

Consumers (mobile render, topbar render + config, drag-sort panel) land in
follow-up B2 commits.
This commit is contained in:
DrSmoothl committed 2026-06-16 14:14:03 +08:00
1 parent 6d4e8538ea
commit 45d651614b
4 files changed
+83 -5

No files matched your search

@@ -61,6 +61,15 @@ export function defaultOverviewGrid(): UiLayoutItem[] {
return GRID_WIDGETS.map((w) => ({ id: w.id, visible: true, ...w.def }));
}
/** The widget ids in single-column (mobile) default order — same catalogue as
* the desktop grid, flattened. Mobile items carry id+visible only (no coords). */
export const MOBILE_WIDGET_IDS: readonly string[] = GRID_WIDGETS.map((w) => w.id);
/** Default single-column mobile overview (id+visible, no coords). */
export function defaultOverviewMobile(): UiLayoutItem[] {
return GRID_WIDGETS.map((w) => ({ id: w.id, visible: true }));
}
/**
* Bring any stored overview layout up to the current grid catalogue:
* - expand the legacy single `stats` block into the 5 individual tiles