mirror of
https://github.com/owncast/owncast.git
synced 2024-10-10 19:16:02 +00:00
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 <wolfistgeil@gmail.com>
This commit is contained in:
parent
2f6bef7f66
commit
765cfa4f5a
@ -15,8 +15,6 @@ const NotificationsNotSupported = () => (
|
||||
<div>Browser notifications are not supported in your browser.</div>
|
||||
);
|
||||
|
||||
const NotificationsEnabled = () => <div>Notifications enabled</div>;
|
||||
|
||||
export type PermissionPopupPreviewProps = {
|
||||
start: () => void;
|
||||
};
|
||||
@ -58,6 +56,15 @@ const PermissionPopupPreview: FC<PermissionPopupPreviewProps> = ({ start }) => (
|
||||
</div>
|
||||
);
|
||||
|
||||
const NotificationsEnabled = () => (
|
||||
<div>
|
||||
<Title>Notifications are enabled</Title>
|
||||
To disable push notifications from {window.location.hostname.toString()} access your browser
|
||||
permissions for this site and turn off notifications.
|
||||
<a href="https://owncast.online/docs/notifications"> Learn more.</a>
|
||||
</div>
|
||||
);
|
||||
|
||||
export const BrowserNotifyModal = () => {
|
||||
const [error, setError] = useState<string>(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 <NotificationsEnabled />;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user