From 1eddb851b08324c1fb1c6b638656404372ee8ea7 Mon Sep 17 00:00:00 2001 From: Tyler Koenig Date: Sat, 16 May 2026 14:35:38 -0400 Subject: [PATCH] feat(tui): add type icons to sites table MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Arrow-style icons per monitor type plus Nerd Font folder icons for groups (closed when collapsed, open when expanded): → http, ↓ push, ↔ ping, ⊡ port, ◆ dns, / group --- internal/tui/tab_sites.go | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/internal/tui/tab_sites.go b/internal/tui/tab_sites.go index 9417d9c..26816cb 100644 --- a/internal/tui/tab_sites.go +++ b/internal/tui/tab_sites.go @@ -15,6 +15,28 @@ import ( var sparkChars = []rune{'▁', '▂', '▃', '▄', '▅', '▆', '▇', '█'} +func typeIcon(siteType string, collapsed bool) string { + switch siteType { + case "http": + return "→" + case "push": + return "↓" + case "ping": + return "↔" + case "port": + return "⊡" + case "dns": + return "◆" + case "group": + if collapsed { + return "" + } + return "" + default: + return "·" + } +} + var siteGroupStyle = lipgloss.NewStyle(). Padding(0, 1). Bold(true). @@ -247,13 +269,10 @@ func (m Model) viewSitesTab() string { if site.Type == "group" { groupRows[i-start] = true - arrow := "▾" - if m.collapsed[site.ID] { - arrow = "▸" - } + icon := typeIcon("group", m.collapsed[site.ID]) rows = append(rows, []string{ strconv.Itoa(i + 1), - m.zones.Mark(fmt.Sprintf("site-%d", i), arrow+" "+limitStr(site.Name, nameW-2)), + m.zones.Mark(fmt.Sprintf("site-%d", i), icon+" "+limitStr(site.Name, nameW-2)), "group", fmtStatus(site.Status, site.Paused), subtleStyle.Render("—"), @@ -287,7 +306,7 @@ func (m Model) viewSitesTab() string { rows = append(rows, []string{ strconv.Itoa(i + 1), m.zones.Mark(fmt.Sprintf("site-%d", i), name), - site.Type, + typeIcon(site.Type, false) + " " + site.Type, fmtStatus(site.Status, site.Paused), fmtLatency(site.Latency), fmtUptime(hist.TotalChecks, hist.UpChecks), -- 2.52.0