mirror of https://github.com/VERT-sh/VERT.git
Reapply "feat: drop or click to *convert* (#52)"
This reverts commit 7151a2dbce
.
This commit is contained in:
parent
dda20f13a6
commit
aa5d4689c0
|
@ -19,7 +19,7 @@
|
||||||
let acceptedTypes = $state<string>();
|
let acceptedTypes = $state<string>();
|
||||||
|
|
||||||
const setupFileInput = async () => {
|
const setupFileInput = async () => {
|
||||||
if(!fileInput) return;
|
if (!fileInput) return;
|
||||||
|
|
||||||
const filteredConverters = (
|
const filteredConverters = (
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
|
@ -33,21 +33,19 @@
|
||||||
.join(",");
|
.join(",");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const uploadFiles = async () => {
|
const uploadFiles = async () => {
|
||||||
if(!fileInput) return
|
if (!fileInput) return;
|
||||||
fileInput.click();
|
fileInput.click();
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleFileChange = (e: Event) => {
|
const handleFileChange = (e: Event) => {
|
||||||
if(!fileInput) return;
|
if (!fileInput) return;
|
||||||
|
|
||||||
const oldLength = files.files.length;
|
const oldLength = files.files.length;
|
||||||
files.add(fileInput.files);
|
files.add(fileInput.files);
|
||||||
if (oldLength !== files.files.length) goto("/convert");
|
if (oldLength !== files.files.length) goto("/convert");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
const handler = (e: Event) => {
|
const handler = (e: Event) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
@ -70,12 +68,21 @@
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<input bind:this={fileInput} type="file" multiple class="hidden" onchange={handleFileChange} accept={acceptedTypes}>
|
<input
|
||||||
|
bind:this={fileInput}
|
||||||
|
type="file"
|
||||||
|
multiple
|
||||||
|
class="hidden"
|
||||||
|
onchange={handleFileChange}
|
||||||
|
accept={acceptedTypes}
|
||||||
|
/>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
onclick={uploadFiles}
|
onclick={uploadFiles}
|
||||||
bind:this={uploaderButton}
|
bind:this={uploaderButton}
|
||||||
class={clsx(`hover:scale-105 active:scale-100 ${$effects ? "" : "!scale-100"} duration-200 ${classList}`)}
|
class={clsx(
|
||||||
|
`hover:scale-105 active:scale-100 ${$effects ? "" : "!scale-100"} duration-200 ${classList}`,
|
||||||
|
)}
|
||||||
>
|
>
|
||||||
<Panel
|
<Panel
|
||||||
class="flex justify-center items-center w-full h-full flex-col pointer-events-none"
|
class="flex justify-center items-center w-full h-full flex-col pointer-events-none"
|
||||||
|
@ -86,7 +93,7 @@
|
||||||
<UploadIcon class="w-full h-full text-on-accent" />
|
<UploadIcon class="w-full h-full text-on-accent" />
|
||||||
</div>
|
</div>
|
||||||
<h2 class="text-center text-2xl font-semibold mt-4">
|
<h2 class="text-center text-2xl font-semibold mt-4">
|
||||||
Drop or click to upload
|
Drop or click to convert
|
||||||
</h2>
|
</h2>
|
||||||
</Panel>
|
</Panel>
|
||||||
</button>
|
</button>
|
||||||
|
|
Loading…
Reference in New Issue