Commit f72996b

Ansari <ping@ansari.wtf>
2026-03-02 22:16:32
Refactor label rendering width
1 parent 8d627c8
Changed files (3)
internal
sections
policy
stats
ui
internal/sections/policy/view.go
@@ -15,19 +15,19 @@ func (m Model) View(policy ufw.Policy) string {
 
 	incomingLine := lipgloss.JoinHorizontal(
 		lipgloss.Left,
-		m.styles.Label.Render("Incoming:"),
+		m.styles.Label.Width(15).Render("Incoming:"),
 		incomingStyle.Render(policy.DefaultIncoming),
 	)
 
 	outgoingLine := lipgloss.JoinHorizontal(
 		lipgloss.Left,
-		m.styles.Label.Render("Outgoing:"),
+		m.styles.Label.Width(15).Render("Outgoing:"),
 		outgoingStyle.Render(policy.DefaultOutgoing),
 	)
 
 	routedLine := lipgloss.JoinHorizontal(
 		lipgloss.Left,
-		m.styles.Label.Render("Routed:"),
+		m.styles.Label.Width(15).Render("Routed:"),
 		routedStyle.Render(policy.DefaultRouted),
 	)
 
internal/sections/stats/view.go
@@ -23,19 +23,19 @@ func (m Model) View(stats ufw.Stats) string {
 
 	statusLine := lipgloss.JoinHorizontal(
 		lipgloss.Left,
-		m.styles.Label.Render("Status:"),
+		m.styles.Label.Width(15).Render("Status:"),
 		statusStyle.Render(statusText),
 	)
 
 	loggingLine := lipgloss.JoinHorizontal(
 		lipgloss.Left,
-		m.styles.Label.Render("Logging:"),
+		m.styles.Label.Width(15).Render("Logging:"),
 		m.styles.Value.Render(strings.ToUpper(stats.Logging)),
 	)
 
 	rulesLine := lipgloss.JoinHorizontal(
 		lipgloss.Left,
-		m.styles.Label.Render("Total Rules:"),
+		m.styles.Label.Width(15).Render("Total Rules:"),
 		m.styles.Value.Render(strconv.Itoa(stats.TotalRules)),
 	)
 
internal/ui/styles.go
@@ -111,8 +111,7 @@ func NewStyles() Styles {
 			Foreground(peach),
 
 		Label: lipgloss.NewStyle().
-			Foreground(subtext0).
-			Width(15),
+			Foreground(subtext0),
 
 		Value: lipgloss.NewStyle().
 			Foreground(text).