loading...
}.into_view(),
Some(x) => view! {
{x.actor_type().unwrap_or(apb::ActorType::Person).as_ref().to_string()}
{x.summary().unwrap_or("").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(),
}}
}
}
#[component]
pub fn Activity(activity: serde_json::Value) -> impl IntoView {
let object = activity.clone().object().extract().unwrap_or_else(||
serde_json::Value::String(activity.object().id().unwrap_or_default())
);
let object_id = object.id().unwrap_or_default().to_string();
let content = dissolve::strip_html_tags(object.content().unwrap_or_default());
let addressed = activity.addressed();
let audience = format!("[ {} ]", addressed.join(", "));
let privacy = if addressed.iter().any(|x| x == apb::target::PUBLIC) {
"[public]"
} else if addressed.iter().any(|x| x.ends_with("/followers")) {
"[followers]"
} else {
"[private]"
};
let title = object.summary().unwrap_or_default().to_string();
let date = object.published().map(|x| x.to_rfc3339()).unwrap_or_default();
let kind = activity.activity_type().unwrap_or(apb::ActivityType::Activity);
view! {
{match kind {
// post
apb::ActivityType::Create => view! {