2024-05-13 19:13:40 +02:00
|
|
|
mod login;
|
|
|
|
pub use login::*;
|
|
|
|
|
2024-04-21 17:43:36 +02:00
|
|
|
mod activity;
|
2024-05-01 16:46:36 +02:00
|
|
|
pub use activity::*;
|
2024-04-21 17:43:36 +02:00
|
|
|
|
2024-05-13 19:13:40 +02:00
|
|
|
mod navigation;
|
|
|
|
pub use navigation::*;
|
|
|
|
|
2024-04-21 17:43:36 +02:00
|
|
|
mod object;
|
2024-05-01 16:46:36 +02:00
|
|
|
pub use object::*;
|
2024-04-21 17:43:36 +02:00
|
|
|
|
|
|
|
mod user;
|
2024-05-01 16:46:36 +02:00
|
|
|
pub use user::*;
|
2024-04-21 17:43:36 +02:00
|
|
|
|
2024-05-13 19:13:40 +02:00
|
|
|
mod post;
|
|
|
|
pub use post::*;
|
|
|
|
|
2024-04-21 17:43:36 +02:00
|
|
|
use leptos::*;
|
|
|
|
|
|
|
|
#[component]
|
|
|
|
pub fn DateTime(t: Option<chrono::DateTime<chrono::Utc>>) -> impl IntoView {
|
|
|
|
match t {
|
|
|
|
Some(t) => {
|
2024-04-23 03:15:37 +02:00
|
|
|
let delta = chrono::Utc::now() - t;
|
|
|
|
let pretty = if delta.num_seconds() < 60 {
|
|
|
|
format!("{}s ago", delta.num_seconds())
|
|
|
|
} else if delta.num_minutes() < 60 {
|
|
|
|
format!("{}m ago", delta.num_minutes())
|
|
|
|
} else if delta.num_hours() < 24 {
|
|
|
|
format!("{}h ago", delta.num_hours())
|
|
|
|
} else if delta.num_days() < 90 {
|
|
|
|
format!("{}d ago", delta.num_days())
|
|
|
|
} else {
|
2024-04-23 03:31:42 +02:00
|
|
|
t.format("%d/%m/%Y").to_string()
|
2024-04-23 03:15:37 +02:00
|
|
|
};
|
|
|
|
let rfc = t.to_rfc2822();
|
2024-04-21 17:43:36 +02:00
|
|
|
Some(view! {
|
|
|
|
<small title={rfc}>{pretty}</small>
|
|
|
|
})
|
|
|
|
},
|
|
|
|
None => None,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-04-23 03:31:42 +02:00
|
|
|
pub const PRIVACY_PUBLIC : &str = "🪩";
|
2024-04-23 02:48:30 +02:00
|
|
|
pub const PRIVACY_FOLLOWERS : &str = "🔒";
|
|
|
|
pub const PRIVACY_PRIVATE : &str = "📨";
|
|
|
|
|
2024-04-21 17:43:36 +02:00
|
|
|
#[component]
|
|
|
|
pub fn PrivacyMarker(addressed: Vec<String>) -> impl IntoView {
|
|
|
|
let privacy = if addressed.iter().any(|x| x == apb::target::PUBLIC) {
|
2024-04-23 02:48:30 +02:00
|
|
|
PRIVACY_PUBLIC
|
2024-04-21 17:43:36 +02:00
|
|
|
} else if addressed.iter().any(|x| x.ends_with("/followers")) {
|
2024-04-23 02:48:30 +02:00
|
|
|
PRIVACY_FOLLOWERS
|
2024-04-21 17:43:36 +02:00
|
|
|
} else {
|
2024-04-23 02:48:30 +02:00
|
|
|
PRIVACY_PRIVATE
|
2024-04-21 17:43:36 +02:00
|
|
|
};
|
|
|
|
let audience = format!("[ {} ]", addressed.join(", "));
|
|
|
|
view! {
|
2024-04-23 03:31:42 +02:00
|
|
|
<span class="emoji ml-1 mr-s moreinfo" title={audience} >{privacy}</span>
|
2024-04-21 17:43:36 +02:00
|
|
|
}
|
|
|
|
}
|