Skip to content

Commit 6986eb7

Browse files
author
Yap Jia Hong
committed
Finished paused feature.
1 parent 4b447c9 commit 6986eb7

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/app.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ fn work_screen(app: &mut App, ctx: &egui::Context, _frame: &mut eframe::Frame) {
135135
.color(Color32::LIGHT_BLUE));
136136

137137
if pause.clicked() {
138+
app.pause_time = Duration::from_secs(elapsed);
138139
app.screen = Screen::Pause;
139140
}
140141

@@ -250,7 +251,11 @@ fn pause_screen(app: &mut App, ctx: &egui::Context, _frame: &mut eframe::Frame)
250251

251252
ui.heading("Taking a break? You must have something important that came up.");
252253

253-
if ui.button("Resume.").clicked() {
254+
ui.label("\n\n\n");
255+
256+
if ui.button("Resume").clicked() {
257+
app.work_time -= app.pause_time;
258+
app.now = Some(Instant::now());
254259
app.screen = Screen::Working;
255260
}
256261
});
@@ -265,6 +270,8 @@ pub struct App {
265270
rest: String,
266271
sessions: String,
267272

273+
#[serde(skip)]
274+
pause_time: Duration,
268275
#[serde(skip)]
269276
now: Option<Instant>,
270277
#[serde(skip)]
@@ -282,6 +289,7 @@ pub struct App {
282289
impl Default for App {
283290
fn default() -> Self {
284291
Self {
292+
pause_time: Duration::from_secs(0),
285293
now: None,
286294
warning: None,
287295
screen: Screen::Start,

0 commit comments

Comments
 (0)