feat: add 2 second auto close on skipped notifications (#6191)

This commit is contained in:
Prospector
2026-05-24 10:39:27 -07:00
committed by GitHub
parent ea967845d9
commit 6f44c5b039
3 changed files with 20 additions and 16 deletions
@@ -7,6 +7,7 @@ export interface WebNotification {
type?: 'error' | 'warning' | 'success' | 'info'
errorCode?: string
count?: number
autoCloseMs?: number | null // null means do not dismiss automatically
timer?: NodeJS.Timeout
supportData?: Record<string, unknown>
}
@@ -14,7 +15,7 @@ export interface WebNotification {
export type NotificationPanelLocation = 'left' | 'right'
export abstract class AbstractWebNotificationManager {
protected readonly AUTO_DISMISS_DELAY_MS = 30 * 1000
protected readonly DEFAULT_AUTO_DISMISS_DELAY_MS = 30 * 1000
abstract getNotifications(): WebNotification[]
abstract getNotificationLocation(): NotificationPanelLocation
@@ -90,9 +91,13 @@ export abstract class AbstractWebNotificationManager {
this.clearNotificationTimer(notification)
if (notification.autoCloseMs === null) return
const delay = notification.autoCloseMs ?? DEFAULT_AUTO_DISMISS_DELAY_MS
notification.timer = setTimeout(() => {
this.removeNotification(notification.id)
}, this.AUTO_DISMISS_DELAY_MS)
}, delay)
}
stopNotificationTimer = (notification: WebNotification): void => {