Update to include some Notifications API stuff

This commit is contained in:
William Moore 2023-01-20 13:53:43 -06:00
parent d21e9ec466
commit 77763a4189
3 changed files with 26 additions and 1 deletions

3
.gitignore vendored
View File

@ -8,6 +8,9 @@ yarn-error.log*
lerna-debug.log* lerna-debug.log*
.pnpm-debug.log* .pnpm-debug.log*
certs/
build/
# Diagnostic reports (https://nodejs.org/api/report.html) # Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

View File

@ -23,7 +23,7 @@
height: 5vh; height: 5vh;
} }
@media (max-width: 501px) { @media (max-width: 601px) {
.sensors { .sensors {
display: display !important; display: display !important;
} }

View File

@ -19,6 +19,28 @@ const Sensor = () => {
setInterval(() => pullTempFromBackend(), 1000); setInterval(() => pullTempFromBackend(), 1000);
}, []); }, []);
useEffect(() => {
if (temp) {
if (temp >= 82.2) {
Notification.requestPermission().then((result) => {
if (result === 'granted') {
new Notification('TeaSense Alert', {
body: '♨️',
});
}
});
} else if (temp >= 80.0) {
Notification.requestPermission().then((result) => {
if (result === 'granted') {
new Notification('TeaSense Warning', {
body: '🫖',
});
}
});
}
}
}, [temp]);
return ( return (
<div className={'gauge-body'}> <div className={'gauge-body'}>
<div className={'gauge-label'}>TeaSense</div> <div className={'gauge-label'}>TeaSense</div>