update web to dashboard

This commit is contained in:
mlogclub
2026-04-15 17:20:57 +08:00
parent 3d98cf1e27
commit c07e588030
206 changed files with 0 additions and 0 deletions
-42
View File
@@ -1,42 +0,0 @@
import { summarizeIMMessage } from "@/lib/im-message"
type NotificationMessage = {
messageType: string
content: string
payload?: string
}
export function getNotificationBody(message: NotificationMessage): string {
return summarizeIMMessage(message)
}
export function showNotification(title: string, body: string, onClick?: () => void) {
if (typeof Notification === "undefined") {
return
}
if (Notification.permission === "granted") {
const notification = new Notification(title, {
body,
icon: "/favicon.ico",
badge: "/favicon.ico",
})
if (onClick) {
notification.onclick = () => {
onClick()
notification.close()
}
}
setTimeout(() => {
notification.close()
}, 5000)
} else if (Notification.permission === "default") {
Notification.requestPermission().then((permission) => {
if (permission === "granted") {
showNotification(title, body, onClick)
}
})
}
}