feat(countdown): rocket countdown (#45)

This commit is contained in:
Jens Krause
2025-01-08 18:52:18 +01:00
committed by GitHub
parent 468b4a5abf
commit c8af76c9e5
7 changed files with 111 additions and 11 deletions

View File

@@ -207,10 +207,18 @@ impl<T> ClockState<T> {
&self.mode
}
pub fn run(&mut self) {
self.mode = Mode::Tick
}
pub fn is_running(&self) -> bool {
self.mode == Mode::Tick
}
pub fn is_initial(&self) -> bool {
self.mode == Mode::Initial
}
pub fn is_edit_mode(&self) -> bool {
matches!(self.mode, Mode::Editable(_, _))
}
@@ -294,6 +302,10 @@ impl<T> ClockState<T> {
self.update_format();
}
pub fn is_done(&self) -> bool {
self.mode == Mode::Done
}
fn update_format(&mut self) {
self.format = self.get_format();
}