diff options
-rw-r--r-- | src/webui.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/webui.rs b/src/webui.rs index cd7c1de..61ea324 100644 --- a/src/webui.rs +++ b/src/webui.rs @@ -68,7 +68,7 @@ markup::define!( } } Task<'a>(key: &'a str, data: &'a Map<String, Value>, class: &'a str) { - div[class=class, id=key] { + div[class=class, id=key, style=task_style(data)] { // @if let Some(url) = data.get("thumbnail").and_then(Value::as_str) { // img[src=url, loading="lazy"]; // } @@ -94,6 +94,12 @@ markup::define!( } ); +fn task_style(data: &Map<String, Value>) -> Option<String> { + data.get("progress") + .and_then(Value::as_f64) + .map(|p| format!("background-size: {:.02}%;", p * 100.)) +} + fn worker_class(w: &crate::Worker) -> &'static str { if w.accept > 0 { "worker accepting" |