package popup import "fmt" import "git.haelnorr.com/h/golib/notify" import "git.haelnorr.com/h/golib/hws" // ToastNotificationWS creates a toast notification sent via WebSocket with OOB swap // Backend should pass: notifType ("success"|"warning"|"info"), title, message templ Toast(nt notify.Notification, id, duration int) { {{ // Determine classes server-side based on notifType color := map[notify.Level]string{ notify.LevelSuccess: "green", notify.LevelWarn: "yellow", notify.LevelInfo: "blue", hws.LevelShutdown: "yellow", } containerClass := fmt.Sprintf("bg-dark-%s border-2 border-%s", color[nt.Level], color[nt.Level]) textClass := fmt.Sprintf("text-%s", color[nt.Level]) progressClass := fmt.Sprintf("bg-%s", color[nt.Level]) }}
}