Unify action menus and collapse empty detail pane
This commit is contained in:
@@ -20,6 +20,7 @@ import (
|
||||
"git.julianfamily.org/keepassgo/internal/apiaudit"
|
||||
"git.julianfamily.org/keepassgo/internal/apitokens"
|
||||
"git.julianfamily.org/keepassgo/internal/appstate"
|
||||
detaillayout "git.julianfamily.org/keepassgo/internal/appui/detail/layout"
|
||||
"git.julianfamily.org/keepassgo/internal/clipboard"
|
||||
"git.julianfamily.org/keepassgo/internal/session"
|
||||
)
|
||||
@@ -1310,6 +1311,8 @@ func (u *ui) primaryContent(gtx layout.Context) layout.Dimensions {
|
||||
return u.lifecycleScreen(gtx)
|
||||
case u.shouldUseLockedSinglePane():
|
||||
return u.detailPanel(gtx)
|
||||
case !u.shouldShowDetailPane():
|
||||
return u.listPanel(gtx)
|
||||
case u.usesCompactViewport():
|
||||
return u.compactPrimaryContent(gtx)
|
||||
default:
|
||||
@@ -1317,6 +1320,17 @@ func (u *ui) primaryContent(gtx layout.Context) layout.Dimensions {
|
||||
}
|
||||
}
|
||||
|
||||
func (u *ui) shouldShowDetailPane() bool {
|
||||
_, hasSelectedEntry := u.selectedEntry()
|
||||
mode := detaillayout.Resolve(
|
||||
u.isVaultLocked(),
|
||||
u.state.Section == appstate.SectionAPITokens || u.state.Section == appstate.SectionAPIAudit || u.state.Section == appstate.SectionAbout,
|
||||
hasSelectedEntry,
|
||||
u.editingEntry,
|
||||
)
|
||||
return mode != detaillayout.ModeEmpty
|
||||
}
|
||||
|
||||
func (u *ui) compactPrimaryContent(gtx layout.Context) layout.Dimensions {
|
||||
u.phoneSpan = gtx.Constraints.Max.Y
|
||||
listHeight := int(float32(gtx.Constraints.Max.Y) * u.phoneSplit.Value)
|
||||
|
||||
Reference in New Issue
Block a user