Warning with unsupported formats

This commit is contained in:
Realmy 2024-11-12 08:52:36 +01:00
parent 507155b041
commit f76d134b80
6 changed files with 51 additions and 34 deletions

View File

@ -17,6 +17,7 @@
--fg: hsl(0, 0%, 10%); --fg: hsl(0, 0%, 10%);
--fg-muted: hsl(0, 0%, 50%); --fg-muted: hsl(0, 0%, 50%);
--fg-muted-alt: hsl(0, 0%, 75%); --fg-muted-alt: hsl(0, 0%, 75%);
--fg-failure: hsl(0, 67%, 49%);
} }
body { body {

View File

@ -2,6 +2,7 @@ class Files {
public files = $state< public files = $state<
{ {
file: File; file: File;
from: string;
to: string; to: string;
blobUrl: string; blobUrl: string;
id: string; id: string;

View File

@ -5,7 +5,7 @@
import { quintOut } from "svelte/easing"; import { quintOut } from "svelte/easing";
import { files } from "$lib/store/index.svelte"; import { files } from "$lib/store/index.svelte";
import Logo from "$lib/components/visual/svg/Logo.svelte"; import Logo from "$lib/components/visual/svg/Logo.svelte";
import { fade, fly } from "svelte/transition"; import { fly } from "svelte/transition";
let { children, data } = $props(); let { children, data } = $props();
let navWidth = $state(1); let navWidth = $state(1);

View File

@ -11,6 +11,7 @@
...files.files, ...files.files,
...(ourFiles || []).map((f) => ({ ...(ourFiles || []).map((f) => ({
file: f, file: f,
from: "." + f.name.split(".").slice(-1),
to: converters[0].supportedFormats[0], to: converters[0].supportedFormats[0],
blobUrl: URL.createObjectURL(f), blobUrl: URL.createObjectURL(f),
id: Math.random().toString(36).substring(2), id: Math.random().toString(36).substring(2),

View File

@ -43,7 +43,7 @@
blurMultiplier: 16, blurMultiplier: 16,
}} }}
class={clsx( class={clsx(
"flex relative items-center w-full border-2 border-solid border-foreground-muted-alt rounded-xl pl-4 pr-2 py-2", "h-16 pl-4 pr-2 flex relative items-center w-full border-2 border-solid border-foreground-muted-alt rounded-xl",
{ {
"initial-fade": !finisheds[i], "initial-fade": !finisheds[i],
}, },
@ -58,23 +58,34 @@
> >
{file.file.name} {file.file.name}
</div> </div>
<div class="flex items-center gap-2 flex-shrink-0"> <div class="flex items-center gap-3 flex-shrink-0">
<span>from</span> {#if converters[0].supportedFormats.includes(file.from)}
<span <span>from</span>
class="py-2 px-3 font-display bg-foreground text-background rounded-xl" <span
>.{file.file.name.split(".").slice(-1)}</span class="py-2 px-3 font-display bg-foreground text-background rounded-xl"
> >{file.from}</span
<span>to</span> >
<select <span>to</span>
class="font-display border-2 border-solid border-foreground-muted-alt rounded-xl p-2 focus:!outline-none" <select
bind:value={files.conversionTypes[i]} class="font-display border-2 border-solid border-foreground-muted-alt rounded-xl p-2 focus:!outline-none"
> bind:value={files.conversionTypes[i]}
{#each converters[0].supportedFormats as conversionType} >
<option value={conversionType} {#each converters[0].supportedFormats as conversionType}
>{conversionType}</option <option value={conversionType}
> >{conversionType}</option
{/each} >
</select> {/each}
</select>
{:else}
<span
class="py-2 px-3 font-display bg-foreground-failure text-white rounded-xl"
>{file.from}</span
>
<span class="text-foreground-failure">
is not supported!
</span>
{/if}
<button <button
onclick={() => { onclick={() => {
// delete the file from the list // delete the file from the list
@ -88,23 +99,25 @@
</button> </button>
</div> </div>
</div> </div>
<!-- god knows why, but setting opacity > 0.98 causes a z-ordering issue in firefox ??? --> {#if converters[0].supportedFormats.includes(file.from)}
<div <!-- god knows why, but setting opacity > 0.98 causes a z-ordering issue in firefox ??? -->
class="absolute top-0 -z-50 left-0 w-full h-full rounded-[10px] overflow-hidden opacity-[0.98]"
>
<div <div
class="bg-cover bg-center w-full h-full" class="absolute top-0 -z-50 left-0 w-full h-full rounded-[10px] overflow-hidden opacity-[0.98]"
style="background-image: url({file.blobUrl});" >
></div> <div
<div class="absolute top-0 right-0 w-5/6 h-full"> class="bg-cover bg-center w-full h-full"
<ProgressiveBlur style="background-image: url({file.blobUrl});"
direction="right" ></div>
endIntensity={128} <div class="absolute top-0 right-0 w-5/6 h-full">
iterations={6} <ProgressiveBlur
fadeTo="rgba(255, 255, 255, 0.8)" direction="right"
/> endIntensity={128}
iterations={6}
fadeTo="rgba(255, 255, 255, 0.8)"
/>
</div>
</div> </div>
</div> {/if}
</div> </div>
{/each} {/each}
</div> </div>

View File

@ -10,6 +10,7 @@ export default {
foreground: "var(--fg)", foreground: "var(--fg)",
"foreground-muted": "var(--fg-muted)", "foreground-muted": "var(--fg-muted)",
"foreground-muted-alt": "var(--fg-muted-alt)", "foreground-muted-alt": "var(--fg-muted-alt)",
"foreground-failure": "var(--fg-failure)",
"accent-background": "var(--accent-bg)", "accent-background": "var(--accent-bg)",
"accent-foreground": "var(--accent-fg)", "accent-foreground": "var(--accent-fg)",
}, },