use leptos::*; use crate::{prelude::*, URL_SENSITIVE}; 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 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 sensitive = object.sensitive().unwrap_or_default(); let attachments = object.attachment() .map(|x| { let (expand, set_expand) = create_signal(false); let href = x.url().id().unwrap_or_default(); view! {

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

{x}

}).collect_view()} {attachments_padding} {attachments}
} } #[component] pub fn Summary(summary: Option, open: bool, children: Children) -> impl IntoView { match summary.filter(|x| !x.is_empty()) { None => children().into_view(), Some(summary) => view! {
{summary} {children()}
}.into_view(), } }