Hide wiki things that don't apply when you're not logged in.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4617 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
Cory McWilliams 2023-11-07 23:34:55 +00:00
parent b3c9ad2fcb
commit 367c489fc3
3 changed files with 10 additions and 7 deletions

View File

@ -1,5 +1,5 @@
{
"type": "tildefriends-app",
"emoji": "📝",
"previous": "&s6S7S8P4kxvqLRip/WX45Bw7h+GG79BjJRBZOnaDtaE=.sha256"
"previous": "&rj3P1MdTitVRBCznRAN+lmMz8dxPwil2PjQ31KdkPi4=.sha256"
}

View File

@ -4,6 +4,7 @@ import * as tfrpc from '/static/tfrpc.js';
class TfCollectionElement extends LitElement {
static get properties() {
return {
whoami: {type: String},
collection: {type: Object},
selected_id: {type: String},
is_creating: {type: Boolean},
@ -69,7 +70,7 @@ class TfCollectionElement extends LitElement {
<option value="" ?selected=${this.selected_id === ''} disabled hidden>(select)</option>
${Object.values(this.collection ?? {}).map(x => html`<option value=${x.id} ?selected=${this.selected_id === x.id}>${x.name}</option>`)}
</select>
<span ?hidden=${!this.is_renaming}>
<span ?hidden=${!this.is_renaming || !this.whoami}>
<span style="display: inline-flex; flex-direction: row; margin-left: 8px; margin-right: 8px">
<label for="rename_name">🏷Rename to:</label>
<input type="text" id="rename_name"></input>
@ -77,15 +78,15 @@ class TfCollectionElement extends LitElement {
<button @click=${() => self.is_renaming = false}>x</button>
</span>
</span>
<button @click=${() => self.is_renaming = true} ?disabled=${this.is_renaming || !this.selected_id}>🏷</button>
<button @click=${self.on_tombstone} ?disabled=${!this.selected_id}>🪦</button>
<span ?hidden=${!this.is_creating}>
<button @click=${() => self.is_renaming = true} ?disabled=${this.is_renaming || !this.selected_id} ?hidden=${!this.whoami}>🏷</button>
<button @click=${self.on_tombstone} ?disabled=${!this.selected_id} ?hidden=${!this.whoami}>🪦</button>
<span ?hidden=${!this.is_creating || !this.whoami}>
<label for="create_name">New ${this.type} name:</label>
<input type="text" id="create_name"></input>
<button @click=${this.on_create}>Create ${this.type}</button>
<button @click=${() => self.is_creating = false}>x</button>
</span>
<button @click=${() => self.is_creating = true} ?hidden=${this.is_creating}>+</button>
<button @click=${() => self.is_creating = true} ?hidden=${this.is_creating || !this.whoami}>+</button>
</span>
`;
}

View File

@ -192,11 +192,12 @@ class TfCollectionsAppElement extends LitElement {
let self = this;
return html`
<div>
<tf-id-picker .ids=${this.ids} selected=${this.whoami} @change=${this.on_whoami_changed}></tf-id-picker>
<tf-id-picker .ids=${this.ids} selected=${this.whoami} @change=${this.on_whoami_changed} ?hidden=${!this.ids?.length}></tf-id-picker>
</div>
<div>
<tf-collection
.collection=${this.wikis}
whoami=${this.whoami}
selected_id=${this.wiki?.id}
@create=${this.on_wiki_create}
@rename=${this.on_wiki_rename}
@ -204,6 +205,7 @@ class TfCollectionsAppElement extends LitElement {
@change=${this.on_wiki_changed}></tf-collection>
${keyed(this.wiki_doc?.id, html`<tf-collection
.collection=${this.wiki_docs}
whoami=${this.whoami}
selected_id=${(this.wiki_doc && this.wiki_doc?.parent == this.wiki?.id) ? this.wiki_doc?.id : ''}
@create=${this.on_wiki_doc_create}
@rename=${this.on_wiki_doc_rename}