diff --git a/web/src/lib.rs b/web/src/lib.rs index 11c655be..5e20ae15 100644 --- a/web/src/lib.rs +++ b/web/src/lib.rs @@ -213,31 +213,37 @@ pub fn UserPage() -> impl IntoView { } }); view! { -
view::user
- {move || match actor.get() { - None => view! {

loading...

}.into_view(), - Some(None) => view! {

error loading

}.into_view(), - Some(Some(x)) => view! { -
- -

- {x.summary().unwrap_or("").to_string()} -

- -
- }.into_view(), - }} +
+
view::user
+
+ {move || match actor.get() { + None => view! {

loading...

}.into_view(), + Some(None) => view! {

error loading

}.into_view(), + Some(Some(x)) => view! { +
+ +

+ {x.summary().unwrap_or("").to_string()} +

+
    +
  • type" "{x.actor_type().unwrap_or(apb::ActorType::Person).as_ref().to_string()}
  • +
  • following" "{x.following().get().map(|x| x.total_items().unwrap_or(0))}
  • +
  • followers" "{x.followers().get().map(|x| x.total_items().unwrap_or(0))}
  • +
  • created" "{x.published().map(|x| x.to_rfc3339())}
  • +
+
+
+ + }.into_view(), + }} +
+
} } @@ -258,13 +264,15 @@ pub fn ObjectPage() -> impl IntoView { } }); view! { -
view::object
-
- {move || match object.get() { - Some(Some(o)) => view!{ }.into_view(), - Some(None) => view! {

loading failed

}.into_view(), - None => view! {

loading ...

}.into_view(), - }} +
+
view::object
+
+ {move || match object.get() { + Some(Some(o)) => view!{ }.into_view(), + Some(None) => view! {

loading failed

}.into_view(), + None => view! {

loading ...

}.into_view(), + }} + } } @@ -365,43 +373,50 @@ pub fn About() -> impl IntoView { struct OmgReqwestErrorIsNotClonable(String); #[component] -pub fn TimelineFeed(name: &'static str, tl: Timeline) -> impl IntoView { - let auth = use_context::>>().expect("missing auth context"); +pub fn TimelinePage(name: &'static str, tl: Timeline) -> impl IntoView { view! {
{name}
- { - view! { -
- -
-
- }.into_view() - }, - None => view! { -

{id}" "[go]

- }.into_view(), - } - } - / > -
- -
+
} } + +#[component] +pub fn TimelineFeed(tl: Timeline) -> impl IntoView { + let auth = use_context::>>().expect("missing auth context"); + view! { + { + view! { +
+ +
+
+ }.into_view() + }, + None => view! { +

{id}" "[go]

+ }.into_view(), + } + } + / > +
+ +
+ } +} diff --git a/web/src/main.rs b/web/src/main.rs index 3ee79a2f..d55d9f97 100644 --- a/web/src/main.rs +++ b/web/src/main.rs @@ -4,7 +4,7 @@ use leptos_router::*; use leptos_use::{use_cookie, utils::JsonCodec}; use upub_web::{ URL_BASE, context::Timeline, About, Auth, LoginBox, MaybeToken, ObjectPage, PostBox, - TimelineFeed, TimelineNavigation, UserPage + TimelinePage, TimelineNavigation, UserPage }; fn main() { @@ -72,8 +72,8 @@ fn main() { - } /> - } /> + } /> + } />