use leptos::*; use crate::prelude::*; use apb::{target::Addressed, Base, Object}; #[component] pub fn Object(object: serde_json::Value) -> impl IntoView { let uid = object.id().unwrap_or_default().to_string(); let summary = object.summary().unwrap_or_default().to_string(); let content = dissolve::strip_html_tags(object.content().unwrap_or_default()); let author_id = object.attributed_to().id().unwrap_or_default(); let author = CACHE.get_or(&author_id, serde_json::Value::String(author_id.clone())); let attachments = object.attachment() .map(|x| view! {

}) .collect_view(); view! {
{object.in_reply_to().id().map(|reply| view! { reply })} "↗"
{if summary.is_empty() { None } else { Some(view! { {summary} })}} {content.into_iter().map(|x| view! {

{x}

}).collect_view()}
{attachments} } }