Merge branch 'main' into tasiaiso-format

This commit is contained in:
2024-05-12 02:06:09 -04:00
11 changed files with 267 additions and 83 deletions

View File

@ -1,5 +1,5 @@
{
"type": "tildefriends-app",
"emoji": "🐌",
"previous": "&vEaOZjrNb0u9rhNqrQ8eU9TlOFlo4HsgW6hbI7VdIT0=.sha256"
"previous": "&raSj7ozmSDNGmB6TtjDk7oOiTc33ZN+RrBMASJ2F4cA=.sha256"
}

View File

@ -264,6 +264,7 @@ class TfElement extends LitElement {
hash=${this.hash}
.unread=${this.unread}
@refresh=${() => (this.unread = [])}
?loading=${this.loading}
></tf-tab-news>
`;
} else if (this.tab === 'connections') {

View File

@ -7,9 +7,11 @@ class TfTabConnectionsElement extends LitElement {
return {
broadcasts: {type: Array},
identities: {type: Array},
my_identities: {type: Array},
connections: {type: Array},
stored_connections: {type: Array},
users: {type: Object},
server_identity: {type: String},
};
}
@ -20,15 +22,22 @@ class TfTabConnectionsElement extends LitElement {
let self = this;
this.broadcasts = [];
this.identities = [];
this.my_identities = [];
this.connections = [];
this.stored_connections = [];
this.users = {};
tfrpc.rpc.getIdentities().then(function (identities) {
self.my_identities = identities || [];
});
tfrpc.rpc.getAllIdentities().then(function (identities) {
self.identities = identities || [];
});
tfrpc.rpc.getStoredConnections().then(function (connections) {
self.stored_connections = connections || [];
});
tfrpc.rpc.getServerIdentity().then(function (identity) {
self.server_identity = identity;
});
}
render_connection_summary(connection) {
@ -184,6 +193,12 @@ class TfTabConnectionsElement extends LitElement {
${this.identities.map(
(x) =>
html`<li class="w3-bar">
${x == this.server_identity ?
html`<span class="w3-tag w3-medium w3-round w3-theme-l1">🖥 local server</span>` :
undefined}
${this.my_identities.indexOf(x) != -1 ?
html`<span class="w3-tag w3-medium w3-round w3-theme-d1">😎 you</span>` :
undefined}
<tf-user id=${x} .users=${this.users}></tf-user>
</li>`
)}

View File

@ -12,6 +12,7 @@ class TfTabNewsElement extends LitElement {
following: {type: Array},
drafts: {type: Object},
expanded: {type: Object},
loading: {type: Boolean},
};
}
@ -113,6 +114,15 @@ class TfTabNewsElement extends LitElement {
.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`
<p class="w3-bar">
<button
@ -124,6 +134,7 @@ class TfTabNewsElement extends LitElement {
</p>
<div>
Welcome, <tf-user id=${this.whoami} .users=${this.users}></tf-user>!
${edit_profile}
</div>
<div>
<tf-compose