From 7d8bb1023ed1b57885672f2a94ae2157f8e3823c Mon Sep 17 00:00:00 2001 From: Sam Date: Sun, 19 Mar 2023 01:37:59 +0100 Subject: [PATCH] feat: add button to remove existing user/member avatar --- frontend/src/routes/edit/EditableField.svelte | 1 - .../src/routes/edit/member/[id]/+page.svelte | 5 +++- frontend/src/routes/edit/profile/+page.svelte | 29 ++++++++++--------- 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/frontend/src/routes/edit/EditableField.svelte b/frontend/src/routes/edit/EditableField.svelte index 72b1ad0..683b9f7 100644 --- a/frontend/src/routes/edit/EditableField.svelte +++ b/frontend/src/routes/edit/EditableField.svelte @@ -47,7 +47,6 @@ tooltip="Move field right" click={() => moveField(false)} /> - diff --git a/frontend/src/routes/edit/member/[id]/+page.svelte b/frontend/src/routes/edit/member/[id]/+page.svelte index 2cdf312..ce6c7e8 100644 --- a/frontend/src/routes/edit/member/[id]/+page.svelte +++ b/frontend/src/routes/edit/member/[id]/+page.svelte @@ -317,7 +317,9 @@

Avatar

- {#if avatar} + {#if avatar === ""} + + {:else if avatar} New avatar {:else} @@ -335,6 +337,7 @@ 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.

+ (avatar = "")}>Remove avatar
diff --git a/frontend/src/routes/edit/profile/+page.svelte b/frontend/src/routes/edit/profile/+page.svelte index eae1a32..ebe1ac8 100644 --- a/frontend/src/routes/edit/profile/+page.svelte +++ b/frontend/src/routes/edit/profile/+page.svelte @@ -12,15 +12,7 @@ } from "$lib/api/entities"; import FallbackImage from "$lib/components/FallbackImage.svelte"; import { userStore } from "$lib/store"; - import { - Alert, - Button, - ButtonDropdown, - DropdownToggle, - FormGroup, - Icon, - Input, - } from "sveltestrap"; + import { Alert, Button, ButtonGroup, FormGroup, Icon, Input } from "sveltestrap"; import { encode } from "base64-arraybuffer"; import { apiFetchClient } from "$lib/api/fetch"; import IconButton from "$lib/components/IconButton.svelte"; @@ -248,9 +240,15 @@

Edit profile - {#if modified} - - {/if} + + + {#if modified} + + {/if} +

{#if error} @@ -266,7 +264,9 @@

Avatar

- {#if avatar} + {#if avatar === ""} + + {:else if avatar} New avatar {:else} @@ -284,6 +284,9 @@ 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.

+

+ (avatar = "")}>Remove avatar +