ssb: Add a button to close a private chat, removing it from the sidebar.

This commit is contained in:
2025-08-20 19:08:07 -04:00
parent 910c39cbd0
commit 18e5b41663
3 changed files with 69 additions and 4 deletions

View File

@@ -433,6 +433,31 @@ class TfTabNewsFeedElement extends LitElement {
}
}
close_private_chat() {
this.mark_all_read();
this.dispatchEvent(
new CustomEvent('closeprivatechat', {
bubbles: true,
composed: true,
detail: {
key: JSON.stringify(this.hash.substring('#🔐'.length).split(',')),
},
})
);
}
render_close_chat_button() {
if (this.hash.startsWith('#🔐')) {
return html`
<button class="w3-button w3-theme-d1" @click=${this.close_private_chat}>
Close Chat
</button>
`;
} else {
return html`${this.hash}`;
}
}
render() {
if (
!this.messages ||
@@ -500,6 +525,7 @@ class TfTabNewsFeedElement extends LitElement {
Mark All Read
</button>`
: undefined}
${this.render_close_chat_button()}
<tf-news
id="news"
whoami=${this.whoami}