diff options
Diffstat (limited to 'ui/src/components/message.rs')
| -rw-r--r-- | ui/src/components/message.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/ui/src/components/message.rs b/ui/src/components/message.rs new file mode 100644 index 0000000..a271d40 --- /dev/null +++ b/ui/src/components/message.rs @@ -0,0 +1,20 @@ +/* + This file is part of jellything (https://codeberg.org/metamuffin/jellything) + which is licensed under the GNU Affero General Public License (version 3); see /COPYING. + Copyright (C) 2026 metamuffin <metamuffin.org> +*/ +use crate::RenderInfo; +use jellycommon::{MESSAGE_KIND, MESSAGE_TEXT, jellyobject::Object}; +use markup::define; + +define! { + Message<'a>(ri: &'a RenderInfo<'a>, message: Object<'a>) { + @let _ = ri; + @let text = message.get(MESSAGE_TEXT).unwrap_or_default(); + @match message.get(MESSAGE_KIND).unwrap_or("neutral") { + "success" => { section.message { p.success { @text } } } + "error" => { section.message { p.error { @text } } } + "neutral" | _ => { section.message { p { @text } } } + } + } +} |