([]);
- public conversionTypesReverse = $derived(this.conversionTypes.reverse());
public beenToConverterPage = $state(false);
public shouldShowAlert = $derived(
!this.beenToConverterPage && this.files.length > 0,
diff --git a/src/lib/workers/magick.ts b/src/lib/workers/magick.ts
index 9fb783c..2d568e0 100644
--- a/src/lib/workers/magick.ts
+++ b/src/lib/workers/magick.ts
@@ -6,8 +6,6 @@ import {
} from "@imagemagick/magick-wasm";
import wasmUrl from "@imagemagick/magick-wasm/magick.wasm?url";
-console.log(wasmUrl);
-
const magickPromise = fetch(wasmUrl)
.then((r) => r.arrayBuffer())
.then((r) => initializeImageMagick(r));
diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte
index 32ffd0b..dc85a70 100644
--- a/src/routes/+layout.svelte
+++ b/src/routes/+layout.svelte
@@ -5,28 +5,40 @@
import { quintOut } from "svelte/easing";
import { files } from "$lib/store/index.svelte";
import Logo from "$lib/components/visual/svg/Logo.svelte";
- import { fly } from "svelte/transition";
import featuredImage from "$lib/assets/VERT_Feature.webp";
import { PUB_HOSTNAME, PUB_PLAUSIBLE_URL } from "$env/static/public";
+ import FancyMenu from "$lib/components/functional/FancyMenu.svelte";
+ import { writable } from "svelte/store";
let { children, data } = $props();
- let navWidth = $state(1);
- let shouldGoBack = $state(false);
+ let shouldGoBack = writable(false);
- const links = $derived<{
- [key: string]: string;
- }>({
- Upload: "/",
- [files.files.length > 0
- ? `Convert (${files.files.length})`
- : `Convert`]: "/convert",
- About: "/about",
- });
-
- const linkCount = $derived(Object.keys(links).length);
- const linkIndex = $derived(
- Object.keys(links).findIndex((link) => links[link] === data.pathname),
- );
+ const links = $derived<
+ {
+ name: string;
+ url: string;
+ activeMatch: (pathname: string) => boolean;
+ }[]
+ >([
+ {
+ name: "Upload",
+ url: "/",
+ activeMatch: (pathname) => pathname === "/",
+ },
+ {
+ name:
+ files.files.length > 0
+ ? `Convert (${files.files.length})`
+ : `Convert`,
+ url: "/convert",
+ activeMatch: (pathname) => pathname === "/convert",
+ },
+ {
+ name: "About",
+ url: "/about",
+ activeMatch: (pathname) => pathname.startsWith("/about"),
+ },
+ ]);
const maybeNavToHome = (e: DragEvent) => {
if (e.dataTransfer?.types.includes("Files")) {
@@ -78,54 +90,7 @@
-
+
{#key data.pathname}
@@ -137,7 +102,7 @@
easing: quintOut,
blurMultiplier: 12,
x: {
- start: !shouldGoBack ? 250 : -250,
+ start: !$shouldGoBack ? 250 : -250,
end: 0,
},
scale: {
@@ -151,7 +116,7 @@
blurMultiplier: 12,
x: {
start: 0,
- end: !shouldGoBack ? -250 : 250,
+ end: !$shouldGoBack ? -250 : 250,
},
scale: {
start: 1,
diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte
index 14297d5..cfce393 100644
--- a/src/routes/+page.svelte
+++ b/src/routes/+page.svelte
@@ -12,13 +12,22 @@
const runUpload = () => {
files.files = [
...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),
- })),
+ ...(ourFiles || []).map((f, i) => {
+ const from = "." + f.name.toLowerCase().split(".").slice(-1);
+ const converter = converters.find((c) =>
+ c.supportedFormats.includes(from),
+ );
+ const to =
+ converter?.supportedFormats.find((f) => f !== from) ||
+ converters[0].supportedFormats[0];
+ return {
+ file: f,
+ from,
+ to,
+ blobUrl: URL.createObjectURL(f),
+ id: Math.random().toString(36).substring(2),
+ };
+ }),
];
ourFiles = [];
diff --git a/src/routes/convert/+page.svelte b/src/routes/convert/+page.svelte
index 81f17f4..29fd5e4 100644
--- a/src/routes/convert/+page.svelte
+++ b/src/routes/convert/+page.svelte
@@ -1,15 +1,17 @@