1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
use leptos::{IntoView, component, view};
use crate::{
api::products_registered_wrapped,
components::{async_fetch::AsyncFetch, container::Container, icon_p::IconP},
};
#[component]
pub fn ProductOverview() -> impl IntoView {
view! {
<Container
header="Products"
buttons=vec![
(view! { <IconP icon=icondata_io::IoClipboard text="Show" /> }, "products"),
(
view! { <IconP icon=icondata_io::IoPricetags text="Create product" /> },
"create-product",
),
(
view! {
<IconP
icon=icondata_io::IoPricetags
text="Associate barcode with product"
/>
},
"associate-barcode-product",
),
]
>
{
AsyncFetch! {
@map_error_in_producer
fetcher = products_registered_wrapped(),
producer = |products| {
view! {
<p>{format!("You have {} products.", products.len())}</p>
}
}
}
}
</Container>
}
}
|