From 765cfa4f5ad5afddb43d386d24b97aac33f8c5e1 Mon Sep 17 00:00:00 2001 From: Cleo John <30842467+CutestNekoAqua@users.noreply.github.com> Date: Sun, 2 Oct 2022 18:42:06 +0200 Subject: [PATCH] Added Modal to notify user how to disable notifications (#2154) * Added Modal to notify user how to disable notifications * add comment for notification permissions This adds a comment to describe the behavior of showing the modal on how to disable them if wanted. Also changed other comment to comply with the new one. Co-authored-by: Waterdev --- .../BrowserNotifyModal/BrowserNotifyModal.tsx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/web/components/modals/BrowserNotifyModal/BrowserNotifyModal.tsx b/web/components/modals/BrowserNotifyModal/BrowserNotifyModal.tsx index 4673bdcb8..27ebdef9f 100644 --- a/web/components/modals/BrowserNotifyModal/BrowserNotifyModal.tsx +++ b/web/components/modals/BrowserNotifyModal/BrowserNotifyModal.tsx @@ -15,8 +15,6 @@ const NotificationsNotSupported = () => (
Browser notifications are not supported in your browser.
); -const NotificationsEnabled = () =>
Notifications enabled
; - export type PermissionPopupPreviewProps = { start: () => void; }; @@ -58,6 +56,15 @@ const PermissionPopupPreview: FC = ({ start }) => ( ); +const NotificationsEnabled = () => ( +
+ Notifications are enabled + To disable push notifications from {window.location.hostname.toString()} access your browser + permissions for this site and turn off notifications. + Learn more. +
+); + export const BrowserNotifyModal = () => { const [error, setError] = useState(null); const accessToken = useRecoilValue(accessTokenAtom); @@ -73,12 +80,13 @@ export const BrowserNotifyModal = () => { const browserPushSupported = browser.enabled && isPushNotificationSupported(); + // If notification permissions are granted, show user info how to disable them if (notificationsPermitted) { return ; } const startBrowserPushRegistration = async () => { - // If it's already denied or granted, don't do anything. + // If notification permissions are already denied or granted, don't do anything. if (isPushNotificationSupported() && Notification.permission !== 'default') { return; }