aboutsummaryrefslogtreecommitdiff
path: root/src-vue/src/utils
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/src/utils
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/src/utils')
-rw-r--r--src-vue/src/utils/ui.ts6
1 files changed, 5 insertions, 1 deletions
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({