From f6a3fb9c4d8dd86f78c9f75a23c1ac35bf35d4eb Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Thu, 19 Mar 2026 07:45:14 +0100 Subject: feat(treewide): Commit MVP --- src/components/unit_overview.rs | 37 ++++++++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 5 deletions(-) (limited to 'src/components/unit_overview.rs') diff --git a/src/components/unit_overview.rs b/src/components/unit_overview.rs index 25e5675..0ea3825 100644 --- a/src/components/unit_overview.rs +++ b/src/components/unit_overview.rs @@ -1,6 +1,10 @@ use leptos::{IntoView, component, view}; +use rocie_client::models::{Unit, UnitProperty}; -use crate::components::{container::Container, icon_p::IconP}; +use crate::{ + api::{unit_properties_wrapped, units_wrapped}, + components::{async_fetch::AsyncFetch, container::Container, icon_p::IconP}, +}; #[component] pub fn UnitOverview() -> impl IntoView { @@ -8,14 +12,37 @@ pub fn UnitOverview() -> impl IntoView { }, "units"), - (view! { }, "create-unit"), - (view! { }, "create-unit-property"), + (view! { }, "units"), + ( + view! { }, + "create-unit", + ), + ( + view! { }, + "create-unit-property", + ), ] > { - "You have units" + AsyncFetch! { + @map_error_in_producer + fetcher = get_units_and_unit_properties(), + producer = |(units, unit_properties)| { + view! { +

{move || format!( + "You have {} units and {} unit properties.", + units.len(), + unit_properties.len() + )}

+ } + }, + } }
} } + +async fn get_units_and_unit_properties() +-> Result<(Vec, Vec), leptos::error::Error> { + Ok((units_wrapped().await?, unit_properties_wrapped().await?)) +} -- cgit 1.4.1