From 77fa6324f2ed0a2aef89ec6fdf20cdafee515052 Mon Sep 17 00:00:00 2001 From: Tyler Koenig Date: Thu, 14 May 2026 22:07:32 -0400 Subject: [PATCH] style(tui): add fixed column widths to sites table Use lipgloss StyleFunc to set per-column widths, with NAME as the flex column absorbing remaining space. History column tied to sparkWidth for consistency. --- internal/tui/tab_sites.go | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/internal/tui/tab_sites.go b/internal/tui/tab_sites.go index 3a590a0..2656613 100644 --- a/internal/tui/tab_sites.go +++ b/internal/tui/tab_sites.go @@ -298,6 +298,9 @@ func (m Model) viewSitesTab() string { tableWidth = 40 } + // column widths: #=6, name=flex, type=10, status=10, latency=8, uptime=8, history=sparkWidth+4, ssl=7, retry=9 + colWidths := []int{6, 0, 10, 10, 8, 8, sparkWidth + 4, 7, 9} + t := table.New(). Border(lipgloss.RoundedBorder()). BorderStyle(siteBorderStyle). @@ -305,16 +308,20 @@ func (m Model) viewSitesTab() string { Headers("#", "NAME", "TYPE", "STATUS", "LATENCY", "UPTIME", "HISTORY", "SSL", "RETRY"). Rows(rows...). StyleFunc(func(row, col int) lipgloss.Style { + var base lipgloss.Style if row == table.HeaderRow { - return siteHeaderStyle + base = siteHeaderStyle + } else if row == selectedVisual { + base = siteSelectedStyle + } else if isGroupRow(row) { + base = siteGroupStyle + } else { + base = siteCellStyle } - if row == selectedVisual { - return siteSelectedStyle + if col < len(colWidths) && colWidths[col] > 0 { + base = base.Width(colWidths[col]) } - if isGroupRow(row) { - return siteGroupStyle - } - return siteCellStyle + return base }) return "\n" + t.Render()