feat: add button to remove existing user/member avatar
This commit is contained in:
parent
77ae15a468
commit
7d8bb1023e
3 changed files with 20 additions and 15 deletions
|
@ -47,7 +47,6 @@
|
||||||
tooltip="Move field right"
|
tooltip="Move field right"
|
||||||
click={() => moveField(false)}
|
click={() => moveField(false)}
|
||||||
/>
|
/>
|
||||||
<!-- <InputGroupText>Name</InputGroupText> -->
|
|
||||||
<Input bind:value={field.name} />
|
<Input bind:value={field.name} />
|
||||||
<Button color="danger" on:click={() => deleteField()}>Delete field</Button>
|
<Button color="danger" on:click={() => deleteField()}>Delete field</Button>
|
||||||
</InputGroup>
|
</InputGroup>
|
||||||
|
|
|
@ -317,7 +317,9 @@
|
||||||
<h4>Avatar</h4>
|
<h4>Avatar</h4>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md text-center">
|
<div class="col-md text-center">
|
||||||
{#if avatar}
|
{#if avatar === ""}
|
||||||
|
<FallbackImage alt="Current avatar" urls={[]} width={200} />
|
||||||
|
{:else if avatar}
|
||||||
<img width={200} src={avatar} alt="New avatar" class="rounded-circle img-fluid" />
|
<img width={200} src={avatar} alt="New avatar" class="rounded-circle img-fluid" />
|
||||||
{:else}
|
{:else}
|
||||||
<FallbackImage alt="Current avatar" urls={memberAvatars(data.member)} width={200} />
|
<FallbackImage alt="Current avatar" urls={memberAvatars(data.member)} width={200} />
|
||||||
|
@ -335,6 +337,7 @@
|
||||||
<Icon name="info-circle-fill" /> Only PNG, JPEG, GIF, and WebP can be used as avatars.
|
<Icon name="info-circle-fill" /> Only PNG, JPEG, GIF, and WebP can be used as avatars.
|
||||||
Avatars cannot be larger than 1 MB, and animated avatars will be made static.
|
Avatars cannot be larger than 1 MB, and animated avatars will be made static.
|
||||||
</p>
|
</p>
|
||||||
|
<a href="" on:click={() => (avatar = "")}>Remove avatar</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -12,15 +12,7 @@
|
||||||
} from "$lib/api/entities";
|
} from "$lib/api/entities";
|
||||||
import FallbackImage from "$lib/components/FallbackImage.svelte";
|
import FallbackImage from "$lib/components/FallbackImage.svelte";
|
||||||
import { userStore } from "$lib/store";
|
import { userStore } from "$lib/store";
|
||||||
import {
|
import { Alert, Button, ButtonGroup, FormGroup, Icon, Input } from "sveltestrap";
|
||||||
Alert,
|
|
||||||
Button,
|
|
||||||
ButtonDropdown,
|
|
||||||
DropdownToggle,
|
|
||||||
FormGroup,
|
|
||||||
Icon,
|
|
||||||
Input,
|
|
||||||
} from "sveltestrap";
|
|
||||||
import { encode } from "base64-arraybuffer";
|
import { encode } from "base64-arraybuffer";
|
||||||
import { apiFetchClient } from "$lib/api/fetch";
|
import { apiFetchClient } from "$lib/api/fetch";
|
||||||
import IconButton from "$lib/components/IconButton.svelte";
|
import IconButton from "$lib/components/IconButton.svelte";
|
||||||
|
@ -248,9 +240,15 @@
|
||||||
|
|
||||||
<h1>
|
<h1>
|
||||||
Edit profile
|
Edit profile
|
||||||
|
<ButtonGroup>
|
||||||
|
<Button color="secondary" href="/@{$userStore?.name}">
|
||||||
|
<Icon name="chevron-left" />
|
||||||
|
Back to your profile
|
||||||
|
</Button>
|
||||||
{#if modified}
|
{#if modified}
|
||||||
<Button color="success" on:click={() => updateUser()}>Save changes</Button>
|
<Button color="success" on:click={() => updateUser()}>Save changes</Button>
|
||||||
{/if}
|
{/if}
|
||||||
|
</ButtonGroup>
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
{#if error}
|
{#if error}
|
||||||
|
@ -266,7 +264,9 @@
|
||||||
<h4>Avatar</h4>
|
<h4>Avatar</h4>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md text-center">
|
<div class="col-md text-center">
|
||||||
{#if avatar}
|
{#if avatar === ""}
|
||||||
|
<FallbackImage alt="Current avatar" urls={[]} width={200} />
|
||||||
|
{:else if avatar}
|
||||||
<img width={200} src={avatar} alt="New avatar" class="rounded-circle img-fluid" />
|
<img width={200} src={avatar} alt="New avatar" class="rounded-circle img-fluid" />
|
||||||
{:else}
|
{:else}
|
||||||
<FallbackImage alt="Current avatar" urls={userAvatars($userStore)} width={200} />
|
<FallbackImage alt="Current avatar" urls={userAvatars($userStore)} width={200} />
|
||||||
|
@ -284,6 +284,9 @@
|
||||||
<Icon name="info-circle-fill" /> Only PNG, JPEG, GIF, and WebP images can be used as avatars.
|
<Icon name="info-circle-fill" /> Only PNG, JPEG, GIF, and WebP images can be used as avatars.
|
||||||
Avatars cannot be larger than 1 MB, and animated avatars will be made static.
|
Avatars cannot be larger than 1 MB, and animated avatars will be made static.
|
||||||
</p>
|
</p>
|
||||||
|
<p>
|
||||||
|
<a href="" on:click={() => (avatar = "")}>Remove avatar</a>
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue