Skip to content
This repository was archived by the owner on Sep 2, 2026. It is now read-only.

[Spec] Sidebar usage gauge - #58

Merged
64ix merged 7 commits into
mainfrom
spec/30-sidebar-usage-gauge
Aug 24, 2026
Merged

64ix merged 7 commits into
mainfrom
spec/30-sidebar-usage-gauge

Conversation

@64ix

@64ix 64ix commented Aug 23, 2026 •

Copy link
Copy Markdown
Owner
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​246 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​246
Prod 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​185 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​185

Summary

  • Adds a quiet, monochrome usage gauge to the left sidebar footer that renders existing feature-interaction telemetry — UI placement only; nothing new is recorded.

Spec & Tickets

Criteria

Criterion Verdict Evidence
Gauge renders real counts from the existing feature-interaction telemetry store ✅ getSidebarUsageGaugeRows rolls state.featureInteractions into category totals; tests sums feature interactions into category totals…, renders real category counts and monochrome bars from the store
Stays empty/quiet when data is missing ✅ Model returns [] for {}/null/undefined; component returns null; tests stays empty when the telemetry store has no records, renders nothing when the telemetry store has no records
Placement/styling follow restrained-surface guidance ✅ Sidebar footer strip above the toolbar; STYLEGUIDE 11px/600/uppercase/0.05em caption; only worktree-sidebar-foreground opacity tiers + muted-foreground; no new tokens
Does not compete with the workspace list visually ✅ ≤4 hairline rows (SIDEBAR_USAGE_GAUGE_MAX_ROWS = 4), monochrome grays, below the scrollable WorktreeList

Changes

View-model seam (sidebar-usage-gauge-model.ts)

  • Category rollup of FeatureInteractionState, heaviest-first with catalog-order tie-break, capped at 4 rows, shareOfMax bar math with a 3% minimum visible width for nonzero shares (getSidebarUsageGaugeBarWidthPercent).
  • Table-driven labels (SIDEBAR_USAGE_GAUGE_ROW_LABELS) resolved at render time so language switches apply.

Component (SidebarUsageGauge.tsx)

  • Memo component subscribing useAppStore((s) => s.featureInteractions); caption + up to 4 label/count/bar rows; renders nothing on empty state.

Wiring & i18n

  • Mounted first in the sidebar's fixed bottom block (index.tsx); 16 auto i18n keys in en.json.

Tests

  • Model: rollup/ranking/tie-break/cap/malformed-record drop/bar-width clamping.
  • Component (happy-dom): empty-state null render, real counts + relative bars, store-update rerenders, outlier-bar visibility.

Decisions recorded

  • Raw interactionCount feeds the gauge (usage-bucket primitives are analytics emission ranges) → satisfies "real counts" + "no new collection".
  • Row cap of 4 keeps the gauge a quiet strip at the 220px min sidebar width.
  • Category rollup over per-feature rows: 15 stable buckets vs ~55 volatile ids.
  • Label switch tabled via thunks because the extractor requires literal args on translate() calls.
  • Render-time label resolution fixes stale-language memo (mirrors SidebarToolbar pattern).

QA plan

  • With fresh state (no interactions): sidebar shows no gauge at all — no caption, no reserved space.
  • After using a few features (terminal, board, tasks): gauge shows up to 4 category rows, heaviest first, counts match real usage, bars proportional.
  • With one dominant feature (e.g., 300 vs 1 interactions): smallest nonzero bar is still faintly visible, not 0%.
  • Switch app language while the gauge is visible: labels re-translate without remount.
  • Resize sidebar to minimum width (220px): rows truncate cleanly, no overflow or layout shift in the workspace list above.

64ix added 7 commits August 23, 2026 09:59
Rolls store feature interactions up to category totals for ticket #36;
pure seam so ranking/cap/share logic is unit-testable without React.
SidebarUsageGauge reads featureInteractions from the app store and
renders top categories as monochrome thin bars; renders nothing when
the store is empty (ticket #36). Adds en catalog keys for the new copy.
Rows stay translation-free in the memo; labels re-translate on
useTranslation-driven rerenders instead of freezing at first compute.
…ible

Collapse the 15-case label switch into a Record of lazy translate()
thunks so keys stay literal for i18n extraction (#36). Clamp nonzero
bar widths up to the smallest visible percent so heavy outliers don't
round small categories to invisible 0% bars.
@64ix
64ix marked this pull request as ready for review August 23, 2026 08:54
@64ix
64ix merged commit feeba46 into main Aug 24, 2026
95 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sidebar usage gauge [Spec] Sidebar usage gauge

1 participant