ssb: Show connections in the sidebar. Fiddle with tf-user CSS to make it fit.
Some checks failed
Build Tilde Friends / Build-All (push) Has been cancelled

This commit is contained in:
2024-12-29 14:54:29 -05:00
parent 571cf5b5b8
commit bb97a8cccc
4 changed files with 42 additions and 32 deletions

View File

@ -15,6 +15,7 @@ class TfTabNewsElement extends LitElement {
channels: {type: Array},
channels_unread: {type: Object},
channels_latest: {type: Object},
connections: {type: Array},
};
}
@ -33,6 +34,7 @@ class TfTabNewsElement extends LitElement {
this.channels_unread = {};
this.channels_latest = {};
this.channels = [];
this.connections = [];
tfrpc.rpc.localStorageGet('drafts').then(function (d) {
self.drafts = JSON.parse(d || '{}');
});
@ -126,29 +128,7 @@ class TfTabNewsElement extends LitElement {
return this.hash.startsWith('##') ? this.hash.substring(2) : undefined;
}
render() {
let profile =
this.hash.startsWith('#@') && this.hash != '#@'
? html`<tf-profile
class="tf-profile"
id=${this.hash.substring(1)}
whoami=${this.whoami}
.users=${this.users}
></tf-profile>`
: undefined;
let edit_profile;
if (
!this.loading &&
this.users[this.whoami]?.name === undefined &&
this.hash.substring(1) != this.whoami
) {
edit_profile = html` <div
class="w3-panel w3-padding w3-round w3-card-4 w3-theme-l3"
>
Follow your identity link ☝️ above to edit your profile and set your
name.
</div>`;
}
render_sidebar() {
return html`
<div
class="w3-sidebar w3-bar-block w3-theme-d1 w3-collapse w3-animate-left"
@ -214,12 +194,45 @@ class TfTabNewsElement extends LitElement {
>
`
)}
<div class="w3-bar-item w3-theme-d2">Connections</div>
${this.connections.map((x) => (html`
<tf-user class="w3-bar-item" style="max-width: 100%" id=${x.id} .users=${this.users}></tf-user>
`))}
</div>
<div
class="w3-overlay"
id="sidebar_overlay"
@click=${this.hide_sidebar}
></div>
`;
}
render() {
let profile =
this.hash.startsWith('#@') && this.hash != '#@'
? html`<tf-profile
class="tf-profile"
id=${this.hash.substring(1)}
whoami=${this.whoami}
.users=${this.users}
></tf-profile>`
: undefined;
let edit_profile;
if (
!this.loading &&
this.users[this.whoami]?.name === undefined &&
this.hash.substring(1) != this.whoami
) {
edit_profile = html` <div
class="w3-panel w3-padding w3-round w3-card-4 w3-theme-l3"
>
Follow your identity link ☝️ above to edit your profile and set your
name.
</div>`;
}
return html`
${this.render_sidebar()}
<div
style="margin-left: 2in; padding: 0px; top: 0; max-height: 100%; overflow: scroll"
id="main"