feat(web): better post view on timeline

i really need to refactor this is getting out of hand
This commit is contained in:
əlemi 2024-04-17 07:29:56 +02:00
parent 4b0a732584
commit 64bbb20659
Signed by: alemi
GPG key ID: A4895B84D311642C
2 changed files with 18 additions and 1 deletions

View file

@ -36,6 +36,11 @@
padding-bottom: 0; padding-bottom: 0;
line-height: 1rem; line-height: 1rem;
} }
blockquote {
margin-left: 1.25em;
margin-top: 0;
margin-bottom: 0;
}
span.footer { span.footer {
padding: .1em; padding: .1em;
font-size: .6em; font-size: .6em;

View file

@ -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! { <code class="color">{summary}</code> })}}
<blockquote>
{content.into_iter().map(|x| view! { <p>{x}</p> }).collect_view()}
</blockquote>
}
}
#[component] #[component]
pub fn InlineActivity(activity: serde_json::Value) -> impl IntoView { pub fn InlineActivity(activity: serde_json::Value) -> impl IntoView {
let object_id = activity.object().id().unwrap_or_default(); let object_id = activity.object().id().unwrap_or_default();
@ -396,7 +408,7 @@ pub fn InlineActivity(activity: serde_json::Value) -> impl IntoView {
</div> </div>
{match kind { {match kind {
// post // post
apb::ActivityType::Create => view! { <Object object=object /> }.into_view(), apb::ActivityType::Create => view! { <ObjectInline object=object /> }.into_view(),
_ => view! {}.into_view(), _ => view! {}.into_view(),
}} }}
} }