mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-06-10 03:13:32 -07:00
feat(notifications): add overlay notifications with position config
- Add Catppuccin Macchiato overlay notification stack with 3s transient timeout - Add `notifications.overlayPosition` config (top-left | top | top-right) - Route startup tokenization and subtitle annotation status through configured surfaces - Deduplicate rapid subtitle mode toggle notifications - Change `both` to mean overlay + system; add `osd-system` as legacy alias for old behavior - Keep `osd`/`osd-system` as config-file-only legacy values; Settings UI offers overlay/system/both/none
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
export const SETTINGS_NOTIFICATION_TYPE_VALUES = ['overlay', 'system', 'both', 'none'] as const;
|
||||
|
||||
export const NOTIFICATION_TYPE_VALUES = [
|
||||
...SETTINGS_NOTIFICATION_TYPE_VALUES,
|
||||
'osd',
|
||||
'osd-system',
|
||||
] as const;
|
||||
|
||||
export const OVERLAY_NOTIFICATION_POSITION_VALUES = ['top-left', 'top', 'top-right'] as const;
|
||||
|
||||
export type SettingsNotificationType = (typeof SETTINGS_NOTIFICATION_TYPE_VALUES)[number];
|
||||
export type NotificationType = (typeof NOTIFICATION_TYPE_VALUES)[number];
|
||||
export type OverlayNotificationPosition = (typeof OVERLAY_NOTIFICATION_POSITION_VALUES)[number];
|
||||
|
||||
export type OverlayNotificationVariant = 'info' | 'success' | 'warning' | 'error' | 'progress';
|
||||
|
||||
export interface OverlayNotificationAction {
|
||||
id: string;
|
||||
label: string;
|
||||
}
|
||||
|
||||
export interface OverlayNotificationPayload {
|
||||
id?: string;
|
||||
title: string;
|
||||
body?: string;
|
||||
variant?: OverlayNotificationVariant;
|
||||
position?: OverlayNotificationPosition;
|
||||
persistent?: boolean;
|
||||
timeoutMs?: number;
|
||||
actions?: OverlayNotificationAction[];
|
||||
}
|
||||
|
||||
export interface OverlayNotificationDismissPayload {
|
||||
id: string;
|
||||
dismiss: true;
|
||||
}
|
||||
|
||||
export type OverlayNotificationEventPayload =
|
||||
| OverlayNotificationPayload
|
||||
| OverlayNotificationDismissPayload;
|
||||
|
||||
export function isNotificationType(value: unknown): value is NotificationType {
|
||||
return typeof value === 'string' && NOTIFICATION_TYPE_VALUES.includes(value as NotificationType);
|
||||
}
|
||||
|
||||
export function isOverlayNotificationPosition(
|
||||
value: unknown,
|
||||
): value is OverlayNotificationPosition {
|
||||
return (
|
||||
typeof value === 'string' &&
|
||||
OVERLAY_NOTIFICATION_POSITION_VALUES.includes(value as OverlayNotificationPosition)
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user