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) { {{ type style struct { bg string fg string border string bgdark string } // Determine classes server-side based on notifType var colors style switch nt.Level { case notify.LevelSuccess: colors = style{bg: "bg-green", fg: "text-green", border: "border-green", bgdark: "bg-dark-green"} case notify.LevelWarn, hws.LevelShutdown: colors = style{bg: "bg-yellow", fg: "text-yellow", border: "border-yellow", bgdark: "bg-dark-yellow"} case notify.LevelInfo: colors = style{bg: "bg-blue", fg: "text-blue", border: "border-blue", bgdark: "bg-dark-blue"} } }}
{ nt.Title }
{ nt.Message }