Add WebDAV lifecycle UI feedback
This commit is contained in:
@@ -465,9 +465,9 @@ func (u *ui) describeActionError(label string, err error) string {
|
||||
return ""
|
||||
}
|
||||
if errors.Is(err, webdav.ErrConflict) || strings.Contains(err.Error(), webdav.ErrConflict.Error()) {
|
||||
return "Save conflict: the remote vault changed. Reopen it and retry the save."
|
||||
return fmt.Sprintf("%s failed: remote vault changed on the server; reopen the remote vault and retry", label)
|
||||
}
|
||||
return err.Error()
|
||||
return fmt.Sprintf("%s failed: %v", label, err)
|
||||
}
|
||||
|
||||
func (u *ui) bannerSurface() uiBanner {
|
||||
@@ -728,6 +728,8 @@ func (u *ui) header(gtx layout.Context) layout.Dimensions {
|
||||
}),
|
||||
layout.Rigid(layout.Spacer{Height: unit.Dp(8)}.Layout),
|
||||
layout.Rigid(u.lifecycleControls),
|
||||
layout.Rigid(layout.Spacer{Height: unit.Dp(8)}.Layout),
|
||||
layout.Rigid(u.feedbackBanner),
|
||||
)
|
||||
})
|
||||
}
|
||||
@@ -758,6 +760,8 @@ func (u *ui) header(gtx layout.Context) layout.Dimensions {
|
||||
}),
|
||||
layout.Rigid(layout.Spacer{Height: unit.Dp(10)}.Layout),
|
||||
layout.Rigid(u.lifecycleControls),
|
||||
layout.Rigid(layout.Spacer{Height: unit.Dp(10)}.Layout),
|
||||
layout.Rigid(u.feedbackBanner),
|
||||
)
|
||||
})
|
||||
}
|
||||
@@ -1295,6 +1299,27 @@ func detailLine(th *material.Theme, label, value string) layout.Widget {
|
||||
}
|
||||
}
|
||||
|
||||
func (u *ui) feedbackBanner(gtx layout.Context) layout.Dimensions {
|
||||
message := u.statusMessage
|
||||
tone := color.NRGBA{R: 231, G: 239, B: 235, A: 255}
|
||||
textColor := accentColor
|
||||
if u.errorMessage != "" {
|
||||
message = u.errorMessage
|
||||
tone = color.NRGBA{R: 248, G: 226, B: 223, A: 255}
|
||||
textColor = color.NRGBA{R: 140, G: 46, B: 34, A: 255}
|
||||
}
|
||||
if message == "" {
|
||||
return layout.Dimensions{}
|
||||
}
|
||||
return layout.Background{}.Layout(gtx, fill(tone), func(gtx layout.Context) layout.Dimensions {
|
||||
return layout.UniformInset(unit.Dp(10)).Layout(gtx, func(gtx layout.Context) layout.Dimensions {
|
||||
lbl := material.Label(u.theme, unit.Sp(13), message)
|
||||
lbl.Color = textColor
|
||||
return lbl.Layout(gtx)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
func (u *ui) passwordLine(label, value string) layout.Widget {
|
||||
return func(gtx layout.Context) layout.Dimensions {
|
||||
icon := u.eyeIcon
|
||||
|
||||
Reference in New Issue
Block a user