feat: expand component library with bar chart, content cards, and layout helpers

Add BarChart component that renders multi-row Unicode bar charts with
anchored Y-axis labels, automatic tick-step computation, sub-sampling
for narrow terminals, and optional X-axis date labels. The chart
gracefully degrades to a sparkline when width/height is too small.

Add ContentCard, CardRow, and CardInnerWidth utilities for consistent
bordered card layout across all dashboard tabs. ContentCard renders
a lipgloss-bordered card with optional bold title; CardRow joins
pre-rendered cards horizontally; CardInnerWidth computes the usable
text width after accounting for border and padding.

Add LayoutRow helper that distributes a total width into n integer
widths that sum exactly, absorbing the integer-division remainder
into the first items -- eliminates off-by-one pixel drift in multi-
column layouts.

Refactor MetricCard to accept an outerWidth parameter and derive the
content width internally by subtracting border, replacing the old
raw-width parameter that required callers to do the subtraction.
MetricCardRow now uses LayoutRow for exact width distribution.

Refine TabBar to render all tabs on a single row when they fit within
the terminal width, falling back to the two-row layout only when
they overflow.

Simplify StatusBar by removing the unused filterInfo append that was
cluttering the left section.
This commit is contained in:
teernisse
2026-02-19 13:02:59 -05:00
parent 79ab17488e
commit 4d46977328
3 changed files with 337 additions and 15 deletions

View File

@@ -70,7 +70,13 @@ func RenderTabBar(activeIdx int, width int) string {
parts = append(parts, rendered)
}
// Split into two rows if needed
// Single row if all tabs fit
full := " " + strings.Join(parts, " ")
if lipgloss.Width(full) <= width {
return full
}
// Fall back to two rows
row1 := strings.Join(parts[:5], " ")
row2 := strings.Join(parts[5:], " ")