diff --git a/apps/ssb.json b/apps/ssb.json index 2b3b67b6..952be215 100644 --- a/apps/ssb.json +++ b/apps/ssb.json @@ -1,5 +1,5 @@ { "type": "tildefriends-app", "emoji": "🦀", - "previous": "&n2E4F4hnQe0dz+NvcMlKl5pcAZ3a1NM7/iNyWng9fRQ=.sha256" + "previous": "&Ky/Q/lCC3DIcqbsO9KAnfKzeBE/e9CB/8C5jACZ3UDI=.sha256" } diff --git a/apps/ssb/tf-message.js b/apps/ssb/tf-message.js index 45af0003..b54d82ff 100644 --- a/apps/ssb/tf-message.js +++ b/apps/ssb/tf-message.js @@ -301,31 +301,35 @@ class TfMessageElement extends LitElement { return total; } + expanded_key() { + return this.message?.id || this.messages?.map((x) => x.id).join(':'); + } + set_expanded(expanded, tag) { + let key = this.expanded_key(); this.dispatchEvent( new CustomEvent('tf-expand', { bubbles: true, composed: true, - detail: {id: (this.message.id || '') + (tag || ''), expanded: expanded}, + detail: {id: key + (tag || ''), expanded: expanded}, }) ); } toggle_expanded(tag) { - this.set_expanded( - !this.expanded[(this.message.id || '') + (tag || '')], - tag - ); + let key = this.expanded_key(); + this.set_expanded(!this.expanded[key + (tag || '')], tag); } is_expanded(tag) { - return this.expanded[(this.message.id || '') + (tag || '')]; + let key = this.expanded_key(); + return this.expanded[key + (tag || '')]; } render_children() { let self = this; if (this.message.child_messages?.length) { - if (!this.expanded[this.message.id]) { + if (!this.expanded[this.expanded_key()]) { return html` + `); + } else { + return this.render_frame(html` +
+ ${this.content_group_by_author().map( + (x) => html` + + ${x.action} + ${x.users.map( + (y) => html` + + ` + )} + ` + )} +
+ + `); + } } else if (this.message.placeholder) { return this.render_frame( html`
@@ -679,25 +755,60 @@ class TfMessageElement extends LitElement {
`); } else if (content.type == 'contact') { - return html` -
- - is - ${content.blocking === true - ? 'blocking' - : content.blocking === false - ? 'no longer blocking' - : content.following === true - ? 'following' - : content.following === false - ? 'no longer following' - : '?'} - + return this.render_frame(html` +
+
+ + is + ${content.blocking === true + ? 'blocking' + : content.blocking === false + ? 'no longer blocking' + : content.following === true + ? 'following' + : content.following === false + ? 'no longer following' + : '?'} + +
+
+ +
+ View Message + + ${this.drafts[this.message?.id] === undefined + ? html` + + ` + : undefined} +
+
+ ${this.render_votes()} ${this.render_actions()}
- `; + `); } else if (content.type == 'post') { let self = this; let body; diff --git a/apps/ssb/tf-news.js b/apps/ssb/tf-news.js index 3e21a1da..aea87e6f 100644 --- a/apps/ssb/tf-news.js +++ b/apps/ssb/tf-news.js @@ -166,7 +166,10 @@ class TfNewsElement extends LitElement { if (message?.content?.type === 'contact') { group.push(message); } else { - if (group.length > 0) { + if (group.length == 1) { + result.push(group[0]); + group = []; + } else if (group.length > 1) { result.push({ rowid: Math.max(...group.map((x) => x.rowid)), type: 'contact_group', @@ -177,7 +180,10 @@ class TfNewsElement extends LitElement { result.push(message); } } - if (group.length > 0) { + if (group.length == 1) { + result.push(group[0]); + group = []; + } else if (group.length > 1) { result.push({ rowid: Math.max(...group.map((x) => x.rowid)), type: 'contact_group',