summary refs log tree commit diff stats
path: root/src/components/recipies.rs
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-03-19 07:45:14 +0100
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-03-19 07:45:14 +0100
commitf6a3fb9c4d8dd86f78c9f75a23c1ac35bf35d4eb (patch)
tree5f28fbca03d83921b568f7cb1708374456d9ec42 /src/components/recipies.rs
parentfeat(treewide): Add further buttons (diff)
downloadweb-client-f6a3fb9c4d8dd86f78c9f75a23c1ac35bf35d4eb.zip
feat(treewide): Commit MVP
Diffstat (limited to 'src/components/recipies.rs')
-rw-r--r--src/components/recipies.rs20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/components/recipies.rs b/src/components/recipies.rs
index f7903e4..755954e 100644
--- a/src/components/recipies.rs
+++ b/src/components/recipies.rs
@@ -1,6 +1,9 @@
-use leptos::{IntoView, component, prelude::ElementChild, view};
+use leptos::{IntoView, component, view};
 
-use crate::components::{container::Container, icon_p::IconP};
+use crate::{
+    api::recipes_wrapped,
+    components::{async_fetch::AsyncFetch, container::Container, icon_p::IconP},
+};
 
 #[component]
 pub fn Recipies() -> impl IntoView {
@@ -9,10 +12,21 @@ pub fn Recipies() -> impl IntoView {
             header="Recipies"
             buttons=vec![
                 (view! { <IconP icon=icondata_io::IoFastFood text="Recipies" /> }, "recipies"),
+                (view! { <IconP icon=icondata_io::IoPin text="Create recipe" /> }, "create-recipe"),
                 (view! { <IconP icon=icondata_io::IoCalendarSharp text="Mealplan" /> }, "mealplan"),
             ]
         >
-            <p>"You have 0 recipies."</p>
+            {
+                AsyncFetch! {
+                    @map_error_in_producer
+                    fetcher = recipes_wrapped(),
+                    producer = |recipes| {
+                        view! {
+                            <p>{format!("You have {} recipies.", recipes.len())}</p>
+                        }
+                    }
+                }
+            }
         </Container>
     }
 }