From 64bbb20659e2cb2ca1d84f819299a3c9b6bcb8f5 Mon Sep 17 00:00:00 2001 From: alemi Date: Wed, 17 Apr 2024 07:29:56 +0200 Subject: [PATCH] feat(web): better post view on timeline i really need to refactor this is getting out of hand --- web/index.html | 5 +++++ web/src/lib.rs | 14 +++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/web/index.html b/web/index.html index 894179a..8406bb9 100644 --- a/web/index.html +++ b/web/index.html @@ -36,6 +36,11 @@ padding-bottom: 0; line-height: 1rem; } + blockquote { + margin-left: 1.25em; + margin-top: 0; + margin-bottom: 0; + } span.footer { padding: .1em; font-size: .6em; diff --git a/web/src/lib.rs b/web/src/lib.rs index 7e2aa67..c51a675 100644 --- a/web/src/lib.rs +++ b/web/src/lib.rs @@ -351,6 +351,18 @@ pub fn Object(object: serde_json::Value) -> impl IntoView { } } +#[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()); + view! { + {if summary.is_empty() { None } else { Some(view! { {summary} })}} +
+ {content.into_iter().map(|x| view! {

{x}

}).collect_view()} +
+ } +} + #[component] pub fn InlineActivity(activity: serde_json::Value) -> impl IntoView { let object_id = activity.object().id().unwrap_or_default(); @@ -396,7 +408,7 @@ pub fn InlineActivity(activity: serde_json::Value) -> impl IntoView { {match kind { // post - apb::ActivityType::Create => view! { }.into_view(), + apb::ActivityType::Create => view! { }.into_view(), _ => view! {}.into_view(), }} }