From 20c7a71db692362f0038c4475e0546ec5801e07f Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Mon, 23 Dec 2024 12:06:32 -0500 Subject: [PATCH] ssb: Add a checkbox to reply in a new thread. #47 Also, it's crab time. I'm sorry it took me so long. --- apps/ssb.json | 4 ++-- apps/ssb/tf-compose.js | 18 ++++++++++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/apps/ssb.json b/apps/ssb.json index affce16d..ee7828e0 100644 --- a/apps/ssb.json +++ b/apps/ssb.json @@ -1,5 +1,5 @@ { "type": "tildefriends-app", - "emoji": "🐌", - "previous": "&q/1uGp0jMvsYGW7Gj8E33kf6UFo/uNYDXg3zo1sVKQg=.sha256" + "emoji": "🦀", + "previous": "&wH32i/aBIOkc9RfRTQOfpulnPoLSepbHcZlDEHB9V1Y=.sha256" } diff --git a/apps/ssb/tf-compose.js b/apps/ssb/tf-compose.js index 7449f26b..c7d807d4 100644 --- a/apps/ssb/tf-compose.js +++ b/apps/ssb/tf-compose.js @@ -15,6 +15,7 @@ class TfComposeElement extends LitElement { drafts: {type: Object}, author: {type: String}, channel: {type: String}, + new_thread: {type: Boolean}, }; } @@ -28,6 +29,7 @@ class TfComposeElement extends LitElement { this.apps = undefined; this.drafts = {}; this.author = undefined; + this.new_thread = false; } process_text(text) { @@ -200,7 +202,7 @@ class TfComposeElement extends LitElement { channel: this.channel, }; if (this.root || this.branch) { - message.root = this.root; + message.root = this.new_thread ? this.branch ?? this.root : this.root; message.branch = this.branch; } if (Object.values(draft.mentions || {}).length) { @@ -469,6 +471,16 @@ class TfComposeElement extends LitElement { } } + render_new_thread() { + let self = this; + if (this.root !== undefined && this.branch !== undefined && this.root != this.branch) { + return html` + self.new_thread = !self.new_thread} ?checked=${self.new_thread}> + + `; + } + } + get_draft() { return this.drafts[this.branch || ''] || {}; } @@ -562,7 +574,9 @@ class TfComposeElement extends LitElement { ${Object.values(draft.mentions || {}).map((x) => self.render_mention(x) )} - ${this.render_attach_app()} ${this.render_content_warning()} + ${this.render_attach_app()} + ${this.render_content_warning()} + ${this.render_new_thread()}