aboutsummaryrefslogtreecommitdiff
path: root/src/routes/user
diff options
context:
space:
mode:
authorFuwn <[email protected]>2023-12-31 12:07:08 -0800
committerFuwn <[email protected]>2023-12-31 12:07:08 -0800
commitd02a640a958f72d741e21bf558ae865228258330 (patch)
tree1f813946a5b85879cdc08d7783db474637065b5f /src/routes/user
parentfix(wrapped): score position highest rated (diff)
downloaddue.moe-d02a640a958f72d741e21bf558ae865228258330.tar.xz
due.moe-d02a640a958f72d741e21bf558ae865228258330.zip
refactor(badges): always show edit options
Diffstat (limited to 'src/routes/user')
-rw-r--r--src/routes/user/[user]/badges/+page.svelte104
1 files changed, 49 insertions, 55 deletions
diff --git a/src/routes/user/[user]/badges/+page.svelte b/src/routes/user/[user]/badges/+page.svelte
index c675f4d3..ed243bcf 100644
--- a/src/routes/user/[user]/badges/+page.svelte
+++ b/src/routes/user/[user]/badges/+page.svelte
@@ -164,6 +164,55 @@
{#await currentUserIdentity}
Loading user identity ... 60%
{:then identity}
+ {@const isOwner = identity && identity.name === data.username}
+
+ {#if isOwner}
+ <p>
+ <a href={`/user/${data.username}`}>Back to Profile</a>
+ •
+ <a href={`#`} on:click={() => (editMode = !editMode)}>
+ {editMode ? 'Disable' : 'Enable'} Edit Mode
+ </a>
+ •
+ <a href={`#`} on:click={() => screenshot()}>Download</a>
+ •
+ <input type="checkbox" bind:checked={dark} /> Dark Mode
+ <input type="checkbox" bind:checked={transparent} /> Transparent Background
+ </p>
+ {/if}
+
+ {#if editMode && isOwner}
+ <p>
+ Edit mode is enabled. Click on an image <b>twice</b> to delete it. There is no confirmation, so
+ be careful!
+ </p>
+
+ {#if error}
+ <p style="color: red;">{error}</p>
+ {/if}
+
+ <p>
+ <input type="text" placeholder="Image URL" name="image_url" minlength="1" maxlength="1000" />
+ <input
+ type="text"
+ placeholder="Activity URL"
+ name="activity_url"
+ minlength="1"
+ maxlength="1000"
+ />
+ <input
+ type="text"
+ placeholder="Description (Optional)"
+ name="description"
+ minlength="1"
+ maxlength="1000"
+ />
+ <input type="datetime-local" />
+ <small>Must be full date, defaults to now if empty</small>
+ <a href={`#`} on:click={submitBadge}>Add Badge</a>
+ </p>
+ {/if}
+
{#await badgesPromise}
Loading badges ... 40%
{:then badgesResponse}
@@ -171,61 +220,6 @@
{#await badgesResponse.json()}
Loading badges ... 80%
{:then badges}
- {@const isOwner = identity && identity.name === data.username}
-
- {#if isOwner}
- <p>
- <a href={`/user/${data.username}`}>Back to Profile</a>
- •
- <a href={`#`} on:click={() => (editMode = !editMode)}>
- {editMode ? 'Disable' : 'Enable'} Edit Mode
- </a>
- •
- <a href={`#`} on:click={() => screenshot()}>Download</a>
- •
- <input type="checkbox" bind:checked={dark} /> Dark Mode
- <input type="checkbox" bind:checked={transparent} /> Transparent Background
- </p>
- {/if}
-
- {#if editMode && isOwner}
- <p>
- Edit mode is enabled. Click on an image <b>twice</b> to delete it. There is no confirmation,
- so be careful!
- </p>
-
- {#if error}
- <p style="color: red;">{error}</p>
- {/if}
-
- <p>
- <input
- type="text"
- placeholder="Image URL"
- name="image_url"
- minlength="1"
- maxlength="1000"
- />
- <input
- type="text"
- placeholder="Activity URL"
- name="activity_url"
- minlength="1"
- maxlength="1000"
- />
- <input
- type="text"
- placeholder="Description (Optional)"
- name="description"
- minlength="1"
- maxlength="1000"
- />
- <input type="datetime-local" />
- <small>Must be full date, defaults to now if empty</small>
- <a href={`#`} on:click={submitBadge}>Add Badge</a>
- </p>
- {/if}
-
<div id="badges">
{#if badges === null}
{@html nbsp('Loading badges ... 50%')}