@@ -39,6 +39,7 @@ import { snapshotTrend, sparkline } from './snapshots.js';
3939import { introStageB , COPY } from './onboarding.js' ;
4040import { startCoachmark } from './coachmark.js' ;
4141import { clearDemoEverywhere , isDemo } from './demo-repo.js' ;
42+ import { ACTS , TAB_LABELS , actForTab , tabsForAct } from './output-acts.js' ;
4243
4344// Apply the saved theme ASAP (before render) to minimise flash.
4445initTheme ( ) ;
@@ -2207,6 +2208,27 @@ const TAB_SLUGS = {
22072208} ;
22082209const SLUG_TO_TAB = Object . fromEntries ( Object . entries ( TAB_SLUGS ) . map ( ( [ k , v ] ) => [ v , Number ( k ) ] ) ) ;
22092210
2211+ // Two-tier act nav: a primary row of acts, and a secondary row of the active
2212+ // act's tabs. Both are generated from the act model so the grouping has one
2213+ // source of truth. Buttons keep `data-tab` so the existing show() path is reused.
2214+ function renderActNav ( ) {
2215+ const nav = document . getElementById ( 'act-nav' ) ;
2216+ if ( ! nav ) return ;
2217+ nav . innerHTML = ACTS . map (
2218+ ( a ) => `<button class="act-tab" data-act="${ a . id } ">${ a . label } </button>` ,
2219+ ) . join ( '' ) ;
2220+ }
2221+
2222+ function renderSubNav ( actId ) {
2223+ const sub = document . getElementById ( 'act-subnav' ) ;
2224+ if ( ! sub ) return ;
2225+ const tabs = tabsForAct ( actId ) ;
2226+ // A single-tab act (Decide) needs no secondary row.
2227+ sub . innerHTML = tabs . length <= 1
2228+ ? ''
2229+ : tabs . map ( ( n ) => `<button class="tab-btn" data-tab="${ n } ">${ TAB_LABELS [ n ] } </button>` ) . join ( '' ) ;
2230+ }
2231+
22102232function show ( n , { updateHash = true } = { } ) {
22112233 document . querySelectorAll ( '.tab-btn' ) . forEach ( b => b . classList . toggle ( 'active' , Number ( b . dataset . tab ) === n ) ) ;
22122234 document . querySelectorAll ( '.tab-content' ) . forEach ( ( c , idx ) => c . classList . toggle ( 'active' , idx === n ) ) ;
@@ -2297,6 +2319,7 @@ function initScanTips() {
22972319 nav . addEventListener ( 'focusout' , hide ) ;
22982320}
22992321initScanTips ( ) ;
2322+ renderActNav ( ) ;
23002323
23012324// ─── "?" Guide overlay — feature discovery on demand ──────────────────────────
23022325// One small button; the overlay explains scanning, the tabs, every lens (from
0 commit comments