~whereswaldon/arbor-dev

Add dynamic composer prompt. Use different prompts for new replies and conversations v1 PROPOSED

Andrew Thorp: 2
 Add dynamic composer prompt. Use different prompts for new replies and conversations
 Update build script to use 'go install' instead of 'go get'

 4 files changed, 14 insertions(+), 2 deletions(-)
Thanks, all applied!
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~whereswaldon/arbor-dev/patches/32832/mbox | git am -3
Learn more about email & git

[PATCH 1/2] Add dynamic composer prompt. Use different prompts for new replies and conversations Export this patch

---
Good morning,

This patch fixes the misleading prompt when starting a new conversation "Compose your reply".
Once applied, the prompt will remain the same for replying to messages but when creating a
new conversation the composer will prompt with "Start a new conversation".

Please let me know if you have any feedback.

Thanks,

Andrew


 .gitignore               |  1 +
 widget/composer.go       | 11 +++++++++++
 widget/theme/composer.go |  2 +-
 3 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/.gitignore b/.gitignore
index 6a39717..e5dfc80 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,4 @@ sprig
*.apk
pakbuild/
.flatpak-builder/
vendor/
diff --git a/widget/composer.go b/widget/composer.go
index d50f722..15bc508 100644
--- a/widget/composer.go
+++ b/widget/composer.go
@@ -19,6 +19,12 @@ const (
	ComposerCancelled
)

// Editor prompts
const (
	reply_prompt        = "Compose your reply"
	conversation_prompt = "Start a new conversation"
)

// Composer holds the state for a widget that creates new arbor nodes.
type Composer struct {
	CommunityList layout.List
@@ -33,6 +39,8 @@ type Composer struct {

	events    []ComposerEvent
	composing bool

	PromptText string
}

// update handles all state processing.
@@ -71,6 +79,7 @@ func (c *Composer) StartReply(to ds.ReplyData) {
	c.Reset()
	c.composing = true
	c.ReplyingTo = to
	c.PromptText = reply_prompt
	c.Editor.Focus()
}

@@ -78,6 +87,7 @@ func (c *Composer) StartReply(to ds.ReplyData) {
func (c *Composer) StartConversation() {
	c.Reset()
	c.composing = true
	c.PromptText = conversation_prompt
	c.Editor.Focus()
}

@@ -85,6 +95,7 @@ func (c *Composer) StartConversation() {
func (c *Composer) Reset() {
	c.ReplyingTo = ds.ReplyData{}
	c.Editor.SetText("")
	c.PromptText = ""
	c.composing = false
}

diff --git a/widget/theme/composer.go b/widget/theme/composer.go
index 7e24687..ce5ad2b 100644
--- a/widget/theme/composer.go
+++ b/widget/theme/composer.go
@@ -113,7 +113,7 @@ func (c ComposerStyle) Layout(gtx layout.Context) layout.Dimensions {
									layout.Stacked(func(gtx C) D {
										return layout.UniformInset(unit.Dp(6)).Layout(gtx, func(gtx C) D {
											c.Editor.Submit = true
											return material.Editor(th.Theme, &c.Editor, "Compose your reply").Layout(gtx)
											return material.Editor(th.Theme, &c.Editor, c.PromptText).Layout(gtx)
										})
									}),
								)
-- 
2.17.1

[PATCH 2/2] Update build script to use 'go install' instead of 'go get' Export this patch

---
 .builds/debian.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.builds/debian.yml b/.builds/debian.yml
index 5bba6fe..95374fa 100644
--- a/.builds/debian.yml
+++ b/.builds/debian.yml
@@ -42,7 +42,7 @@ tasks:
 - mirror: |
    # mirror to github while we wait for android
    ssh-keyscan github.com > "$HOME"/.ssh/known_hosts && cd sprig && git push --mirror "$github_mirror" || echo "failed mirroring"
 - install_mage: go get github.com/magefile/mage
 - install_mage: go install github.com/magefile/mage@latest
 - build_windows: |
    cd sprig
    make windows
-- 
2.17.1
Thanks, all applied!