Remove root page from the routes

This commit is contained in:
Jeremy Wall 2022-02-15 22:30:18 -05:00
parent 4eaf2ff36b
commit b4f04a2b04
2 changed files with 5 additions and 12 deletions

View File

@ -18,9 +18,7 @@ use sycamore::prelude::*;
pub fn header() -> View<G> { pub fn header() -> View<G> {
view! { view! {
div(class="menu") { div(class="menu") {
span { a(href="/ui/") { "Home" }} span { a(href="/ui/") { "Meal Plan" }}
" | "
span { a(href="/ui/plan/") { "Meal Plan" }}
} }
} }
} }

View File

@ -23,12 +23,10 @@ use sycamore_router::{HistoryIntegration, Route, Router, RouterProps};
#[derive(Route, Debug)] #[derive(Route, Debug)]
enum AppRoutes { enum AppRoutes {
#[to("/ui")] #[to("/ui/")]
Root, Plan,
#[to("/ui/recipe/<index>")] #[to("/ui/recipe/<index>")]
Recipe { index: usize }, Recipe { index: usize },
#[to("/ui/plan")]
Plan,
#[not_found] #[not_found]
NotFound, NotFound,
} }
@ -36,15 +34,12 @@ enum AppRoutes {
fn route_switch<G: Html>(route: ReadSignal<AppRoutes>) -> View<G> { fn route_switch<G: Html>(route: ReadSignal<AppRoutes>) -> View<G> {
view! { view! {
(match route.get().as_ref() { (match route.get().as_ref() {
AppRoutes::Root => view! { AppRoutes::Plan => view! {
Start() MealPlan()
}, },
AppRoutes::Recipe { index: idx } => view! { AppRoutes::Recipe { index: idx } => view! {
RecipeView(*idx) RecipeView(*idx)
}, },
AppRoutes::Plan => view! {
MealPlan()
},
AppRoutes::NotFound => view! { AppRoutes::NotFound => view! {
"NotFound" "NotFound"
}, },