diff --git a/web/src/components/tabs.rs b/web/src/components/tabs.rs index 157174f..336aaf9 100644 --- a/web/src/components/tabs.rs +++ b/web/src/components/tabs.rs @@ -24,11 +24,11 @@ pub fn tabbed_view(state: TabState) -> View { header(class="no-print") { nav { ul { - li { a(href="#plan", class="no-print") { "Plan" } " > " + li { a(href="/ui/plan", class="no-print") { "Plan" } " > " } - li { a(href="#inventory", class="no-print") { "Inventory" } " > " + li { a(href="/ui/inventory", class="no-print") { "Inventory" } " > " } - li { a(href="#cook", class="no-print") { "Cook" } + li { a(href="/ui/cook", class="no-print") { "Cook" } } } ul { diff --git a/web/src/router_integration.rs b/web/src/router_integration.rs index 56dc14d..7063d4f 100644 --- a/web/src/router_integration.rs +++ b/web/src/router_integration.rs @@ -15,7 +15,7 @@ use std::fmt::Debug; use std::rc::Rc; use sycamore::prelude::*; -use tracing::{debug, error, instrument}; +use tracing::{debug, error, info, instrument}; use wasm_bindgen::prelude::*; use wasm_bindgen::JsCast; use web_sys::Event; @@ -190,11 +190,12 @@ impl DeriveRoute for AppRoutes { #[instrument] fn from(input: &(String, String, String)) -> AppRoutes { debug!(origin=%input.0, path=%input.1, hash=%input.2, "routing"); - match input.2.as_str() { + let (_origin, path, _hash) = input; + let route = match path.as_str() { "" => AppRoutes::default(), - "#plan" => AppRoutes::Plan, - "#cook" => AppRoutes::Cook, - "#inventory" => AppRoutes::Inventory, + "/ui/plan" | "/" => AppRoutes::Plan, + "/ui/ook" => AppRoutes::Cook, + "/ui/inventory" => AppRoutes::Inventory, h => { // TODO(jwall): Parse the recipe hash let parts: Vec<&str> = h.splitn(2, "/").collect(); @@ -206,6 +207,8 @@ impl DeriveRoute for AppRoutes { error!(origin=%input.0, path=%input.1, hash=%input.2, "Path not found"); AppRoutes::NotFound } - } + }; + info!(route=?route, "Route identified"); + route } }