From 0d9132a1f4d398b9cbb8c3b5160a90658bc3815a Mon Sep 17 00:00:00 2001 From: Nulo Date: Fri, 8 Dec 2023 19:22:39 -0300 Subject: [PATCH] =?UTF-8?q?frontend:=20mejorar=20navegaci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/App.svelte | 8 ++-- frontend/src/lib/nav/Nav.svelte | 55 ++++++++++++++++++++++++++ frontend/src/lib/router.ts | 4 +- frontend/src/lib/routes/Dataset.svelte | 14 +++++-- frontend/src/lib/routes/Dump.svelte | 7 ++-- frontend/src/lib/routes/Portal.svelte | 12 ++++-- 6 files changed, 84 insertions(+), 16 deletions(-) create mode 100644 frontend/src/lib/nav/Nav.svelte diff --git a/frontend/src/App.svelte b/frontend/src/App.svelte index 1edf305..8be0f0d 100644 --- a/frontend/src/App.svelte +++ b/frontend/src/App.svelte @@ -15,8 +15,10 @@ else if (route === "Dump") return Dump; } - $: component = chooseComponent($currentRoute.component) as any; - $: params = $currentRoute.params as any; + $: r = { + component: chooseComponent($currentRoute.component) as any, + params: $currentRoute.params as any, + }; - + diff --git a/frontend/src/lib/nav/Nav.svelte b/frontend/src/lib/nav/Nav.svelte new file mode 100644 index 0000000..d11b345 --- /dev/null +++ b/frontend/src/lib/nav/Nav.svelte @@ -0,0 +1,55 @@ + + + diff --git a/frontend/src/lib/router.ts b/frontend/src/lib/router.ts index 92af540..1f7db14 100644 --- a/frontend/src/lib/router.ts +++ b/frontend/src/lib/router.ts @@ -4,8 +4,8 @@ import { writable } from "svelte/store"; export const routes = { Home: "/", Dump: "/dump/:dumpUrl", - Portal: "/portal/:portalUrl", - Dataset: "/portal/:portalUrl/dataset/:id", + Portal: "/dump/:dumpUrl/:portal", + Dataset: "/dump/:dumpUrl/:portal/dataset/:id", }; export type ComponentType = "NotFound" | keyof typeof routes; diff --git a/frontend/src/lib/routes/Dataset.svelte b/frontend/src/lib/routes/Dataset.svelte index bf1716d..cc70129 100644 --- a/frontend/src/lib/routes/Dataset.svelte +++ b/frontend/src/lib/routes/Dataset.svelte @@ -5,16 +5,19 @@ import NotFound from "./NotFound.svelte"; import { inject } from "regexparam"; import { routes } from "../router"; + import Nav from "../nav/Nav.svelte"; - export let params: { portalUrl: string; id: string }; - const url = decodeURIComponent(params.portalUrl); + export let params: { dumpUrl: string; portal: string; id: string }; + $: url = decodeURIComponent(params.dumpUrl) + "/" + params.portal; - const data = Promise.all([fetchData(url), fetchErrors(url)]).then( + $: data = Promise.all([fetchData(url), fetchErrors(url)]).then( ([data, errors]) => ({ data, errors }), );
+