refactor(frontend): migrate agent stat-window selector to createTabStrip (#1464 step 1)

Replaces the agent stats page's bespoke window-tab click handler with the
shared createTabStrip (@hive/shared/tabs.js). The selector is now
hash-routed — #1h / #24h / … become deep-linkable and survive
back/forward navigation.

- window buttons use data-tab (was data-w); the strip resolves them by
  that convention and toggles .hive-tab--active + aria-selected.
- onShow(w) sets currentWindow + reloads stats; the strip's initial show
  fires it once, so the explicit loadStats() in DOMContentLoaded is
  dropped (avoids a double fetch).
- the selector keeps its distinct pill look — agent.css now targets
  .window-tabs button.hive-tab--active (was .active), not the shared
  .hive-tab text-tab base. It's a pure data-selector with no panes;
  createTabStrip skips the absent [data-tab-pane] gracefully.

Behaviour-preserving; aria-selected is now standardised on the buttons.
This commit is contained in:
iris 2026-06-08 22:32:17 +02:00 committed by mara
commit 0680f87d3d
3 changed files with 20 additions and 21 deletions

View file

@ -17,13 +17,13 @@
<h2 id="title">◆ … ◆</h2>
</div>
<div class="window-tabs" id="window-tabs">
<button data-w="1h">last 1h</button>
<button data-w="4h">last 4h</button>
<button data-w="24h" class="active">last 24h</button>
<button data-w="3d">last 3d</button>
<button data-w="7d">last 7d</button>
<button data-w="30d">last 30d</button>
<div class="window-tabs" id="window-tabs" role="tablist">
<button type="button" data-tab="1h">last 1h</button>
<button type="button" data-tab="4h">last 4h</button>
<button type="button" data-tab="24h">last 24h</button>
<button type="button" data-tab="3d">last 3d</button>
<button type="button" data-tab="7d">last 7d</button>
<button type="button" data-tab="30d">last 30d</button>
</div>
<div class="summary" id="summary"></div>