ssb: Show some suggested accounts to follow.
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 26m21s

This commit is contained in:
Cory McWilliams 2025-01-12 14:54:09 -05:00
parent b8eaa5cf97
commit e198ff9cb1
2 changed files with 31 additions and 3 deletions

View File

@ -1,5 +1,5 @@
{ {
"type": "tildefriends-app", "type": "tildefriends-app",
"emoji": "🦀", "emoji": "🦀",
"previous": "&N69/NfCoe/HmdG5Hl/ulq/CDYLhDYzi50jbg2h3VPuc=.sha256" "previous": "&ywgXrIlVu5chLPseAwTXdpzaxGep+rjs1ZPeV4tj3wM=.sha256"
} }

View File

@ -128,6 +128,23 @@ class TfTabNewsElement extends LitElement {
return this.hash.startsWith('##') ? this.hash.substring(2) : undefined; 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() { render_sidebar() {
return html` return html`
<div <div
@ -153,7 +170,7 @@ class TfTabNewsElement extends LitElement {
> >
` `
: undefined} : undefined}
<div class="w3-bar-item w3-theme-d2">Channels</div> <h4 class="w3-bar-item w3-theme-d2">Channels</h4>
<a <a
href="#" href="#"
class="w3-bar-item w3-button" class="w3-bar-item w3-button"
@ -195,7 +212,7 @@ class TfTabNewsElement extends LitElement {
` `
)} )}
<div class="w3-bar-item w3-theme-d2">Connections</div> <h4 class="w3-bar-item w3-theme-d2">Connections</h4>
${this.connections.map( ${this.connections.map(
(x) => html` (x) => html`
<tf-user <tf-user
@ -206,6 +223,17 @@ class TfTabNewsElement extends LitElement {
></tf-user> ></tf-user>
` `
)} )}
<h4 class="w3-bar-item w3-theme-d2">Suggested Follows</h4>
${this.suggested_follows().map(
(x) => html`
<tf-user
class="w3-bar-item"
style="max-width: 100%"
id=${x}
.users=${this.users}
></tf-user>
`
)}
</div> </div>
<div <div
class="w3-overlay" class="w3-overlay"