- {move || {
- let uid = uid.clone();
- match actor.get() {
- None => view! {
loading...
}.into_view(),
- Some(None) => {
- view! {
loading failed
"↗"
}.into_view()
- },
- Some(Some(object)) => {
- let uid = object.id().unwrap_or_default().to_string();
- let avatar_url = object.icon().get().map(|x| x.url().id().unwrap_or(DEFAULT_AVATAR_URL.into())).unwrap_or(DEFAULT_AVATAR_URL.into());
- let background_url = object.image().get().map(|x| x.url().id().unwrap_or(DEFAULT_AVATAR_URL.into())).unwrap_or(DEFAULT_AVATAR_URL.into());
- let display_name = object.name().unwrap_or_default().to_string();
- let username = object.preferred_username().unwrap_or_default().to_string();
- let summary = object.summary().unwrap_or_default().to_string();
- let domain = object.id().unwrap_or_default().replace("https://", "").split('/').next().unwrap_or_default().to_string();
- let actor_type = object.actor_type().unwrap_or(apb::ActorType::Person);
- let actor_type_tag = if actor_type == apb::ActorType::Person { None } else {
- Some(view! {
"["{actor_type.as_ref().to_lowercase()}"]" } )
- };
- let created = object.published();
- let following = object.following_count().unwrap_or(0);
- let followers = object.followers_count().unwrap_or(0);
- let statuses = object.statuses_count().unwrap_or(0);
- let tl_url = format!("{}/outbox/page", Uri::api(FetchKind::User, &id.clone(), false));
- if !tl.next.get().starts_with(&tl_url) {
- tl.reset(tl_url);
- }
- let following_me = object.following_me().unwrap_or(false);
- let followed_by_me = object.followed_by_me().unwrap_or(false);
- let _uid = uid.clone();
-
- view! {
-
-
-
// TODO bad way to have it fixed height ewwww
-
-
-
-
-
-
- |
-
- {display_name}{actor_type_tag}
- |
- {statuses}" ""\u{1f582}" |
-
-
-
-
- {username.clone()}@{domain}
- |
- {following}" ""👥" |
-
-
-
-
- |
- {followers}" ""📢" |
-
-
-
- {if followed_by_me {
- view! { following
}.into_view()
- } else {
- view! { }.into_view()
- }}
- {if following_me {
- Some(view! { follows you
})
- } else {
- None
- }}
-
-
-
-
-
- }.into_view()
- },
- }
- }}
-