Its no longer categories, its ingredients mgmt

This commit is contained in:
Jeremy Wall 2023-01-06 00:32:57 -05:00
parent 0404ba59f4
commit d8fa4f2269
4 changed files with 13 additions and 7 deletions

View File

@ -27,7 +27,7 @@ pub fn Header<'ctx, G: Html>(cx: Scope<'ctx>, h: StateHandler<'ctx>) -> View<G>
h1(class="title") { "Kitchen" }
ul {
li { a(href="/ui/planning/plan") { "MealPlan" } }
li { a(href="/ui/manage/categories") { "Manage" } }
li { a(href="/ui/manage/ingredients") { "Manage" } }
li { a(href="/ui/login") { (login.get()) } }
}
}

View File

@ -17,10 +17,10 @@ use crate::{app_state::StateHandler, components::categories::*};
use sycamore::prelude::*;
#[component()]
pub fn CategoryPage<'ctx, G: Html>(cx: Scope<'ctx>, sh: StateHandler<'ctx>) -> View<G> {
pub fn IngredientsPage<'ctx, G: Html>(cx: Scope<'ctx>, sh: StateHandler<'ctx>) -> View<G> {
view! {cx,
ManagePage(
selected=Some("Categories".to_owned()),
selected=Some("Ingredients".to_owned()),
) { Categories(sh) }
}
}

View File

@ -15,11 +15,11 @@ use crate::components::tabs::*;
use sycamore::prelude::*;
pub mod add_recipe;
pub mod categories;
pub mod ingredients;
pub mod staples;
pub use add_recipe::*;
pub use categories::*;
pub use ingredients::*;
pub use staples::*;
#[derive(Props)]
@ -33,7 +33,7 @@ pub fn ManagePage<'a, G: Html>(cx: Scope<'a>, state: PageState<'a, G>) -> View<G
let PageState { children, selected } = state;
let children = children.call(cx);
let manage_tabs: Vec<(String, &'static str)> = vec![
("/ui/manage/categories".to_owned(), "Categories"),
("/ui/manage/ingredients".to_owned(), "Ingredients"),
("/ui/manage/staples".to_owned(), "Staples"),
("/ui/manage/new_recipe".to_owned(), "New Recipe"),
];

View File

@ -49,8 +49,11 @@ pub enum RecipeRoutes {
pub enum ManageRoutes {
#[to("/new_recipe")]
NewRecipe,
// TODO(jwall): This route is now deprecated. Remove when safe to do so.
#[to("/categories")]
Categories,
#[to("/ingredients")]
Ingredients,
#[to("/staples")]
Staples,
#[not_found]
@ -99,7 +102,10 @@ fn route_switch<'ctx, G: Html>(route: &Routes, cx: Scope<'ctx>, sh: StateHandler
RecipeEditPage(recipe=id.clone(), sh=sh)
},
Routes::Manage(Categories) => view! {cx,
CategoryPage(sh)
IngredientsPage(sh)
},
Routes::Manage(Ingredients) => view! {cx,
IngredientsPage(sh)
},
Routes::Manage(NewRecipe) => view! {cx,
AddRecipePage(sh)