use leptos::*; use crate::prelude::*; use apb::{target::Addressed, Base, Object}; #[component] pub fn Object(object: serde_json::Value) -> impl IntoView { let oid = object.id().unwrap_or_default().to_string(); let in_reply_to = object.in_reply_to().id().unwrap_or_default(); 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())); view! {
{move || if !in_reply_to.is_empty() { Some(view! { }) } else { None }} {move || if !summary.is_empty() { Some(view! { }) } else { None }}
"in reply to "{Uri::pretty(&in_reply_to)}
{summary.clone()}
{ content.into_iter().map(|x| view! {

{x}

}).collect_view() }
} } #[component] pub fn ObjectInline(object: serde_json::Value) -> impl IntoView { 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())); view! {
{if summary.is_empty() { None } else { Some(view! { {summary} })}} {content.into_iter().map(|x| view! {

{x}

}).collect_view()}
} }