Skip to content

Commit

Permalink
feat: adding notification
Browse files Browse the repository at this point in the history
  • Loading branch information
Molaryy committed Dec 17, 2023
1 parent 327c4e8 commit 542c64d
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions frontend/src/components/BreakTime.tsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,29 @@
/*
import { useEffect, useState } from 'react'
import { useEffect, useState } from 'react';

const requestNotificationPermission = () => {
if (Notification.permission !== 'granted') {
Notification.requestPermission().then((permission: NotificationPermission) => {
if (permission !== 'granted') {
console.error('Notification permission granted.')
console.error('Notification permission granted.');
}
})
});
}
}
};

const sendNotification = () => {
const [canSendNotification, setCanSendNotification] = useState(true)
const [canSendNotification, setCanSendNotification] = useState(true);

if (Notification.permission === 'granted' && canSendNotification) {
new Notification('Take a break time')
setCanSendNotification(false)
new Notification('Take a break time');
setCanSendNotification(false);
}
}
*/
};

const BreakTime = () => {
/* useEffect(() => {
requestNotificationPermission()
}, [])
sendNotification() */
useEffect(() => {
requestNotificationPermission();
}, []);
sendNotification();
return <></>;
};

Expand Down

0 comments on commit 542c64d

Please sign in to comment.