[PATCH sprig v2] feat: move collapse children button out of overflow menu
Export this patch
---
icons/icons.go | 10 ++++++++++
reply-view.go | 25 +++++++++++++++++++------
2 files changed, 29 insertions(+), 6 deletions(-)
diff --git a/icons/icons.go b/icons/icons.go
index f711939..1d000ca 100644
--- a/icons/icons.go
+++ b/icons/icons.go
@@ -89,3 +89,13 @@ var SubscriptionIcon *widget.Icon = func() *widget.Icon {
icon, _ := widget.NewIcon(icons.CommunicationImportContacts)
return icon
}()
+
+var CollapseIcon *widget.Icon = func() *widget.Icon {
+ icon, _ := widget.NewIcon(icons.NavigationUnfoldLess)
+ return icon
+}()
+
+var ExpandIcon *widget.Icon = func() *widget.Icon {
+ icon, _ := widget.NewIcon(icons.NavigationUnfoldMore)
+ return icon
+}()
diff --git a/reply-view.go b/reply-view.go
index 9bf1a77..ad24b4d 100644
--- a/reply-view.go
+++ b/reply-view.go
@@ -288,12 +288,25 @@ func (c *ReplyListView) getContextualActions() ([]materials.AppBarAction, []mate
Tag: &c.CreateReplyButton,
},
),
- }, []materials.OverflowAction{
- {
- Name: "Hide/Show descendants",
- Tag: &c.HideDescendantsButton,
- },
- }
+ {
+ OverflowAction: materials.OverflowAction{
+ Name: "Hide/Show descendants",
+ Tag: &c.HideDescendantsButton,
+ },
+ Layout: func(gtx C, bg, fg color.NRGBA) D {
+ btn := materials.SimpleIconButton(th, &c.HideDescendantsButton, icons.ExpandIcon)
+ btn.Background = bg
+ btn.Color = fg
+ focusedID := c.FocusTracker.Focused.ID()
+ if c.HiddenTracker.IsAnchor(focusedID) {
+ btn.Icon = icons.ExpandIcon
+ } else {
+ btn.Icon = icons.CollapseIcon
+ }
+ return btn.Layout(gtx)
+ },
+ },
+ }, []materials.OverflowAction{}
}
func (c *ReplyListView) triggerReplyContextMenu(gtx layout.Context) {
--
2.31.1
Excellent work Thom! This is exactly what I was looking for. Merged!
Cheers,
Chris
sprig/patches/debian.yml: SUCCESS in 2m32s
[feat: move collapse children button out of overflow menu][0] v2 from [Thom Dickson][1]
[0]: https://lists.sr.ht/~whereswaldon/arbor-dev/patches/21912
[1]: mailto:td3of4@gmail.com
✓ #481203 SUCCESS sprig/patches/debian.yml https://builds.sr.ht/~whereswaldon/job/481203