refactor(frontend): extract useTheme, useNotifications, useContainerStats hooks from EditorLayout (#903)

* refactor(frontend): add useViewNavigationState hook with tests

* refactor(frontend): wire useViewNavigationState into EditorLayout

* test(frontend): add skipper tier and handleOpenSettings no-arg coverage

* refactor(frontend): extract useTheme hook from EditorLayout

* refactor(frontend): extract useNotifications hook from EditorLayout

* refactor(frontend): extract useContainerStats hook, remove containerStats from useEditorViewState

* refactor(frontend): wire useTheme, useNotifications, useContainerStats into EditorLayout

Removes all extracted effect clusters from EditorLayout.tsx and replaces
them with calls to the three new focused hooks. Extracted code removed:
- theme useState + 2 effects (system dark-mode listener, DOM class sync)
- fetchNotifications, fetchNotificationsRef, markAllRead, deleteNotification,
  clearAllNotifications, and 5 notification effects (local WS, nodes refetch,
  remote per-node WS, remote cleanup, 60s safety-net poll)
- container stats useEffect with 1.5s flush interval
- formatBytes utility (moved to useContainerStats)
- fetchForNode import (no longer used at this level)

EditorLayout now at 17 useState / 4 useEffect, both under the <20 / <10
acceptance criteria required before the B4-7 shell PR.
This commit is contained in:
Anso
2026-05-03 21:20:11 -04:00
committed by GitHub
parent 0a126e74a7
commit 6d4709db86
9 changed files with 705 additions and 432 deletions
@@ -32,7 +32,6 @@ describe('useEditorViewState', () => {
const { result } = renderHook(() => useEditorViewState());
expect(result.current.envFiles).toEqual([]);
expect(result.current.containers).toEqual([]);
expect(result.current.containerStats).toEqual({});
expect(result.current.gitSourcePendingMap).toEqual({});
});