fix: address notification review feedback

This commit is contained in:
Simos Mikelatos
2026-06-09 16:04:15 +00:00
parent 23210bc40e
commit 602e6ad4ac
3 changed files with 62 additions and 0 deletions

View File

@@ -94,15 +94,33 @@
"git": "Git", "git": "Git",
"apiTokens": "API & Token", "apiTokens": "API & Token",
"tasks": "Aufgaben", "tasks": "Aufgaben",
"notifications": "Benachrichtigungen",
"plugins": "Plugins", "plugins": "Plugins",
"about": "Info" "about": "Info"
}, },
"notifications": { "notifications": {
"title": "Benachrichtigungen",
"description": "Lege fest, welche Benachrichtigungen du erhältst.",
"webPush": {
"title": "Web-Push-Benachrichtigungen",
"enable": "Push-Benachrichtigungen aktivieren",
"disable": "Push-Benachrichtigungen deaktivieren",
"enabled": "Push-Benachrichtigungen sind aktiviert",
"loading": "Wird aktualisiert...",
"unsupported": "Push-Benachrichtigungen werden in diesem Browser nicht unterstützt.",
"denied": "Push-Benachrichtigungen sind blockiert. Bitte erlaube sie in den Browsereinstellungen."
},
"sound": { "sound": {
"title": "Ton", "title": "Ton",
"description": "Spielt einen kurzen Ton ab, wenn ein Chat-Lauf abgeschlossen ist.", "description": "Spielt einen kurzen Ton ab, wenn ein Chat-Lauf abgeschlossen ist.",
"enabled": "Aktiviert", "enabled": "Aktiviert",
"test": "Ton testen" "test": "Ton testen"
},
"events": {
"title": "Ereignistypen",
"actionRequired": "Aktion erforderlich",
"stop": "Lauf gestoppt",
"error": "Lauf fehlgeschlagen"
} }
}, },
"appearanceSettings": { "appearanceSettings": {

View File

@@ -94,15 +94,33 @@
"git": "Git", "git": "Git",
"apiTokens": "API и токены", "apiTokens": "API и токены",
"tasks": "Задачи", "tasks": "Задачи",
"notifications": "Уведомления",
"plugins": "Плагины", "plugins": "Плагины",
"about": "О программе" "about": "О программе"
}, },
"notifications": { "notifications": {
"title": "Уведомления",
"description": "Управляйте тем, какие события уведомлений вы получаете.",
"webPush": {
"title": "Web Push уведомления",
"enable": "Включить Push уведомления",
"disable": "Отключить Push уведомления",
"enabled": "Push уведомления включены",
"loading": "Обновление...",
"unsupported": "Push уведомления не поддерживаются в этом браузере.",
"denied": "Push уведомления заблокированы. Разрешите их в настройках браузера."
},
"sound": { "sound": {
"title": "Звук", "title": "Звук",
"description": "Воспроизводить короткий сигнал при завершении запуска чата.", "description": "Воспроизводить короткий сигнал при завершении запуска чата.",
"enabled": "Включено", "enabled": "Включено",
"test": "Проверить звук" "test": "Проверить звук"
},
"events": {
"title": "Типы событий",
"actionRequired": "Требуется действие",
"stop": "Запуск остановлен",
"error": "Запуск завершился с ошибкой"
} }
}, },
"appearanceSettings": { "appearanceSettings": {

View File

@@ -33,12 +33,17 @@ const clearTitleIndicator = (): void => {
} }
removeReturnListeners(); removeReturnListeners();
removePageInactiveListener();
if (document.title.startsWith(getIndicatorPrefix())) { if (document.title.startsWith(getIndicatorPrefix())) {
document.title = stripIndicator(document.title); document.title = stripIndicator(document.title);
} }
}; };
const removePageInactiveListener = (): void => {
document.removeEventListener('visibilitychange', handlePageInactive);
};
const scheduleClear = (): void => { const scheduleClear = (): void => {
if (clearTimer !== null) { if (clearTimer !== null) {
window.clearTimeout(clearTimer); window.clearTimeout(clearTimer);
@@ -47,6 +52,9 @@ const scheduleClear = (): void => {
clearTimer = window.setTimeout(() => { clearTimer = window.setTimeout(() => {
clearTitleIndicator(); clearTitleIndicator();
}, TITLE_INDICATOR_CLEAR_DELAY_MS); }, TITLE_INDICATOR_CLEAR_DELAY_MS);
removePageInactiveListener();
document.addEventListener('visibilitychange', handlePageInactive, { once: true });
}; };
function handleUserReturn(): void { function handleUserReturn(): void {
@@ -59,6 +67,24 @@ function handleUserReturn(): void {
scheduleClear(); scheduleClear();
} }
function handlePageInactive(): void {
if (document.visibilityState !== 'hidden') {
return;
}
if (clearTimer !== null) {
window.clearTimeout(clearTimer);
clearTimer = null;
}
if (!returnListenersAttached) {
document.addEventListener('visibilitychange', handleUserReturn);
window.addEventListener('focus', handleUserReturn, true);
window.addEventListener('click', handleUserReturn, true);
returnListenersAttached = true;
}
}
export const showCompletionTitleIndicator = (): void => { export const showCompletionTitleIndicator = (): void => {
if (typeof document === 'undefined' || typeof window === 'undefined') { if (typeof document === 'undefined' || typeof window === 'undefined') {
return; return;