From 4b0a7325847d0789381a144fb2ec48e183cb11cf Mon Sep 17 00:00:00 2001 From: alemi Date: Wed, 17 Apr 2024 07:19:50 +0200 Subject: [PATCH] feat(web): more compact and consistent timeline --- web/index.html | 3 ++- web/src/lib.rs | 15 ++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/web/index.html b/web/index.html index dc0e8a45..894179a1 100644 --- a/web/index.html +++ b/web/index.html @@ -82,11 +82,12 @@ border-collapse: collapse; } table p { - margin: .5em; + margin: .25em 1em; } tr.post-table, td.post-table { border: 1px dashed #bf616a; + padding: .5em; } td.top { vertical-align: top; diff --git a/web/src/lib.rs b/web/src/lib.rs index 8a1d0b86..7e2aa67a 100644 --- a/web/src/lib.rs +++ b/web/src/lib.rs @@ -321,7 +321,8 @@ pub fn ObjectPage() -> impl IntoView { pub fn Object(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 date = object.published().map(|x| x.to_rfc2822()).unwrap_or_default(); + let date = object.published().map(|x| x.format("%Y/%m/%d %H:%M:%S").to_string()).unwrap_or_default(); + let date_rfc = object.published().map(|x| x.to_rfc3339()).unwrap_or_default(); let author_id = object.attributed_to().id().unwrap_or_default(); let author = CACHE.get(&author_id).unwrap_or(serde_json::Value::String(author_id.clone())); view! { @@ -343,7 +344,7 @@ pub fn Object(object: serde_json::Value) -> impl IntoView { - {date} + {date} @@ -368,8 +369,8 @@ pub fn InlineActivity(activity: serde_json::Value) -> impl IntoView { } else { "[private]" }; - let date = object.published().map(|x| x.to_rfc2822()).unwrap_or_else(|| - activity.published().map(|x| x.to_rfc2822()).unwrap_or_default() + let date = object.published().map(|x| x.format("%Y/%m/%d %H:%M:%S").to_string()).unwrap_or_else(|| + activity.published().map(|x| x.format("%Y/%m/%d %H:%M:%S").to_string()).unwrap_or_default() ); let kind = activity.activity_type().unwrap_or(apb::ActivityType::Activity); view! { @@ -380,13 +381,14 @@ pub fn InlineActivity(activity: serde_json::Value) -> impl IntoView { - {kind.as_ref().to_string()} + {privacy} + {kind.as_ref().to_string()} - {Uri::pretty(&object_id)} + {date} @@ -397,7 +399,6 @@ pub fn InlineActivity(activity: serde_json::Value) -> impl IntoView { apb::ActivityType::Create => view! { }.into_view(), _ => view! {}.into_view(), }} - {date}" "{privacy} } }