Align desktop pane workflow with phone
This commit is contained in:
@@ -6347,6 +6347,11 @@ func (u *ui) detailPanel(gtx layout.Context) layout.Dimensions {
|
|||||||
}),
|
}),
|
||||||
layout.Rigid(u.syncButtonGroup),
|
layout.Rigid(u.syncButtonGroup),
|
||||||
layout.Rigid(layout.Spacer{Width: unit.Dp(8)}.Layout),
|
layout.Rigid(layout.Spacer{Width: unit.Dp(8)}.Layout),
|
||||||
|
layout.Rigid(func(gtx layout.Context) layout.Dimensions {
|
||||||
|
btn := material.Button(u.theme, &u.lockVault, "Lock")
|
||||||
|
return btn.Layout(gtx)
|
||||||
|
}),
|
||||||
|
layout.Rigid(layout.Spacer{Width: unit.Dp(8)}.Layout),
|
||||||
layout.Rigid(func(gtx layout.Context) layout.Dimensions {
|
layout.Rigid(func(gtx layout.Context) layout.Dimensions {
|
||||||
icon := u.menuIcon
|
icon := u.menuIcon
|
||||||
if icon == nil {
|
if icon == nil {
|
||||||
@@ -6365,11 +6370,6 @@ func (u *ui) detailPanel(gtx layout.Context) layout.Dimensions {
|
|||||||
}
|
}
|
||||||
return layout.Inset{Left: unit.Dp(6)}.Layout(gtx, u.mainMenu)
|
return layout.Inset{Left: unit.Dp(6)}.Layout(gtx, u.mainMenu)
|
||||||
}),
|
}),
|
||||||
layout.Rigid(layout.Spacer{Width: unit.Dp(8)}.Layout),
|
|
||||||
layout.Rigid(func(gtx layout.Context) layout.Dimensions {
|
|
||||||
btn := material.Button(u.theme, &u.lockVault, "Lock")
|
|
||||||
return btn.Layout(gtx)
|
|
||||||
}),
|
|
||||||
)
|
)
|
||||||
}),
|
}),
|
||||||
layout.Rigid(layout.Spacer{Height: unit.Dp(12)}.Layout),
|
layout.Rigid(layout.Spacer{Height: unit.Dp(12)}.Layout),
|
||||||
@@ -7126,11 +7126,9 @@ func (u *ui) groupBar(gtx layout.Context) layout.Dimensions {
|
|||||||
if len(u.groupClicks) < len(groups) {
|
if len(u.groupClicks) < len(groups) {
|
||||||
u.groupClicks = make([]widget.Clickable, len(groups))
|
u.groupClicks = make([]widget.Clickable, len(groups))
|
||||||
}
|
}
|
||||||
displayPath := u.displayPath()
|
|
||||||
atRoot := len(displayPath) == 0
|
|
||||||
return compactCard(gtx, func(gtx layout.Context) layout.Dimensions {
|
return compactCard(gtx, func(gtx layout.Context) layout.Dimensions {
|
||||||
if u.mode == "phone" {
|
if u.mode == "phone" {
|
||||||
if atRoot {
|
if len(u.displayPath()) == 0 {
|
||||||
u.phoneGroupBrowserExpanded = true
|
u.phoneGroupBrowserExpanded = true
|
||||||
}
|
}
|
||||||
children := make([]layout.FlexChild, 0, len(groups))
|
children := make([]layout.FlexChild, 0, len(groups))
|
||||||
@@ -7151,39 +7149,6 @@ func (u *ui) groupBar(gtx layout.Context) layout.Dimensions {
|
|||||||
return layout.Flex{Axis: layout.Vertical}.Layout(gtx, children...)
|
return layout.Flex{Axis: layout.Vertical}.Layout(gtx, children...)
|
||||||
}
|
}
|
||||||
return layout.Flex{Axis: layout.Vertical}.Layout(gtx,
|
return layout.Flex{Axis: layout.Vertical}.Layout(gtx,
|
||||||
layout.Rigid(func(gtx layout.Context) layout.Dimensions {
|
|
||||||
if atRoot {
|
|
||||||
return layout.Dimensions{}
|
|
||||||
}
|
|
||||||
return layout.Flex{Axis: layout.Vertical}.Layout(gtx,
|
|
||||||
layout.Rigid(layout.Spacer{Height: unit.Dp(8)}.Layout),
|
|
||||||
layout.Rigid(func(gtx layout.Context) layout.Dimensions {
|
|
||||||
return layout.Flex{Spacing: layout.SpaceStart}.Layout(gtx,
|
|
||||||
layout.Rigid(func(gtx layout.Context) layout.Dimensions {
|
|
||||||
for u.goToRootGroup.Clicked(gtx) {
|
|
||||||
root := u.hiddenVaultRoot()
|
|
||||||
if root == "" {
|
|
||||||
u.setCurrentPath(nil)
|
|
||||||
} else {
|
|
||||||
u.setCurrentPath([]string{root})
|
|
||||||
}
|
|
||||||
u.filter()
|
|
||||||
}
|
|
||||||
return tonedButton(gtx, u.theme, &u.goToRootGroup, "Back to Root")
|
|
||||||
}),
|
|
||||||
layout.Rigid(layout.Spacer{Width: unit.Dp(6)}.Layout),
|
|
||||||
layout.Rigid(func(gtx layout.Context) layout.Dimensions {
|
|
||||||
for u.goToParentGroup.Clicked(gtx) {
|
|
||||||
u.setCurrentPath(u.currentPath[:len(u.currentPath)-1])
|
|
||||||
u.filter()
|
|
||||||
}
|
|
||||||
return tonedButton(gtx, u.theme, &u.goToParentGroup, "Up One Group")
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
}),
|
|
||||||
layout.Rigid(layout.Spacer{Height: unit.Dp(10)}.Layout),
|
|
||||||
layout.Rigid(func(gtx layout.Context) layout.Dimensions {
|
layout.Rigid(func(gtx layout.Context) layout.Dimensions {
|
||||||
if len(groups) == 0 {
|
if len(groups) == 0 {
|
||||||
return layout.Dimensions{}
|
return layout.Dimensions{}
|
||||||
@@ -7216,6 +7181,17 @@ func (u *ui) groupBar(gtx layout.Context) layout.Dimensions {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (u *ui) groupBarShowsExplicitNavigationButtons() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func (u *ui) topRightActionOrder() []string {
|
||||||
|
if u.isVaultLocked() {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return []string{"Sync", "Lock", "Menu"}
|
||||||
|
}
|
||||||
|
|
||||||
func detailLine(th *material.Theme, label, value string) layout.Widget {
|
func detailLine(th *material.Theme, label, value string) layout.Widget {
|
||||||
return func(gtx layout.Context) layout.Dimensions {
|
return func(gtx layout.Context) layout.Dimensions {
|
||||||
valueSize := unit.Sp(16)
|
valueSize := unit.Sp(16)
|
||||||
|
|||||||
@@ -291,6 +291,39 @@ func TestUINavigationHeaderMatchesAcrossDesktopAndPhoneForEntries(t *testing.T)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestUIGroupBarDoesNotShowExplicitNavigationButtonsAcrossModes(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 desktop.groupBarShowsExplicitNavigationButtons() {
|
||||||
|
t.Fatal("desktop.groupBarShowsExplicitNavigationButtons() = true, want false")
|
||||||
|
}
|
||||||
|
if phone.groupBarShowsExplicitNavigationButtons() {
|
||||||
|
t.Fatal("phone.groupBarShowsExplicitNavigationButtons() = true, want false")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestUITopRightActionOrderMatchesAcrossModes(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
|
desktop := newUIWithSession("desktop", summarySession{hasVault: true})
|
||||||
|
desktop.state.Section = appstate.SectionEntries
|
||||||
|
phone := newUIWithSession("phone", summarySession{hasVault: true})
|
||||||
|
phone.state.Section = appstate.SectionEntries
|
||||||
|
|
||||||
|
want := []string{"Sync", "Lock", "Menu"}
|
||||||
|
if got := desktop.topRightActionOrder(); !slices.Equal(got, want) {
|
||||||
|
t.Fatalf("desktop.topRightActionOrder() = %v, want %v", got, want)
|
||||||
|
}
|
||||||
|
if got := phone.topRightActionOrder(); !slices.Equal(got, want) {
|
||||||
|
t.Fatalf("phone.topRightActionOrder() = %v, want %v", got, want)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestUICurrentVaultSummary(t *testing.T) {
|
func TestUICurrentVaultSummary(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user