feat(web-hud): seed default layout with orchestration widgets
All checks were successful
ci/woodpecker/push/web Pipeline was successful

This commit is contained in:
Jason Woltje
2026-02-17 16:07:09 -06:00
parent d34f097a5c
commit ab902250f8
2 changed files with 78 additions and 6 deletions

View File

@@ -14,6 +14,70 @@ const DEFAULT_LAYOUT_NAME = "default";
*/
const WORKSPACE_KEY = "mosaic-workspace-id";
function createDefaultLayout(): LayoutConfig {
return {
id: DEFAULT_LAYOUT_NAME,
name: "Default Layout",
layout: [
{
i: "tasks-1",
x: 0,
y: 0,
w: 2,
h: 3,
minW: 1,
minH: 2,
isDraggable: true,
isResizable: true,
},
{
i: "calendar-1",
x: 2,
y: 0,
w: 2,
h: 2,
minW: 1,
minH: 2,
isDraggable: true,
isResizable: true,
},
{
i: "agent-status-1",
x: 2,
y: 2,
w: 2,
h: 2,
minW: 1,
minH: 1,
isDraggable: true,
isResizable: true,
},
{
i: "orchestrator-events-1",
x: 0,
y: 3,
w: 2,
h: 2,
minW: 1,
minH: 1,
isDraggable: true,
isResizable: true,
},
{
i: "quick-capture-1",
x: 2,
y: 4,
w: 2,
h: 1,
minW: 1,
minH: 1,
isDraggable: true,
isResizable: true,
},
],
};
}
interface UseLayoutReturn {
layouts: Record<string, LayoutConfig>;
currentLayout: LayoutConfig | undefined;
@@ -45,7 +109,18 @@ export function useLayout(): UseLayoutReturn {
if (stored) {
const emptyFallback: Record<string, LayoutConfig> = {};
const parsed = safeJsonParse(stored, isLayoutConfigRecord, emptyFallback);
setLayouts(parsed as Record<string, LayoutConfig>);
const parsedLayouts = parsed as Record<string, LayoutConfig>;
if (Object.keys(parsedLayouts).length > 0) {
setLayouts(parsedLayouts);
} else {
setLayouts({
[DEFAULT_LAYOUT_NAME]: createDefaultLayout(),
});
}
} else {
setLayouts({
[DEFAULT_LAYOUT_NAME]: createDefaultLayout(),
});
}
// Load current layout ID preference
@@ -195,11 +270,7 @@ export function useLayout(): UseLayoutReturn {
const resetLayout = useCallback(() => {
setLayouts({
[DEFAULT_LAYOUT_NAME]: {
id: DEFAULT_LAYOUT_NAME,
name: "Default Layout",
layout: [],
},
[DEFAULT_LAYOUT_NAME]: createDefaultLayout(),
});
setCurrentLayoutId(DEFAULT_LAYOUT_NAME);
}, []);

View File

@@ -385,3 +385,4 @@
| ORCH-OBS-006 | done | Add `WidgetRenderer` regression tests for hyphenated widget IDs | #411 | web | feature/mosaic-stack-finalization | ORCH-OBS-005 | | orch | 2026-02-17T16:48Z | 2026-02-17T16:50Z | 5K | 3K |
| ORCH-OBS-007 | done | Add `OrchestratorEventsWidget` for live/recent orchestration visibility with Matrix signal hints | #411 | web | feature/mosaic-stack-finalization | ORCH-OBS-002 | | orch | 2026-02-17T16:55Z | 2026-02-17T17:03Z | 12K | 9K |
| ORCH-OBS-008 | done | Integrate new widget into HUD/WidgetRegistry and extend widget regression coverage | #411 | web | feature/mosaic-stack-finalization | ORCH-OBS-007 | | orch | 2026-02-17T17:03Z | 2026-02-17T17:08Z | 10K | 7K |
| ORCH-OBS-009 | done | Seed default/reset local HUD layout with orchestration widgets so visibility works out-of-box | #411 | web | feature/mosaic-stack-finalization | ORCH-OBS-008 | | orch | 2026-02-17T17:10Z | 2026-02-17T17:14Z | 8K | 6K |