fix(web): better activity line, dates, icons

This commit is contained in:
əlemi 2024-04-23 03:31:42 +02:00
parent fc4840dc5d
commit 73f178462f
Signed by: alemi
GPG key ID: A4895B84D311642C
3 changed files with 13 additions and 14 deletions

View file

@ -20,13 +20,12 @@ pub fn ActivityLine(activity: serde_json::Value) -> impl IntoView {
<img src={avatar} class="avatar-inline mr-s ml-1-r" /><b>{username}</b><small>@{domain}</small> <img src={avatar} class="avatar-inline mr-s ml-1-r" /><b>{username}</b><small>@{domain}</small>
</a> </a>
<span style="float:right"> <span style="float:right">
<a class="upub-title clean" href={Uri::web(FetchKind::Object, &object_id)} ><code class="color moreinfo" title={object_id.clone()} >{kind.as_ref().to_string()}</code></a> <code class="color moreinfo" title={activity.published().map(|x| x.to_rfc2822())} >
<a class="hover ml-1 hidden-on-mobile" href={Uri::web(FetchKind::Object, &object_id)} > <a class="upub-title clean" title={object_id.clone()} href={Uri::web(FetchKind::Object, &object_id)} >
<DateTime t=activity.published() /> {kind.as_ref().to_string()}
</a> </a>
<span class="hidden-on-mobile">
<PrivacyMarker addressed=activity.addressed() /> <PrivacyMarker addressed=activity.addressed() />
</span> </code>
</span> </span>
</div> </div>
} }

View file

@ -26,7 +26,7 @@ pub fn DateTime(t: Option<chrono::DateTime<chrono::Utc>>) -> impl IntoView {
} else if delta.num_days() < 90 { } else if delta.num_days() < 90 {
format!("{}d ago", delta.num_days()) format!("{}d ago", delta.num_days())
} else { } else {
t.format("%Y/%m/%d %H:%M:%S").to_string() t.format("%d/%m/%Y").to_string()
}; };
let rfc = t.to_rfc2822(); let rfc = t.to_rfc2822();
Some(view! { Some(view! {
@ -37,7 +37,7 @@ pub fn DateTime(t: Option<chrono::DateTime<chrono::Utc>>) -> impl IntoView {
} }
} }
pub const PRIVACY_PUBLIC : &str = "💿"; pub const PRIVACY_PUBLIC : &str = "🪩";
pub const PRIVACY_FOLLOWERS : &str = "🔒"; pub const PRIVACY_FOLLOWERS : &str = "🔒";
pub const PRIVACY_PRIVATE : &str = "📨"; pub const PRIVACY_PRIVATE : &str = "📨";
@ -52,6 +52,6 @@ pub fn PrivacyMarker(addressed: Vec<String>) -> impl IntoView {
}; };
let audience = format!("[ {} ]", addressed.join(", ")); let audience = format!("[ {} ]", addressed.join(", "));
view! { view! {
<span class="emoji ml-1 moreinfo" title={audience} >{privacy}</span> <span class="emoji ml-1 mr-s moreinfo" title={audience} >{privacy}</span>
} }
} }

View file

@ -22,13 +22,13 @@ pub fn Object(object: serde_json::Value) -> impl IntoView {
<td><ActorBanner object=author /></td> <td><ActorBanner object=author /></td>
<td class="rev" > <td class="rev" >
{object.in_reply_to().id().map(|reply| view! { {object.in_reply_to().id().map(|reply| view! {
<small><i><a class="clean mr-1" href={Uri::web(FetchKind::Object, &reply)} title={reply}>reply</a></i></small> <small><i><a class="clean" href={Uri::web(FetchKind::Object, &reply)} title={reply}>reply</a></i></small>
})} })}
<a class="clean hover" href={Uri::web(FetchKind::Object, object.id().unwrap_or_default())}> <PrivacyMarker addressed=object.addressed() />
<a class="clean hover ml-s" href={Uri::web(FetchKind::Object, object.id().unwrap_or_default())}>
<DateTime t=object.published() /> <DateTime t=object.published() />
</a> </a>
<sup><small><a class="clean" href={uid} target="_blank">""</a></small></sup> <sup><small><a class="clean ml-s" href={uid} target="_blank">""</a></small></sup>
<PrivacyMarker addressed=object.addressed() />
</td> </td>
</tr> </tr>
</table> </table>