feat(web): more compact and consistent timeline

This commit is contained in:
əlemi 2024-04-17 07:19:50 +02:00
parent 9ffd5b6c4e
commit 4b0a732584
Signed by: alemi
GPG key ID: A4895B84D311642C
2 changed files with 10 additions and 8 deletions

View file

@ -82,11 +82,12 @@
border-collapse: collapse; border-collapse: collapse;
} }
table p { table p {
margin: .5em; margin: .25em 1em;
} }
tr.post-table, tr.post-table,
td.post-table { td.post-table {
border: 1px dashed #bf616a; border: 1px dashed #bf616a;
padding: .5em;
} }
td.top { td.top {
vertical-align: top; vertical-align: top;

View file

@ -321,7 +321,8 @@ pub fn ObjectPage() -> impl IntoView {
pub fn Object(object: serde_json::Value) -> impl IntoView { pub fn Object(object: serde_json::Value) -> impl IntoView {
let summary = object.summary().unwrap_or_default().to_string(); let summary = object.summary().unwrap_or_default().to_string();
let content = dissolve::strip_html_tags(object.content().unwrap_or_default()); 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_id = object.attributed_to().id().unwrap_or_default();
let author = CACHE.get(&author_id).unwrap_or(serde_json::Value::String(author_id.clone())); let author = CACHE.get(&author_id).unwrap_or(serde_json::Value::String(author_id.clone()));
view! { view! {
@ -343,7 +344,7 @@ pub fn Object(object: serde_json::Value) -> impl IntoView {
</tr> </tr>
<tr class="post-table" > <tr class="post-table" >
<td class="post-table pa-1" ><ActorBanner object=author /></td> <td class="post-table pa-1" ><ActorBanner object=author /></td>
<td class="post-table pa-1" >{date}</td> <td class="post-table pa-1 center" ><small title={date_rfc} >{date}</small></td>
</tr> </tr>
</table> </table>
</div> </div>
@ -368,8 +369,8 @@ pub fn InlineActivity(activity: serde_json::Value) -> impl IntoView {
} else { } else {
"[private]" "[private]"
}; };
let date = object.published().map(|x| x.to_rfc2822()).unwrap_or_else(|| let date = object.published().map(|x| x.format("%Y/%m/%d %H:%M:%S").to_string()).unwrap_or_else(||
activity.published().map(|x| x.to_rfc2822()).unwrap_or_default() 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); let kind = activity.activity_type().unwrap_or(apb::ActivityType::Activity);
view! { view! {
@ -380,13 +381,14 @@ pub fn InlineActivity(activity: serde_json::Value) -> impl IntoView {
<ActorBanner object=actor /> <ActorBanner object=actor />
</td> </td>
<td class="rev" > <td class="rev" >
<code class="color" >{kind.as_ref().to_string()}</code> <small><u class="moreinfo" title={audience} >{privacy}</u></small>
<code class="color ml-1 moreinfo" title={object_id.clone()} >{kind.as_ref().to_string()}</code>
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="rev"> <td class="rev">
<a class="hover" href={Uri::web("objects", &object_id)} > <a class="hover" href={Uri::web("objects", &object_id)} >
<small>{Uri::pretty(&object_id)}</small> <small>{date}</small>
</a> </a>
</td> </td>
</tr> </tr>
@ -397,7 +399,6 @@ pub fn InlineActivity(activity: serde_json::Value) -> impl IntoView {
apb::ActivityType::Create => view! { <Object object=object /> }.into_view(), apb::ActivityType::Create => view! { <Object object=object /> }.into_view(),
_ => view! {}.into_view(), _ => view! {}.into_view(),
}} }}
<small>{date}" "<u class="moreinfo" style="float: right" title={audience} >{privacy}</u></small>
} }
} }