-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
49 lines (45 loc) · 1.39 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<!DOCTYPE html>
<html>
<head>
<title>EyeEase</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<h2>Welcome to EyeEase! 🌟</h2>
<div class="container">
<p>Your personal assistant for maintaining healthy eyes. Every 20 minutes,
we'll remind you to take a 20-second break</p>
<p>Take a 20-second break after:</p>
<div id="timer">20:00</div>
</div>
<script>
const { ipcRenderer } = require('electron');
let timerElement = document.getElementById('timer');
let timeLeft = 1200; // 20 minutes in seconds
function formatTime(seconds) {
let minutes = Math.floor(seconds / 60);
let remainingSeconds = seconds % 60;
return `${minutes.toString().padStart(2, '0')}:${remainingSeconds.toString().padStart(2, '0')}`;
}
let countdown = setInterval(() => {
timeLeft--;
timerElement.textContent = formatTime(timeLeft);
if (timeLeft <= 0) {
clearInterval(countdown);
}
}, 1000);
// Reset timer when alert window is closed
ipcRenderer.on('reset-timer', () => {
timeLeft = 1200; // Reset to 20 minutes
timerElement.textContent = formatTime(timeLeft);
countdown = setInterval(() => {
timeLeft--;
timerElement.textContent = formatTime(timeLeft);
if (timeLeft <= 0) {
clearInterval(countdown);
}
}, 1000);
});
</script>
</body>
</html>