diff --git a/cmd/status/view.go b/cmd/status/view.go index 402cc80..a534028 100644 --- a/cmd/status/view.go +++ b/cmd/status/view.go @@ -134,6 +134,7 @@ func renderHeader(m MetricsSnapshot, errMsg string, animFrame int, termWidth int if termWidth <= 0 { termWidth = 80 } + compactHeader := termWidth <= 80 title := titleStyle.Render("Status") @@ -166,10 +167,10 @@ func renderHeader(m MetricsSnapshot, errMsg string, animFrame int, termWidth int if m.Hardware.RefreshRate != "" { infoParts = append(infoParts, m.Hardware.RefreshRate) } - if m.Hardware.OSVersion != "" { + if !compactHeader && m.Hardware.OSVersion != "" { infoParts = append(infoParts, m.Hardware.OSVersion) } - if m.Uptime != "" { + if !compactHeader && m.Uptime != "" { infoParts = append(infoParts, subtleStyle.Render("up "+m.Uptime)) } diff --git a/cmd/status/view_test.go b/cmd/status/view_test.go index 4531786..6dc06d4 100644 --- a/cmd/status/view_test.go +++ b/cmd/status/view_test.go @@ -958,6 +958,30 @@ func TestRenderHeaderWrapsOnNarrowWidth(t *testing.T) { } } +func TestRenderHeaderHidesOSAndUptimeOnNarrowWidth(t *testing.T) { + m := MetricsSnapshot{ + HealthScore: 91, + Hardware: HardwareInfo{ + Model: "MacBook Pro", + CPUModel: "Apple M3 Max", + TotalRAM: "128GB", + DiskSize: "4TB", + RefreshRate: "120Hz", + OSVersion: "macOS 15.0", + }, + Uptime: "10d 3h", + } + + header, _ := renderHeader(m, "", 0, 80, true) + plain := stripANSI(header) + if strings.Contains(plain, "macOS 15.0") { + t.Fatalf("renderHeader() narrow width should hide os version, got %q", plain) + } + if strings.Contains(plain, "up 10d 3h") { + t.Fatalf("renderHeader() narrow width should hide uptime, got %q", plain) + } +} + func TestRenderCardWrapsOnNarrowWidth(t *testing.T) { card := cardData{ icon: iconCPU,