From dd6f492032c27f89a0d8ae56d9735004b0e3c6ad Mon Sep 17 00:00:00 2001 From: Christian Rocha Date: Fri, 8 Jul 2022 19:21:03 -0700 Subject: [PATCH] chore: minor tidying up --- ui/components/header/header.go | 6 ++---- ui/ui.go | 8 ++------ 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/ui/components/header/header.go b/ui/components/header/header.go index b490ab1e3f64aac66777a2ec48bf79df10a1c822..32e9cf04496a9ec0edc20a381f13f59754c5f863 100644 --- a/ui/components/header/header.go +++ b/ui/components/header/header.go @@ -15,11 +15,10 @@ type Header struct { // New creates a new header component. func New(c common.Common, text string) *Header { - h := &Header{ + return &Header{ common: c, text: text, } - return h } // SetSize implements common.Component. @@ -39,6 +38,5 @@ func (h *Header) Update(msg tea.Msg) (tea.Model, tea.Cmd) { // View implements tea.Model. func (h *Header) View() string { - s := h.common.Styles.Header.Copy().Width(h.common.Width) - return s.Render(strings.TrimSpace(h.text)) + return h.common.Styles.ServerName.Render(strings.TrimSpace(h.text)) } diff --git a/ui/ui.go b/ui/ui.go index 052e5ad654904d1cbacc960f97645d7dde2f373a..23070282e2bbdd8a3d4e28cf9a59d289f350b988 100644 --- a/ui/ui.go +++ b/ui/ui.go @@ -260,13 +260,11 @@ func (ui *UI) View() string { default: view = "Unknown state :/ this is a bug!" } - switch ui.activePage { - case selectionPage: + if ui.activePage == selectionPage { view = lipgloss.JoinVertical(lipgloss.Bottom, ui.header.View(), view, ) - case repoPage: } if ui.showFooter { view = lipgloss.JoinVertical(lipgloss.Bottom, @@ -274,9 +272,7 @@ func (ui *UI) View() string { ui.footer.View(), ) } - return style.Render( - view, - ) + return style.Render(view) } func (ui *UI) setRepoCmd(rn string) tea.Cmd {