ssb: Add a checkbox to reply in a new thread. #47 Also, it's crab time. I'm sorry it took me so long.

This commit is contained in:
Cory McWilliams 2024-12-23 12:06:32 -05:00
parent 8475ee0985
commit 20c7a71db6
2 changed files with 18 additions and 4 deletions

View File

@ -1,5 +1,5 @@
{
"type": "tildefriends-app",
"emoji": "🐌",
"previous": "&q/1uGp0jMvsYGW7Gj8E33kf6UFo/uNYDXg3zo1sVKQg=.sha256"
"emoji": "🦀",
"previous": "&wH32i/aBIOkc9RfRTQOfpulnPoLSepbHcZlDEHB9V1Y=.sha256"
}

View File

@ -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`
<input type="checkbox" class="w3-check w3-theme-d1" id="new_thread" @change=${() => self.new_thread = !self.new_thread} ?checked=${self.new_thread}></input>
<label for="new_thread">New Thread</label>
`;
}
}
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()}
<button class="w3-button w3-theme-d1" id="submit" @click=${this.submit}>
Submit
</button>