Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bookings: added allow notification button #14553

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions packages/features/shell/Shell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1026,6 +1026,22 @@ export function ShellMain(props: LayoutProps) {
const router = useRouter();
const { isLocaleReady } = useLocale();

const handleNotification = async () => {
try {
const permission = await Notification.requestPermission();

if (permission === "granted") {
// Handle successful permission grant
console.log("Notifications permission granted");
} else {
// Handle permission denial (e.g., display a message)
console.log("Notifications permission denied");
}
} catch (error) {
console.error("Error requesting notification permission:", error);
}
};

return (
<>
{(props.heading || !!props.backPath) && (
Expand Down Expand Up @@ -1083,6 +1099,11 @@ export function ShellMain(props: LayoutProps) {
</div>
)}
{props.actions && props.actions}
{props.heading === "Bookings" && (
<Button color="primary" onClick={handleNotification}>
Allow Notifications
</Button>
)}
</header>
)}
</div>
Expand Down
Loading