aboutsummaryrefslogtreecommitdiff
path: root/src-vue
diff options
context:
space:
mode:
authorRémy Raes <contact@remyraes.com>2023-12-23 14:31:18 +0100
committerGitHub <noreply@github.com>2023-12-23 14:31:18 +0100
commit90881bd1f58e0bfa9ec5a7b8a47df2f5a1eb06af (patch)
tree4a51b0dbb05dab15f92cfabc5a615bb21ea5d166 /src-vue
parent37af27e6657feef928e811f752c3663133fad221 (diff)
downloadFlightCore-90881bd1f58e0bfa9ec5a7b8a47df2f5a1eb06af.tar.gz
FlightCore-90881bd1f58e0bfa9ec5a7b8a47df2f5a1eb06af.zip
feat: Notification improvements (#720)
- display time of day in menu notifications - make app icon blink (on Windows at least) when a notification is fired.
Diffstat (limited to 'src-vue')
-rw-r--r--src-vue/src/i18n/lang/en.json1
-rw-r--r--src-vue/src/i18n/lang/fr.json1
-rw-r--r--src-vue/src/utils/ui.ts6
3 files changed, 7 insertions, 1 deletions
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({