feat: add pause and resume functionality

- implement pause and resume commands in the Pomodoro package
- modify timer logic to handle paused state
- adjust client command handling for pause and resume actions
- update HTML to include pause/resume button

🤖
This commit is contained in:
Sebastian Mark 2024-10-19 18:15:16 +02:00
parent c9501c3bbb
commit bc3a306c00
4 changed files with 94 additions and 22 deletions

View file

@ -34,8 +34,17 @@ func handleClientCommands(ws *websocket.Conn) {
}
case "stop":
if pomodoro.IsPomodoroRunning() {
pomodoro.StopTimer() // Stop the timer in the Pomodoro package
pomodoro.StopPomodoro() // Stop the timer in the Pomodoro package
}
case "pause":
if pomodoro.IsPomodoroRunning() && !pomodoro.IsPomodoroPaused() {
pomodoro.PausePomodoro() // Pause the timer
}
case "resume":
if pomodoro.IsPomodoroRunning() && pomodoro.IsPomodoroPaused() {
pomodoro.ResumePomodoro() // Resume the timer
}
}
}
}