use leptos::*; use shared::NotificationLevel; // ============================================================================ // Toast Components - DaisyUI Alert Style // ============================================================================ /// Returns the DaisyUI alert class for the notification level fn get_alert_class(level: &NotificationLevel) -> &'static str { match level { NotificationLevel::Info => "alert alert-info", NotificationLevel::Success => "alert alert-success", NotificationLevel::Warning => "alert alert-warning", NotificationLevel::Error => "alert alert-error", } } /// Individual toast item component #[component] fn ToastItem( level: NotificationLevel, message: String, ) -> impl IntoView { let alert_class = get_alert_class(&level); // DaisyUI SVG icons let icon_svg = match level { NotificationLevel::Info => view! { }.into_view(), NotificationLevel::Success => view! { }.into_view(), NotificationLevel::Warning => view! { }.into_view(), NotificationLevel::Error => view! { }.into_view(), }; view! {
{icon_svg} {message}
} } /// Main toast container - renders all active notifications #[component] pub fn ToastContainer() -> impl IntoView { let store = use_context::().expect("TorrentStore not provided"); let notifications = store.notifications; view! {
} } />
} }