From 50e8c992d14182fa511c655a53cecfb8d7bf9ed1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lilian=20J=C3=B3nsd=C3=B3ttir?= Date: Sun, 28 Jul 2024 23:36:40 -0700 Subject: [PATCH] cleanup model View() a bit remove some cruft and verbosity and weird order of things --- internal/interactive/interactive.go | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/internal/interactive/interactive.go b/internal/interactive/interactive.go index a5832a2..6b95279 100644 --- a/internal/interactive/interactive.go +++ b/internal/interactive/interactive.go @@ -222,22 +222,15 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { return m, cmd } -func (m model) View() (out string) { - var ( - n string - panels []string = []string{ - style.Render(m.table.View()), - } - ) - - panels = append(panels, m.footer()) +func (m model) View() string { + var panels []string if m.mode != modes.Listing { - panels = append([]string{m.header()}, panels...) + panels = append(panels, m.header()) } + panels = append(panels, style.Render(m.table.View()), m.footer()) - out = lipgloss.JoinVertical(lipgloss.Top, panels...) - return out + n + return lipgloss.JoinVertical(lipgloss.Top, panels...) } func (m model) showHelp() string {