From f76d134b805fdd0d74e058702131cdf5986e0fb1 Mon Sep 17 00:00:00 2001 From: Realmy <163438634+RealmyTheMan@users.noreply.github.com> Date: Tue, 12 Nov 2024 08:52:36 +0100 Subject: [PATCH] Warning with unsupported formats --- src/app.css | 1 + src/lib/store/index.svelte.ts | 1 + src/routes/+layout.svelte | 2 +- src/routes/+page.svelte | 1 + src/routes/convert/+page.svelte | 79 +++++++++++++++++++-------------- tailwind.config.ts | 1 + 6 files changed, 51 insertions(+), 34 deletions(-) diff --git a/src/app.css b/src/app.css index 4c409ed..6183cc4 100644 --- a/src/app.css +++ b/src/app.css @@ -17,6 +17,7 @@ --fg: hsl(0, 0%, 10%); --fg-muted: hsl(0, 0%, 50%); --fg-muted-alt: hsl(0, 0%, 75%); + --fg-failure: hsl(0, 67%, 49%); } body { diff --git a/src/lib/store/index.svelte.ts b/src/lib/store/index.svelte.ts index f8ab7c1..78487c8 100644 --- a/src/lib/store/index.svelte.ts +++ b/src/lib/store/index.svelte.ts @@ -2,6 +2,7 @@ class Files { public files = $state< { file: File; + from: string; to: string; blobUrl: string; id: string; diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index b61e4b2..8c2b523 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -5,7 +5,7 @@ import { quintOut } from "svelte/easing"; import { files } from "$lib/store/index.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 navWidth = $state(1); diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 8bfe7f2..9346e2a 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -11,6 +11,7 @@ ...files.files, ...(ourFiles || []).map((f) => ({ file: f, + from: "." + f.name.split(".").slice(-1), to: converters[0].supportedFormats[0], blobUrl: URL.createObjectURL(f), id: Math.random().toString(36).substring(2), diff --git a/src/routes/convert/+page.svelte b/src/routes/convert/+page.svelte index 3f79d18..7cab1f2 100644 --- a/src/routes/convert/+page.svelte +++ b/src/routes/convert/+page.svelte @@ -43,7 +43,7 @@ blurMultiplier: 16, }} 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], }, @@ -58,23 +58,34 @@ > {file.file.name} -
- from - .{file.file.name.split(".").slice(-1)} - to - +
+ {#if converters[0].supportedFormats.includes(file.from)} + from + {file.from} + to + + {:else} + {file.from} + + + is not supported! + + {/if}
- -
+ {#if converters[0].supportedFormats.includes(file.from)} +
-
- + class="absolute top-0 -z-50 left-0 w-full h-full rounded-[10px] overflow-hidden opacity-[0.98]" + > +
+
+ +
-
+ {/if} {/each} diff --git a/tailwind.config.ts b/tailwind.config.ts index 2a8ab4c..4baf78a 100644 --- a/tailwind.config.ts +++ b/tailwind.config.ts @@ -10,6 +10,7 @@ export default { foreground: "var(--fg)", "foreground-muted": "var(--fg-muted)", "foreground-muted-alt": "var(--fg-muted-alt)", + "foreground-failure": "var(--fg-failure)", "accent-background": "var(--accent-bg)", "accent-foreground": "var(--accent-fg)", },