diff --git a/main.go b/main.go index 6ec4f08..086e174 100644 --- a/main.go +++ b/main.go @@ -6103,33 +6103,25 @@ func (u *ui) listPanel(gtx layout.Context) layout.Dimensions { } func (u *ui) navigationHeader(gtx layout.Context) layout.Dimensions { - if u.mode == "phone" { - if u.state.Section != appstate.SectionEntries && u.state.Section != appstate.SectionAbout { - return layout.Dimensions{} - } - if u.state.Section == appstate.SectionAbout { - lbl := material.Label(u.theme, unit.Sp(18), "About") - lbl.Color = accentColor - return lbl.Layout(gtx) - } - return u.groupControlsDisclosure(gtx) + if u.state.Section != appstate.SectionEntries && u.state.Section != appstate.SectionAbout { + return layout.Dimensions{} } - return layout.Flex{Alignment: layout.Middle}.Layout(gtx, - layout.Flexed(1, func(gtx layout.Context) layout.Dimensions { - if u.state.Section == appstate.SectionAbout { - lbl := material.Label(u.theme, unit.Sp(18), "About") - lbl.Color = accentColor - return lbl.Layout(gtx) - } - return u.sectionBar(gtx) - }), - layout.Rigid(func(gtx layout.Context) layout.Dimensions { - if u.state.Section != appstate.SectionEntries { - return layout.Dimensions{} - } - return u.groupControlsDisclosure(gtx) - }), - ) + if u.state.Section == appstate.SectionAbout { + lbl := material.Label(u.theme, unit.Sp(18), "About") + lbl.Color = accentColor + return lbl.Layout(gtx) + } + return u.groupControlsDisclosure(gtx) +} + +func (u *ui) navigationHeaderLabel() string { + if u.state.Section != appstate.SectionEntries && u.state.Section != appstate.SectionAbout { + return "" + } + if u.state.Section == appstate.SectionAbout { + return "About" + } + return "Group Tools" } func (u *ui) sectionBar(gtx layout.Context) layout.Dimensions { diff --git a/main_test.go b/main_test.go index b0ea704..511ad1b 100644 --- a/main_test.go +++ b/main_test.go @@ -275,6 +275,22 @@ func TestUIListPanelTopSectionsMatchAcrossDesktopAndPhoneForEntries(t *testing.T } } +func TestUINavigationHeaderMatchesAcrossDesktopAndPhoneForEntries(t *testing.T) { + t.Parallel() + + desktop := newUIWithModel("desktop", vault.Model{}) + desktop.state.Section = appstate.SectionEntries + phone := newUIWithModel("phone", vault.Model{}) + phone.state.Section = appstate.SectionEntries + + if got := desktop.navigationHeaderLabel(); got != "Group Tools" { + t.Fatalf("desktop.navigationHeaderLabel() = %q, want %q", got, "Group Tools") + } + if got := phone.navigationHeaderLabel(); got != "Group Tools" { + t.Fatalf("phone.navigationHeaderLabel() = %q, want %q", got, "Group Tools") + } +} + func TestUICurrentVaultSummary(t *testing.T) { t.Parallel()