fix: replace leptos-shadcn-toast with custom implementation to fix WASM panic
Some checks failed
Build MIPS Binary / build (push) Failing after 1m23s

This commit is contained in:
spinline
2026-02-11 20:02:58 +03:00
parent 920704ee72
commit f35b119c0d
5 changed files with 125 additions and 10 deletions

View File

@@ -7,15 +7,18 @@ use std::collections::HashMap;
use struct_patch::traits::Patch;
use base64::{Engine as _, engine::general_purpose::STANDARD as BASE64};
use crate::components::toast::ToastContext;
pub fn show_toast(level: NotificationLevel, message: impl Into<String>) {
let msg = message.into();
gloo_console::log!("TOAST CALL:", &msg, format!("{:?}", level));
log::info!("Displaying toast: [{:?}] {}", level, msg);
match level {
NotificationLevel::Info => { leptos_shadcn_toast::toast::info(&msg).show(); },
NotificationLevel::Success => { leptos_shadcn_toast::toast::success(&msg).show(); },
NotificationLevel::Warning => { leptos_shadcn_toast::toast::warning(&msg).show(); },
NotificationLevel::Error => { leptos_shadcn_toast::toast::error(&msg).show(); },
if let Some(context) = use_context::<ToastContext>() {
context.add(msg, level);
} else {
log::error!("ToastContext not found!");
gloo_console::error!("ToastContext not found!");
}
}