feat: made beacon search and list better

This commit is contained in:
Andrew Rioux
2025-02-22 20:00:28 -05:00
parent faaa4d2d1a
commit f284cf47eb
7 changed files with 497 additions and 70 deletions
+4 -3
View File
@@ -23,7 +23,7 @@ pub fn format_delta(time: chrono::TimeDelta) -> String {
}
3600..=86399 => {
let hours = seconds / 3600;
format!("{} hours{} ago", hours, if hours == 1 { "" } else { "s" })
format!("{} hour{} ago", hours, if hours == 1 { "" } else { "s" })
}
_ => {
let days = seconds / 86400;
@@ -96,9 +96,10 @@ async fn reset_password(user_id: i64, password: String) -> Result<(), ServerFnEr
#[component]
pub fn RenderUser(refresh_user_list: Action<(), ()>, user: PubUser) -> impl IntoView {
#[cfg(not(feature = "ssr"))]
use leptos_use::{use_interval, UseIntervalReturn};
#[cfg(feature = "hydrate")]
#[cfg(not(feature = "ssr"))]
let UseIntervalReturn { counter, .. } = use_interval(1000);
#[cfg_attr(not(feature = "hydrate"), allow(unused_variables))]
let (time_ago, set_time_ago) = signal(
@@ -106,7 +107,7 @@ pub fn RenderUser(refresh_user_list: Action<(), ()>, user: PubUser) -> impl Into
.map(|active| format_delta(Utc::now() - active)),
);
#[cfg(feature = "hydrate")]
#[cfg(not(feature = "ssr"))]
Effect::watch(
move || counter.get(),
move |_, _, _| {