add video fallback, extend uploader w/ no files

This commit is contained in:
JovannMC 2025-02-08 21:08:31 +03:00
parent f7943382d4
commit 5ec93ab8b3
No known key found for this signature in database
1 changed files with 13 additions and 2 deletions

View File

@ -15,6 +15,8 @@
DownloadIcon, DownloadIcon,
FileMusicIcon, FileMusicIcon,
FileQuestionIcon, FileQuestionIcon,
FileVideo2,
FilmIcon,
ImageIcon, ImageIcon,
ImageOffIcon, ImageOffIcon,
RotateCwIcon, RotateCwIcon,
@ -47,12 +49,15 @@
{#snippet fileItem(file: VertFile, index: number)} {#snippet fileItem(file: VertFile, index: number)}
{@const isAudio = file.converter?.name === "ffmpeg"} {@const isAudio = file.converter?.name === "ffmpeg"}
{@const isVideo = file.converter?.name === "vertd"}
<Panel class="p-5 flex flex-col min-w-0 gap-4 relative"> <Panel class="p-5 flex flex-col min-w-0 gap-4 relative">
<div class="flex-shrink-0 h-8 w-full flex items-center gap-2"> <div class="flex-shrink-0 h-8 w-full flex items-center gap-2">
{#if !file.converter} {#if !file.converter}
<FileQuestionIcon size="24" class="flex-shrink-0" /> <FileQuestionIcon size="24" class="flex-shrink-0" />
{:else if isAudio} {:else if isAudio}
<AudioLines size="24" class="flex-shrink-0" /> <AudioLines size="24" class="flex-shrink-0" />
{:else if isVideo}
<FilmIcon size="24" class="flex-shrink-0" />
{:else} {:else}
<ImageIcon size="24" class="flex-shrink-0" /> <ImageIcon size="24" class="flex-shrink-0" />
{/if} {/if}
@ -87,7 +92,7 @@
> >
<p class="font-body font-bold">We can't convert this file.</p> <p class="font-body font-bold">We can't convert this file.</p>
<p class="font-normal"> <p class="font-normal">
Only image and audio files are supported Only image, video, and audio files are supported
</p> </p>
</div> </div>
{:else} {:else}
@ -107,10 +112,14 @@
class="w-full h-full flex items-center justify-center text-black" class="w-full h-full flex items-center justify-center text-black"
style="background: var({isAudio style="background: var({isAudio
? '--bg-gradient-purple-alt' ? '--bg-gradient-purple-alt'
: isVideo
? '--bg-gradient-red-alt'
: '--bg-gradient-blue-alt'})" : '--bg-gradient-blue-alt'})"
> >
{#if isAudio} {#if isAudio}
<FileMusicIcon size="56" /> <FileMusicIcon size="56" />
{:else if isVideo}
<FileVideo2 size="56" />
{:else} {:else}
<ImageOffIcon size="56" /> <ImageOffIcon size="56" />
{/if} {/if}
@ -133,6 +142,8 @@
<button <button
class="btn p-0 w-14 h-14 text-black {isAudio class="btn p-0 w-14 h-14 text-black {isAudio
? 'bg-accent-purple' ? 'bg-accent-purple'
: isVideo
? 'bg-accent-red'
: 'bg-accent-blue'}" : 'bg-accent-blue'}"
disabled={!files.ready} disabled={!files.ready}
onclick={file.convert} onclick={file.convert}
@ -174,7 +185,7 @@
{/if} {/if}
{/each} {/each}
{#if files.files.length === 0} {#if files.files.length === 0}
<Uploader class="w-full h-full" /> <Uploader class="w-full h-full col-span-2" />
{/if} {/if}
</div> </div>
</div> </div>