diff options
Diffstat (limited to 'server/src/routes/ui/stats.rs')
-rw-r--r-- | server/src/routes/ui/stats.rs | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/server/src/routes/ui/stats.rs b/server/src/routes/ui/stats.rs index 07da1d4..b0e0b27 100644 --- a/server/src/routes/ui/stats.rs +++ b/server/src/routes/ui/stats.rs @@ -13,14 +13,18 @@ use crate::{ routes::{ api::AcceptJson, locale::AcceptLanguage, - ui::{layout::trs, node::{ - format_duration, format_duration_long, format_size, rocket_uri_macro_r_library_node, - }}, + ui::{ + layout::trs, + node::{ + format_duration, format_duration_long, format_size, rocket_uri_macro_r_library_node, + }, + }, }, uri, }; use jellybase::locale::tr; use jellycommon::{Node, NodeID, NodeKind, Visibility}; +use markup::raw; use rocket::{get, serde::json::Json, Either, State}; use serde::Serialize; use serde_json::{json, Value}; @@ -81,13 +85,21 @@ pub fn r_stats( }))) } else { Either::Left(LayoutPage { - title: tr(lang, "stats.title", &[]).to_string(), + title: tr(lang, "stats.title").to_string(), content: markup::new! { .page.stats { h1 { @trs(&lang, "stats.title") } - p { "There is a total of " b{@all.count} " nodes in the library." } - p { "The total runtime of the library is " b{@format_duration_long(all.runtime)} ", taking up " b{@format_size(all.size)} " of disk space." } - p { "An average node has a runtime of " b{@format_duration(all.average_runtime())} " and file size of " b{@format_size(all.average_size() as u64)} "." } + p { @raw(tr(lang, "stats.count") + .replace("{count}", &format!("<b>{}</b>", all.count)) + )} + p { @raw(tr(lang, "stats.runtime") + .replace("{dur}", &format!("<b>{}</b>", format_duration_long(all.runtime, lang))) + .replace("{size}", &format!("<b>{}</b>", format_size(all.size))) + )} + p { @raw(tr(lang, "stats.average") + .replace("{dur}", &format!("<b>{}</b>", format_duration(all.average_runtime()))) + .replace("{size}", &format!("<b>{}</b>", format_size(all.average_size() as u64))) + )} h2 { @trs(&lang, "stats.by_kind.title") } table.striped { |