From e198ff9cb11cbfddd2bb2aa5272be30b95bc477a Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Sun, 12 Jan 2025 14:54:09 -0500 Subject: [PATCH] ssb: Show some suggested accounts to follow. --- apps/ssb.json | 2 +- apps/ssb/tf-tab-news.js | 32 ++++++++++++++++++++++++++++++-- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/apps/ssb.json b/apps/ssb.json index 28f31422..9d2c8875 100644 --- a/apps/ssb.json +++ b/apps/ssb.json @@ -1,5 +1,5 @@ { "type": "tildefriends-app", "emoji": "🦀", - "previous": "&N69/NfCoe/HmdG5Hl/ulq/CDYLhDYzi50jbg2h3VPuc=.sha256" + "previous": "&ywgXrIlVu5chLPseAwTXdpzaxGep+rjs1ZPeV4tj3wM=.sha256" } diff --git a/apps/ssb/tf-tab-news.js b/apps/ssb/tf-tab-news.js index d404eb7c..ecf8b12d 100644 --- a/apps/ssb/tf-tab-news.js +++ b/apps/ssb/tf-tab-news.js @@ -128,6 +128,23 @@ class TfTabNewsElement extends LitElement { return this.hash.startsWith('##') ? this.hash.substring(2) : undefined; } + compare_follows(a, b) { + return a[1].followed - b[1].followed; + } + + suggested_follows() { + let self = this; + return Object.entries(this.users).filter( + (x) => (x[1].follow_depth > 1) + ).sort( + self.compare_follows + ).slice( + 0, 8 + ).map( + (x) => (x[0]) + ); + } + render_sidebar() { return html`
` : undefined} -
Channels
+

Channels

Connections
+

Connections

${this.connections.map( (x) => html` ` )} +

Suggested Follows

+ ${this.suggested_follows().map( + (x) => html` + + ` + )}