cleanup model View() a bit

remove some cruft and verbosity and weird order of things
This commit is contained in:
Lilian Jónsdóttir 2024-07-28 23:36:40 -07:00
parent 1a03f7f23f
commit 50e8c992d1

View file

@ -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 {