Lay out the profile editing form better so it feels less janky.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4566 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
Cory McWilliams 2023-10-21 21:31:46 +00:00
parent 626fa4f27b
commit ab03692a4c
2 changed files with 8 additions and 8 deletions

View File

@ -1,5 +1,5 @@
{ {
"type": "tildefriends-app", "type": "tildefriends-app",
"emoji": "🐌", "emoji": "🐌",
"previous": "&zyNDG83KbSp1GmOhuS5CtxRLT8Lt7N7Agk8gpLSZhco=.sha256" "previous": "&HrGonbL2IZBtoP3zh1glMUO16+PZ4/t0KFTpkNMYoPI=.sha256"
} }

View File

@ -180,27 +180,27 @@ class TfProfileElement extends LitElement {
html`<input type="button" value="Block" @click=${this.block}></input>`; html`<input type="button" value="Block" @click=${this.block}></input>`;
} }
let edit_profile = this.editing ? html` let edit_profile = this.editing ? html`
<div style="flex: 1 0 50%"> <div style="flex: 1 0 50%; display: flex; flex-direction: column">
<div> <div>
<label for="name">Name:</label> <label for="name">Name:</label>
<input type="text" id="name" value=${this.editing.name} @input=${event => this.editing = Object.assign({}, this.editing, {name: event.srcElement.value})}></input> <input type="text" id="name" value=${this.editing.name} @input=${event => this.editing = Object.assign({}, this.editing, {name: event.srcElement.value})}></input>
</div> </div>
<div>
<div><label for="description">Description:</label></div> <div><label for="description">Description:</label></div>
<textarea id="description" @input=${event => this.editing = Object.assign({}, this.editing, {description: event.srcElement.value})}>${this.editing.description}</textarea> <textarea style="flex: 1 0" id="description" @input=${event => this.editing = Object.assign({}, this.editing, {description: event.srcElement.value})}>${this.editing.description}</textarea>
</div>
<div> <div>
<label for="public_web_hosting">Public Web Hosting:</label> <label for="public_web_hosting">Public Web Hosting:</label>
<input type="checkbox" id="public_web_hosting" value=${this.editing.public_web_hosting} @input=${event => this.editing = Object.assign({}, this.editing, {publicWebHosting: event.srcElement.checked})}></input> <input type="checkbox" id="public_web_hosting" value=${this.editing.public_web_hosting} @input=${event => this.editing = Object.assign({}, this.editing, {publicWebHosting: event.srcElement.checked})}></input>
</div> </div>
<div>
<input type="button" value="Attach Image" @click=${this.attach_image}></input> <input type="button" value="Attach Image" @click=${this.attach_image}></input>
</div>
</div>` : null; </div>` : null;
let image = typeof(profile.image) == 'string' ? profile.image : profile.image?.link; let image = typeof(profile.image) == 'string' ? profile.image : profile.image?.link;
image = this.editing?.image ?? image; image = this.editing?.image ?? image;
let description = this.editing?.description ?? profile.description; let description = this.editing?.description ?? profile.description;
return html`<div style="border: 2px solid black; background-color: rgba(255, 255, 255, 0.2); padding: 16px"> return html`<div style="border: 2px solid black; background-color: rgba(255, 255, 255, 0.2); padding: 16px">
<tf-user id=${this.id} .users=${this.users}></tf-user> (${tfutils.human_readable_size(this.size)}) <tf-user id=${this.id} .users=${this.users}></tf-user> (${tfutils.human_readable_size(this.size)})
<div style="display: flex; flex-direction: row"> <div style="display: flex; flex-direction: row; gap: 1em">
${edit_profile} ${edit_profile}
<div style="flex: 1 0 50%"> <div style="flex: 1 0 50%">
<div><img src=${'/' + image + '/view'} style="width: 256px; height: auto"></img></div> <div><img src=${'/' + image + '/view'} style="width: 256px; height: auto"></img></div>