From 00c93df585ec75435419a889f25760ed60181ee2 Mon Sep 17 00:00:00 2001 From: Spectralitree <72747870+Spectralitree@users.noreply.github.com> Date: Sun, 12 Dec 2021 07:46:57 +0100 Subject: [PATCH] feat: system editing! --- package.json | 1 + src/lib/CardsHeader.svelte | 9 +++- src/lib/system/Edit.svelte | 93 ++++++++++++++++++++++++++++++++++++++ src/lib/system/Main.svelte | 8 ++-- yarn.lock | 12 +++++ 5 files changed, 119 insertions(+), 4 deletions(-) create mode 100644 src/lib/system/Edit.svelte diff --git a/package.json b/package.json index a540d824..4b8a8f93 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "discord-markdown": "^2.5.1", "moment": "^2.29.1", "moment-timezone": "^0.5.34", + "svelte-autosize": "^1.0.1", "svelte-icons": "^2.1.0", "svelte-navigator": "^3.1.5", "sveltestrap": "^5.6.3" diff --git a/src/lib/CardsHeader.svelte b/src/lib/CardsHeader.svelte index b2c123a9..a6fc87dc 100644 --- a/src/lib/CardsHeader.svelte +++ b/src/lib/CardsHeader.svelte @@ -1,5 +1,5 @@ @@ -17,11 +19,16 @@ {item.name} ({item.id}) + + {#if loading} + + {/if} {#if item && item.avatar_url} {if (event.key === "Enter") avatarOpen = true}} on:click={toggleAvatarModal} class="rounded-circle avatar" src={item.avatar_url} alt="Your system avatar" /> {:else} {/if} + diff --git a/src/lib/system/Edit.svelte b/src/lib/system/Edit.svelte new file mode 100644 index 00000000..42ffc39d --- /dev/null +++ b/src/lib/system/Edit.svelte @@ -0,0 +1,93 @@ + + +{#each err as error} + {@html error} +{/each} + + + Name: + + + + Tag: + + + + Timezone: + + + + Color: + + + + Avatar url: + + + + Banner url: + + + + + Description: + + +Submit editMode = false}>Back \ No newline at end of file diff --git a/src/lib/system/Main.svelte b/src/lib/system/Main.svelte index a745f6ba..068b0cc3 100644 --- a/src/lib/system/Main.svelte +++ b/src/lib/system/Main.svelte @@ -3,21 +3,23 @@ import CardsHeader from '../CardsHeader.svelte'; import SystemBody from './Body.svelte'; import SystemPrivacy from './Privacy.svelte'; + import Edit from './Edit.svelte'; import type Sys from '../../api/system'; export let user: Sys; export let isPublic = true; + let loading: boolean; let editMode = false; - + {#if !editMode} - + {:else} - hehe + {/if} diff --git a/yarn.lock b/yarn.lock index 5c93c089..7d8052ab 100644 --- a/yarn.lock +++ b/yarn.lock @@ -104,6 +104,11 @@ anymatch@~3.1.2: normalize-path "^3.0.0" picomatch "^2.0.4" +autosize@*: + version "5.0.1" + resolved "https://registry.yarnpkg.com/autosize/-/autosize-5.0.1.tgz#ed269b0fa9b7eb47627048a1bb3299e99e003a0f" + integrity sha512-UIWUlE4TOVPNNj2jjrU39wI4hEYbneUypEqcyRmRFIx5CC2gNdg3rQr+Zh7/3h6egbBvm33TDQjNQKtj9Tk1HA== + axios@^0.24.0: version "0.24.0" resolved "https://registry.yarnpkg.com/axios/-/axios-0.24.0.tgz#804e6fa1e4b9c5288501dd9dff56a7a0940d20d6" @@ -738,6 +743,13 @@ supports-color@^7.1.0: dependencies: has-flag "^4.0.0" +svelte-autosize@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/svelte-autosize/-/svelte-autosize-1.0.1.tgz#2121b2373ab89191a58aaa9a3aec957ca475e812" + integrity sha512-HBk7Xrt5bS0rpp5zSUZvuXNKc0UhAxvJGLNy1eTHMDK/KkHb0UsgWpbyn60jW3tE2ZfuXfLttnHvvb1H4zZZ0Q== + dependencies: + autosize "*" + svelte-check@^2.2.7: version "2.2.10" resolved "https://registry.yarnpkg.com/svelte-check/-/svelte-check-2.2.10.tgz#ca2e4fde2d077e703792d8301a643c36375f646c"