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:
@@ -9,23 +9,19 @@ import (
|
||||
)
|
||||
|
||||
// RenderStatusBar renders the bottom status bar.
|
||||
func RenderStatusBar(width int, filterInfo string, dataAge string) string {
|
||||
func RenderStatusBar(width int, dataAge string) string {
|
||||
t := theme.Active
|
||||
|
||||
style := lipgloss.NewStyle().
|
||||
Foreground(t.TextMuted).
|
||||
Width(width)
|
||||
|
||||
left := " [f]ilter [?]help [q]uit"
|
||||
left := " [?]help [q]uit"
|
||||
right := ""
|
||||
if dataAge != "" {
|
||||
right = fmt.Sprintf("Data: %s ", dataAge)
|
||||
}
|
||||
|
||||
if filterInfo != "" {
|
||||
left += " " + filterInfo
|
||||
}
|
||||
|
||||
// Pad middle
|
||||
padding := width - lipgloss.Width(left) - lipgloss.Width(right)
|
||||
if padding < 0 {
|
||||
|
||||
Reference in New Issue
Block a user