diff options
| author | Adam Soltys <[email protected]> | 2026-02-11 17:51:24 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-02-11 17:51:24 -0800 |
| commit | 13466248004327e9a026cb89f94926f9b060d1c1 (patch) | |
| tree | 47b4972c33809ccdf866b043c92cd3e0ecf5dcd0 /src/components/ItemForm.svelte | |
| parent | 3aa9ce1b5985397d7f568887ec6f881df13c1034 (diff) | |
| download | coinos-ui-13466248004327e9a026cb89f94926f9b060d1c1.tar.gz coinos-ui-13466248004327e9a026cb89f94926f9b060d1c1.zip | |
linting
Diffstat (limited to 'src/components/ItemForm.svelte')
| -rw-r--r-- | src/components/ItemForm.svelte | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/components/ItemForm.svelte b/src/components/ItemForm.svelte index d087e2bf..7215a239 100644 --- a/src/components/ItemForm.svelte +++ b/src/components/ItemForm.svelte @@ -1,5 +1,5 @@ <script lang="ts"> - import { preventDefault } from 'svelte/legacy'; + import { preventDefault } from "svelte/legacy"; import { t } from "$lib/translations"; import { upload } from "$lib/upload"; @@ -8,12 +8,19 @@ import Spinner from "$comp/Spinner.svelte"; let { item = $bindable(), user } = $props(); - let fileInput: HTMLInputElement | undefined = $state(), formElement: HTMLFormElement | undefined = $state(), file: File, submitting = $state(), progress: any; + let fileInput: HTMLInputElement | undefined = $state(), + formElement: HTMLFormElement | undefined = $state(), + file: File, + submitting = $state(), + progress: any; let select = () => fileInput!.click(); let src: string | undefined = $state(); let tooLarge: Record<string, boolean> = {}; - let handleFile = async ({ target }: { target: EventTarget | null }, type: string) => { + let handleFile = async ( + { target }: { target: EventTarget | null }, + type: string, + ) => { tooLarge[type] = false; file = (target as HTMLInputElement).files![0]; if (!file) return; @@ -35,7 +42,9 @@ if (src) { try { - let { hash } = JSON.parse(await upload(file, "item", progress) as string); + let { hash } = JSON.parse( + (await upload(file, "item", progress)) as string, + ); data.set("image", hash); @@ -107,11 +116,7 @@ onclick={select} aria-label="Select image" > - <img - {src} - alt={item.name} - class="object-cover w-full h-full" - /> + <img {src} alt={item.name} class="object-cover w-full h-full" /> </button> {:else if item.image} <button |
