From 90881bd1f58e0bfa9ec5a7b8a47df2f5a1eb06af Mon Sep 17 00:00:00 2001 From: Rémy Raes Date: Sat, 23 Dec 2023 14:31:18 +0100 Subject: feat: Notification improvements (#720) - display time of day in menu notifications - make app icon blink (on Windows at least) when a notification is fired. --- src-vue/src/i18n/lang/en.json | 1 + src-vue/src/i18n/lang/fr.json | 1 + src-vue/src/utils/ui.ts | 6 +++++- 3 files changed, 7 insertions(+), 1 deletion(-) (limited to 'src-vue') diff --git a/src-vue/src/i18n/lang/en.json b/src-vue/src/i18n/lang/en.json index 6fa6a965..6bbb6919 100644 --- a/src-vue/src/i18n/lang/en.json +++ b/src-vue/src/i18n/lang/en.json @@ -146,6 +146,7 @@ }, "notification": { + "date_prefix": "at", "no_new": { "title": "Up-to-date", "text": "Nothing to see here!" diff --git a/src-vue/src/i18n/lang/fr.json b/src-vue/src/i18n/lang/fr.json index 076806a5..d2de46b0 100644 --- a/src-vue/src/i18n/lang/fr.json +++ b/src-vue/src/i18n/lang/fr.json @@ -131,6 +131,7 @@ } }, "notification": { + "date_prefix": "à", "no_new": { "title": "Vous êtes à jour", "text": "Rien à voir par ici !" diff --git a/src-vue/src/utils/ui.ts b/src-vue/src/utils/ui.ts index 4c735a9c..f5183bcc 100644 --- a/src-vue/src/utils/ui.ts +++ b/src-vue/src/utils/ui.ts @@ -1,4 +1,5 @@ import { ElNotification, NotificationHandle } from "element-plus"; +import { appWindow, UserAttentionType } from '@tauri-apps/api/window'; import { i18n } from "../main"; import { store } from "../plugins/store"; @@ -13,7 +14,10 @@ function showNotification( duration: number = 4500 ): NotificationHandle { if (!document.hasFocus()) { - store.commit('addNotification', {title, text: message, type}); + const date = new Date(); + const titleWithDate = `${title} (${i18n.global.tc('notification.date_prefix')} ${('0' + date.getHours()).slice(-2)}:${('0' + date.getMinutes()).slice(-2)})`; + store.commit('addNotification', {title: titleWithDate, text: message, type}); + appWindow.requestUserAttention(UserAttentionType.Informational); } return ElNotification({ -- cgit v1.2.3