Make the wiki app use the global id picker.

This commit is contained in:
2024-04-14 13:53:51 +01:00
parent 96cb6f4b12
commit b5e966c9a1
5 changed files with 11 additions and 50 deletions

View File

@ -31,13 +31,16 @@ class TfCollectionsAppElement extends LitElement {
tfrpc.register(function hash_changed(hash) {
self.notify_hash_changed(hash);
});
tfrpc.register(function setActiveIdentity(id) {
self.whoami = id;
});
tfrpc.rpc.get_hash().then((hash) => self.notify_hash_changed(hash));
}
async load() {
this.ids = await tfrpc.rpc.getIdentities();
this.owner_ids = await tfrpc.rpc.getOwnerIdentities();
this.whoami = await tfrpc.rpc.localStorageGet('collections_whoami');
this.whoami = await tfrpc.rpc.getActiveIdentity();
let ids = [...new Set([...this.owner_ids, this.whoami])].sort();
this.following = Object.keys(await tfrpc.rpc.following(ids, 1)).sort();
@ -273,9 +276,6 @@ class TfCollectionsAppElement extends LitElement {
margin-right: 16px;
}
</style>
<div>
<tf-id-picker .ids=${this.ids} selected=${this.whoami} @change=${this.on_whoami_changed} ?hidden=${!this.ids?.length}></tf-id-picker>
</div>
<div>
${keyed(
this.whoami,