mirror of
https://github.com/zaphar/kitchen.git
synced 2025-07-22 19:40:14 -04:00
parent
23bdcfe271
commit
85c8a14bb5
@ -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<G
|
||||
let children = children.call(cx);
|
||||
let manage_tabs: Vec<(String, &'static str)> = vec![
|
||||
("/ui/manage/categories".to_owned(), "Categories"),
|
||||
("/ui/manage/staples".to_owned(), "Staples"),
|
||||
("/ui/manage/new_recipe".to_owned(), "New Recipe"),
|
||||
];
|
||||
|
||||
|
28
web/src/pages/manage/staples.rs
Normal file
28
web/src/pages/manage/staples.rs
Normal file
@ -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<G: Html>(cx: Scope) -> View<G> {
|
||||
view! {cx,
|
||||
ManagePage(
|
||||
selected=Some("Staples".to_owned()),
|
||||
) { Editor("staples.txt".to_owned()) }
|
||||
}
|
||||
}
|
@ -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::*;
|
||||
|
@ -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>,
|
||||
|
@ -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<G: Html>(cx: Scope, props: RecipePageProps) -> View<G> {
|
||||
|
@ -51,6 +51,9 @@ fn route_switch<'a, G: Html>(cx: Scope<'a>, route: &'a ReadSignal<Routes>) -> 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,
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user