From acb1b3180abad519db7634fb21f8ad04ccae689b Mon Sep 17 00:00:00 2001 From: SnowCait Date: Fri, 13 Oct 2023 12:05:15 +0900 Subject: [PATCH 1/3] Upload profile image --- web/src/routes/editor/MediaPicker.svelte | 8 ++- web/src/routes/profile/+page.svelte | 85 ++++++++++++++++++++---- 2 files changed, 77 insertions(+), 16 deletions(-) diff --git a/web/src/routes/editor/MediaPicker.svelte b/web/src/routes/editor/MediaPicker.svelte index 3d23255db..f2ce85878 100644 --- a/web/src/routes/editor/MediaPicker.svelte +++ b/web/src/routes/editor/MediaPicker.svelte @@ -1,12 +1,16 @@ - diff --git a/web/src/routes/profile/+page.svelte b/web/src/routes/profile/+page.svelte index 28b82d2fe..6145b356a 100644 --- a/web/src/routes/profile/+page.svelte +++ b/web/src/routes/profile/+page.svelte @@ -1,11 +1,49 @@ + + Edit profile - nostter + +

Edit profile

@@ -94,7 +98,7 @@ placeholder="https://example.com/banner.webp" bind:value={$authorProfile.banner} /> - + {#if $authorProfile.banner} preview From c1096492eb4d20c3bbad63647141d535e6981763 Mon Sep 17 00:00:00 2001 From: SnowCait Date: Fri, 13 Oct 2023 12:20:59 +0900 Subject: [PATCH 3/3] Refactor media picker --- web/src/routes/editor/MediaPicker.svelte | 14 +------------- web/src/routes/editor/NoteEditor.svelte | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/web/src/routes/editor/MediaPicker.svelte b/web/src/routes/editor/MediaPicker.svelte index f2ce85878..bcef97d2c 100644 --- a/web/src/routes/editor/MediaPicker.svelte +++ b/web/src/routes/editor/MediaPicker.svelte @@ -2,28 +2,16 @@ import { createEventDispatcher } from 'svelte'; import IconPhoto from '@tabler/icons-svelte/dist/svelte/icons/IconPhoto.svelte'; - export let mediaFiles: File[] = []; - let input: HTMLInputElement | undefined; let files: FileList; const dispatch = createEventDispatcher(); - - function upload() { - dispatch('pick', files); - console.log('[media upload]', files); - for (const file of files) { - console.log('[media upload file]', file); - mediaFiles.push(file); - mediaFiles = mediaFiles; - } - } - + dispatch('pick', files)} accept="image/*" hidden>