diff --git a/web/src/pages/manage/mod.rs b/web/src/pages/manage/mod.rs index 47c0ab3..c0c31ff 100644 --- a/web/src/pages/manage/mod.rs +++ b/web/src/pages/manage/mod.rs @@ -16,6 +16,11 @@ use sycamore::prelude::*; pub mod add_recipe; pub mod categories; +pub mod staples; + +pub use add_recipe::*; +pub use categories::*; +pub use staples::*; #[derive(Props)] pub struct PageState<'a, G: Html> { @@ -29,6 +34,7 @@ pub fn ManagePage<'a, G: Html>(cx: Scope<'a>, state: PageState<'a, G>) -> View = vec![ ("/ui/manage/categories".to_owned(), "Categories"), + ("/ui/manage/staples".to_owned(), "Staples"), ("/ui/manage/new_recipe".to_owned(), "New Recipe"), ]; diff --git a/web/src/pages/manage/staples.rs b/web/src/pages/manage/staples.rs new file mode 100644 index 0000000..59361bf --- /dev/null +++ b/web/src/pages/manage/staples.rs @@ -0,0 +1,28 @@ +// Copyright 2022 Jeremy Wall (Jeremy@marzhilsltudios.com) +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +use super::ManagePage; +use crate::components::recipe::Editor; + +use sycamore::prelude::*; +use tracing::instrument; + +#[instrument] +#[component()] +pub fn StaplesPage(cx: Scope) -> View { + view! {cx, + ManagePage( + selected=Some("Staples".to_owned()), + ) { Editor("staples.txt".to_owned()) } + } +} diff --git a/web/src/pages/mod.rs b/web/src/pages/mod.rs index 0f7f45c..c7d6448 100644 --- a/web/src/pages/mod.rs +++ b/web/src/pages/mod.rs @@ -17,9 +17,6 @@ mod planning; mod recipe; pub use login::*; -pub use manage::add_recipe::*; -pub use manage::categories::*; -pub use planning::cook::*; -pub use planning::inventory::*; -pub use planning::plan::*; +pub use manage::*; +pub use planning::*; pub use recipe::*; diff --git a/web/src/pages/planning/mod.rs b/web/src/pages/planning/mod.rs index 927659f..682e4a2 100644 --- a/web/src/pages/planning/mod.rs +++ b/web/src/pages/planning/mod.rs @@ -18,6 +18,10 @@ pub mod cook; pub mod inventory; pub mod plan; +pub use cook::*; +pub use inventory::*; +pub use plan::*; + #[derive(Props)] pub struct PageState<'a, G: Html> { pub children: Children<'a, G>, diff --git a/web/src/pages/recipe/edit.rs b/web/src/pages/recipe/edit.rs index 841dc35..9e29ae1 100644 --- a/web/src/pages/recipe/edit.rs +++ b/web/src/pages/recipe/edit.rs @@ -11,13 +11,12 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +use super::{RecipePage, RecipePageProps}; use crate::components::recipe::Editor; use sycamore::prelude::*; use tracing::instrument; -use super::{RecipePage, RecipePageProps}; - #[instrument] #[component()] pub fn RecipeEditPage(cx: Scope, props: RecipePageProps) -> View { diff --git a/web/src/routing/mod.rs b/web/src/routing/mod.rs index 287a8f4..8e87c20 100644 --- a/web/src/routing/mod.rs +++ b/web/src/routing/mod.rs @@ -51,6 +51,9 @@ fn route_switch<'a, G: Html>(cx: Scope<'a>, route: &'a ReadSignal) -> Vi Routes::Manage(ManageRoutes::NewRecipe) => view! {cx, AddRecipePage() }, + Routes::Manage(ManageRoutes::Staples) => view! {cx, + StaplesPage() + }, Routes::NotFound | Routes::Manage(ManageRoutes::NotFound) | Routes::Planning(PlanningRoutes::NotFound) @@ -96,6 +99,8 @@ pub enum ManageRoutes { NewRecipe, #[to("/categories")] Categories, + #[to("/staples")] + Staples, #[not_found] NotFound, }