diff --git a/.changeset/modern-flies-draw.md b/.changeset/modern-flies-draw.md new file mode 100644 index 0000000..e2b0589 --- /dev/null +++ b/.changeset/modern-flies-draw.md @@ -0,0 +1,5 @@ +--- +'studytimer.io': minor +--- + +Add logo icon for desktop notifications. diff --git a/eslint.config.js b/eslint.config.js index 16a921e..327e282 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -26,6 +26,7 @@ export default [ ...globals.browser, NodeJS: true, NotificationPermission: true, + NotificationOptions: true, }, }, plugins: { jsdoc, importPlugin }, diff --git a/src/assets/images/logo-icon.png b/src/assets/images/logo-icon.png new file mode 100644 index 0000000..ff965c8 Binary files /dev/null and b/src/assets/images/logo-icon.png differ diff --git a/src/services/notification-api.service.js b/src/services/notification-api.service.js index c1aaf1e..e905612 100644 --- a/src/services/notification-api.service.js +++ b/src/services/notification-api.service.js @@ -1,3 +1,4 @@ +import logoIcon from '../assets/images/logo-icon.png'; import { appStore } from '../stores/app.js'; import { CLIENT_ERROR_MESSAGE, @@ -16,16 +17,15 @@ class NotificationApiService { return; } + /** @type {NotificationOptions} */ + const notificationOptions = { body: message, icon: logoIcon }; + if (Notification.permission === NOTIFICATION_PERMISSION.GRANTED) { - new Notification(title, { - body: message, - }); + new Notification(title, { ...notificationOptions }); } else { this.requestNotificationPermission().then(function (permissionGranted) { if (permissionGranted) { - new Notification(title, { - body: message, - }); + new Notification(title, { ...notificationOptions }); } }); }