Show names in the id picker.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4623 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
Cory McWilliams 2023-11-08 23:51:54 +00:00
parent 5e8cd12760
commit b4236d0ec0
3 changed files with 5 additions and 3 deletions

View File

@ -1,5 +1,5 @@
{
"type": "tildefriends-app",
"emoji": "🐌",
"previous": "&eHrt88ylDUCaDFIj3DTdUaHPYQRe81K//O80CHp+pyk=.sha256"
"previous": "&dc3Eovh35uB024L4dyFX+n8N37ove9STsKmkKlO/pcQ=.sha256"
}

View File

@ -183,7 +183,7 @@ class TfElement extends LitElement {
render_id_picker() {
return html`
<tf-id-picker id="picker" selected=${this.whoami} .ids=${this.ids} @change=${this._handle_whoami_changed}></tf-id-picker>
<tf-id-picker id="picker" selected=${this.whoami} .ids=${this.ids} .users=${this.users} @change=${this._handle_whoami_changed}></tf-id-picker>
<button @click=${this.create_identity} id="create_identity">Create Identity</button>
`;
}

View File

@ -9,12 +9,14 @@ class TfIdentityPickerElement extends LitElement {
return {
ids: {type: Array},
selected: {type: String},
users: {type: Object},
};
}
constructor() {
super();
this.ids = [];
this.users = {};
}
changed(event) {
@ -27,7 +29,7 @@ class TfIdentityPickerElement extends LitElement {
render() {
return html`
<select @change=${this.changed} style="max-width: 100%">
${(this.ids ?? []).map(id => html`<option ?selected=${id == this.selected} value=${id}>${id}</option>`)}
${(this.ids ?? []).map(id => html`<option ?selected=${id == this.selected} value=${id}>${this.users[id]?.name ? (this.users[id]?.name + ' - ') : undefined}<small>${id}</small></option>`)}
</select>
`;
}