diff --git a/.gitignore b/.gitignore index 0aa607f..1656971 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ .DS_Store node_modules /build +/vendored /.svelte-kit /package .env diff --git a/package.json b/package.json index e84311e..05c34c0 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ "scripts": { "dev": "vite dev", "build": "vite build", + "vendor": "VENDORED=true vite build", "preview": "vite preview", "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", diff --git a/src/lib/components/ContentContainer.svelte b/src/lib/components/ContentContainer.svelte index b987645..653625f 100644 --- a/src/lib/components/ContentContainer.svelte +++ b/src/lib/components/ContentContainer.svelte @@ -16,28 +16,32 @@ import Error from "$lib/components/Error.svelte"; import Loading from "$lib/components/Loading.svelte"; + export let vendored: boolean = false; + let loadingComponent: undefined | HTMLElement;
-
-

- This interface can view .qza and .qzv files directly in your browser - without uploading to a server. - - history.pushState({}, "", "/about/" + window.location.search)} - >Click here to learn more. - -

- - - -
+ {#if !vendored} +
+

+ This interface can view .qza and .qzv files directly in your browser + without uploading to a server. + + history.pushState({}, "", "/about/" + window.location.search)} + >Click here to learn more. + +

+ + + +
+ {/if}
1) { alert("Please only provide a single file."); } else { + console.log(files[0]); readerModel.readData(files[0]); } } diff --git a/src/routes/(main)/+layout.svelte b/src/lib/components/Main.svelte similarity index 100% rename from src/routes/(main)/+layout.svelte rename to src/lib/components/Main.svelte diff --git a/src/lib/components/NavBar.svelte b/src/lib/components/NavBar.svelte index df21808..90494db 100644 --- a/src/lib/components/NavBar.svelte +++ b/src/lib/components/NavBar.svelte @@ -12,6 +12,8 @@ import { createCollapsible, createDropdownMenu, melt } from "@melt-ui/svelte"; import { slide, fly } from "svelte/transition"; + export let vendored: boolean = false; + onMount(() => { const nav_dropdown = document.getElementById("nav-dropdown") as Element; observer.observe(nav_dropdown); @@ -49,18 +51,22 @@ } function navLogoClicked() { + // It's easiest to just calculate this here. If we do it at the top of the + // page then we will likely do it before index path is set. + let logoTarget = vendored ? ($readerModel.indexPath ? "/visualization/" : "/details/") : "/"; + if ($loading.status === "LOADING") { // If we are in the loading state go back to root and reload to force the // loading to stop - history.pushState({}, "", "/"); + history.pushState({}, "", logoTarget); location.reload(); } else if ($url.pathname.replaceAll("/", "") === "error") { // If we are navigating away from the error page then we want to clean out // the errored state and push clean state readerModel.clear(); - history.pushState({}, "", "/"); + history.pushState({}, "", logoTarget); } else { - history.pushState({}, "", "/" + window.location.search); + history.pushState({}, "", logoTarget + window.location.search); } } @@ -75,7 +81,7 @@
  • File: {$readerModel.name}
  • - {#if $readerModel.indexPath || $readerModel.rawSrc} + {#if !vendored && ($readerModel.indexPath || $readerModel.rawSrc)}