diff options
author | metamuffin <metamuffin@disroot.org> | 2025-05-31 13:38:01 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2025-05-31 13:38:01 +0200 |
commit | 72a8d6c8cff8869019c3ce0cb1a38f806d964604 (patch) | |
tree | eae26a41700a9001eee715b4a4cf0c08deb1e0dd /ui/src/scaffold.rs | |
parent | 373243a81f8c44fcfc6a3612ba46da2c6a3286c6 (diff) | |
download | jellything-72a8d6c8cff8869019c3ce0cb1a38f806d964604.tar jellything-72a8d6c8cff8869019c3ce0cb1a38f806d964604.tar.bz2 jellything-72a8d6c8cff8869019c3ce0cb1a38f806d964604.tar.zst |
convert all manual message stuff to FlashMessage
Diffstat (limited to 'ui/src/scaffold.rs')
-rw-r--r-- | ui/src/scaffold.rs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/ui/src/scaffold.rs b/ui/src/scaffold.rs index a115ec3..95074cf 100644 --- a/ui/src/scaffold.rs +++ b/ui/src/scaffold.rs @@ -5,7 +5,7 @@ */ use crate::{ - CONF, + CONF, FlashM, locale::{Language, escape, tr, trs}, }; use jellycommon::{ @@ -72,11 +72,12 @@ markup::define! { } } - FlashDisplay(flash: Option<Result<String, String>>) { - @if let Some(flash) = &flash { - @match flash { - Ok(mesg) => { section.message { p.success { @mesg } } } - Err(err) => { section.message { p.error { @err } } } + FlashDisplay<'a>(flash: &'a FlashM) { + @if let Some((kind,message)) = &flash { + @match kind.as_str() { + "success" => { section.message { p.success { @message } } } + "error" => { section.message { p.error { @message } } } + _ => { section.message { p { @message } } } } } } |