app: Add a UI to create recipes

This commit is contained in:
traxys 2023-06-22 22:33:38 +02:00
parent 58cadd37d2
commit cec3ef214e
6 changed files with 564 additions and 2 deletions

View file

@ -19,8 +19,9 @@ use crate::{
};
mod bootstrap;
mod sidebar;
mod ingredients;
mod recipe_creator;
mod sidebar;
const API_ROUTE: &str = match option_env!("REGALADE_API_SERVER_BASE") {
None => "http://localhost:8085",
@ -45,6 +46,10 @@ enum Route {
Ingredients,
#[at("/household_select")]
HouseholdSelect,
#[at("/new_recipe")]
NewRecipe,
#[at("/recipe/:id")]
Recipe { id: i64 },
#[at("/404")]
#[not_found]
NotFound,
@ -468,6 +473,16 @@ fn switch(route: Route) -> Html {
Route::HouseholdSelect => html! {
<HouseholdSelection />
},
Route::NewRecipe => html! {
<GlobalStateRedirector {route}>
<recipe_creator::RecipeCreator />
</GlobalStateRedirector>
},
Route::Recipe { id } => html! {
<GlobalStateRedirector {route}>
{format!("RECIPE {id}")}
</GlobalStateRedirector>
},
Route::NotFound => html! {
"Page not found"
},