From 80602cadf6e083fa171cae355592b4176fe4f16e Mon Sep 17 00:00:00 2001 From: JovannMC Date: Wed, 13 Nov 2024 17:49:57 +0300 Subject: [PATCH] Make dialog default to only show supported formats --- bun.lockb | Bin 120042 -> 120042 bytes src/lib/components/functional/Uploader.svelte | 4 +++- src/routes/+page.svelte | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/bun.lockb b/bun.lockb index 70a4bc834b57a57f3e9af94eb15e519386e87acb..124fa2ba466133d3af5e01c93bd5408a1e4ca26a 100755 GIT binary patch delta 26 icmaF0lKs_6_J%EtoQ@ofaRzz@dd7y^1sxf0P6hyh8wjxg delta 26 dcmaF0lKs_6_J%EtoQ@n!3=ptg(2?=xWB_rz2Q&Zx diff --git a/src/lib/components/functional/Uploader.svelte b/src/lib/components/functional/Uploader.svelte index 23e23af..28beb68 100644 --- a/src/lib/components/functional/Uploader.svelte +++ b/src/lib/components/functional/Uploader.svelte @@ -10,6 +10,7 @@ files: File[] | undefined; onupload?: () => void; isMobile: boolean; + acceptedFormats?: string[]; } $effect(() => { @@ -20,7 +21,7 @@ let fileInput = $state(); let dragOver = $state(false); - let { files = $bindable(), onupload, isMobile }: Props = $props(); + let { files = $bindable(), onupload, isMobile, acceptedFormats }: Props = $props(); function upload() { if (!fileInput) return; @@ -108,6 +109,7 @@ class="hidden" bind:this={fileInput} onchange={addFiles} + accept={acceptedFormats?.join(",") ?? "*"} multiple /> diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 14297d5..d84bec7 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -77,6 +77,7 @@ isMobile={data.isMobile} bind:files={ourFiles} onupload={runUpload} + acceptedFormats={converters.flatMap((c) => c.supportedFormats)} />