2 Commits

Author SHA1 Message Date
9b11c2c629 ssb: Expose a list of followed accounts on the profile page. #122
Some checks failed
Build Tilde Friends / Build-All (push) Has been cancelled
2025-06-02 21:06:25 -04:00
e2a231fb4a ssb: Consolidated contact message groups a bit too much. 2025-06-02 12:14:06 -04:00
3 changed files with 49 additions and 10 deletions

View File

@ -1,5 +1,5 @@
{ {
"type": "tildefriends-app", "type": "tildefriends-app",
"emoji": "🦀", "emoji": "🦀",
"previous": "&R6lVyXLYem8Qkuhok/USflvzqw/ZgGic1aUsE23yzR0=.sha256" "previous": "&klcMVQ9g0ielAoM3WjHRnyWQs4rs8fxmy6PbXIaK2ZU=.sha256"
} }

View File

@ -94,7 +94,9 @@ class TfMessageElement extends LitElement {
return '👎'; return '👎';
} else if (expression === 'heart') { } else if (expression === 'heart') {
return '❤️'; return '❤️';
} else if ((expression ?? '').split('').every((x) => x.charCodeAt(0) < 256)) { } else if (
(expression ?? '').split('').every((x) => x.charCodeAt(0) < 256)
) {
return '👍'; return '👍';
} else { } else {
return expression; return expression;
@ -656,13 +658,15 @@ class TfMessageElement extends LitElement {
<div class="w3-padding"> <div class="w3-padding">
${this.content_group_by_author().map( ${this.content_group_by_author().map(
(x) => html` (x) => html`
<tf-user id=${x.author} .users=${this.users}></tf-user> <div>
${x.action} <tf-user id=${x.author} .users=${this.users}></tf-user>
${x.users.map( ${x.action}
(y) => html` ${x.users.map(
<tf-user id=${y} .users=${this.users}></tf-user> (y) => html`
` <tf-user id=${y} .users=${this.users}></tf-user>
)} `
)}
</div>
` `
)} )}
</div> </div>

View File

@ -1,4 +1,4 @@
import {LitElement, html, unsafeHTML} from './lit-all.min.js'; import {LitElement, html, until, unsafeHTML} from './lit-all.min.js';
import * as tfrpc from '/static/tfrpc.js'; import * as tfrpc from '/static/tfrpc.js';
import * as tfutils from './tf-utils.js'; import * as tfutils from './tf-utils.js';
import {styles} from './tf-styles.js'; import {styles} from './tf-styles.js';
@ -200,6 +200,40 @@ class TfProfileElement extends LitElement {
} }
} }
toggle_account_list(event) {
let content = event.srcElement.nextElementSibling;
if (content.classList.toggle('w3-hide')) {
event.srcElement.innerText = 'Show Followed Accounts';
} else {
event.srcElement.innerText = 'Hide Followed Accounts';
}
}
async load_follows() {
let accounts = await tfrpc.rpc.following([this.id], 1);
return html`
<div class="w3-container">
<button
class="w3-button w3-block w3-theme-d1"
@click=${this.toggle_account_list}
>
Show Followed Accounts
</button>
<div class="w3-hide w3-card">
<ul class="w3-ul w3-theme-d4 w3-border-theme">
${Object.keys(accounts).map(
(x) => html`
<li class="w3-border-theme">
<tf-user id=${x} .users=${this.users}></tf-user>
</li>
`
)}
</ul>
</div>
</div>
`;
}
render() { render() {
this.load(); this.load();
let self = this; let self = this;
@ -314,6 +348,7 @@ class TfProfileElement extends LitElement {
Blocked by ${profile.blocked} identities. Blocked by ${profile.blocked} identities.
</div> </div>
</div> </div>
${until(this.load_follows(), html`<p>Loading accounts followed...</p>`)}
<footer class="w3-container"> <footer class="w3-container">
<p> <p>
${edit} ${edit}