|
| 1 | +// output-acts.js |
| 2 | +// Pure act model for the output tab. Groups the existing tab indices (the #t0..#t27 |
| 3 | +// panels) into four ordered "acts" — Decide, Understand, Go Deeper, Act — for a |
| 4 | +// two-tier nav. No DOM, no network, no imports: this is the testable contract the |
| 5 | +// nav rendering and show() build on. Tab indices and slugs are unchanged from the |
| 6 | +// existing TAB_SLUGS, so deep links and per-repo recall keep working. |
| 7 | + |
| 8 | +export const ACTS = [ |
| 9 | + { id: 'decide', label: 'Decide', tabs: [9] }, |
| 10 | + { id: 'understand', label: 'Understand', tabs: [0, 1, 2, 3, 4, 5, 8, 6, 7, 15] }, |
| 11 | + { id: 'deeper', label: 'Go Deeper', tabs: [10, 27, 11, 12, 13, 14, 21, 22, 23, 24] }, |
| 12 | + { id: 'act', label: 'Act', tabs: [25, 16, 17, 18, 19, 20, 26] }, |
| 13 | +]; |
| 14 | + |
| 15 | +export const ACT_ORDER = ACTS.map((a) => a.id); |
| 16 | + |
| 17 | +// Tab index → human label (mirrors the current nav button text; used to render |
| 18 | +// the secondary row from the model instead of hardcoded HTML). |
| 19 | +export const TAB_LABELS = { |
| 20 | + 9: 'Verdict', |
| 21 | + 0: 'ELI5', |
| 22 | + 1: 'Technical', |
| 23 | + 2: 'Use Cases', |
| 24 | + 3: 'Skip If', |
| 25 | + 4: 'Enables', |
| 26 | + 5: 'Pros / Cons', |
| 27 | + 8: 'Red Flags', |
| 28 | + 6: 'Alternatives', |
| 29 | + 7: 'Health', |
| 30 | + 15: 'Tech Stack', |
| 31 | + 10: 'Deep Dive', |
| 32 | + 27: 'Canvas', |
| 33 | + 11: 'Systems', |
| 34 | + 12: 'Ideate', |
| 35 | + 13: 'Prioritize', |
| 36 | + 14: 'SKTPG', |
| 37 | + 21: 'Docs Quality', |
| 38 | + 22: 'Maintenance', |
| 39 | + 23: 'License', |
| 40 | + 24: 'Since Last Scan', |
| 41 | + 25: 'Fits MY Stack?', |
| 42 | + 16: 'Similar', |
| 43 | + 17: 'Versus', |
| 44 | + 18: 'Synergies', |
| 45 | + 19: 'Connections', |
| 46 | + 20: 'Combine', |
| 47 | + 26: 'Ask', |
| 48 | +}; |
| 49 | + |
| 50 | +const ACT_BY_TAB = (() => { |
| 51 | + const m = {}; |
| 52 | + for (const a of ACTS) for (const t of a.tabs) m[t] = a.id; |
| 53 | + return m; |
| 54 | +})(); |
| 55 | + |
| 56 | +/** @returns {string|null} the act id owning tab `n`, or null. */ |
| 57 | +export function actForTab(n) { |
| 58 | + return Object.prototype.hasOwnProperty.call(ACT_BY_TAB, n) ? ACT_BY_TAB[n] : null; |
| 59 | +} |
| 60 | + |
| 61 | +/** @returns {number[]} the tab indices in an act, in display order. */ |
| 62 | +export function tabsForAct(id) { |
| 63 | + const a = ACTS.find((x) => x.id === id); |
| 64 | + return a ? a.tabs : []; |
| 65 | +} |
0 commit comments