From c10dc42334dffdfaf6168fcdaa2962552000cfd1 Mon Sep 17 00:00:00 2001 From: Saiyed Shizain Date: Mon, 19 Jan 2026 02:36:31 +0530 Subject: add more notification msgs update the ui, footer sits at the bottom of the screen --- src/pomo/state.rs | 26 ++++++++++++++------- src/pomo/ui.rs | 69 ++++++++++++++++++++++++++++--------------------------- 2 files changed, 53 insertions(+), 42 deletions(-) diff --git a/src/pomo/state.rs b/src/pomo/state.rs index 4c1772f..ec66255 100644 --- a/src/pomo/state.rs +++ b/src/pomo/state.rs @@ -68,15 +68,25 @@ impl Pomo { if self.is_running && self.time_remaining.as_secs() > 0 { self.time_remaining -= Duration::from_secs(1); } else if self.is_running && self.time_remaining.as_secs() == 0 { + let focus_msg = [ + "I'm tired, boss...", + "Congrats! You're him 🗿", + "Stand up. Touch grass.", + "Mission Passed! Respect+", + ]; + let break_msg = [ + "Ah shit, here we go again.", + "Wake up, Samurai. We have code to burn.", + "Lock back in.", + "Ref! Do Something! The break's over!", + ]; + + // Use the remaining duration/break count as a seed for simple 'random' selection + let idx = (self.break_count as usize) % 4; + let (title, msg) = match self.mode { - SessionMode::Work => ( - "Focus Block Complete", - "I'm tired, boss." - ), - _ => ( - "Break Over", - "Ah shit, here we go again." - ), + SessionMode::Work => ("Focus Block Complete", focus_msg[idx]), + _ => ("Break Over", break_msg[idx]), }; self.send_notification(title, msg); diff --git a/src/pomo/ui.rs b/src/pomo/ui.rs index 14cfbd2..742a24f 100644 --- a/src/pomo/ui.rs +++ b/src/pomo/ui.rs @@ -10,21 +10,41 @@ pub fn render(f: &mut Frame, app: &mut Pomo) { let main_block = Block::default().style(Style::default().bg(Color::Reset)); f.render_widget(main_block, f.area()); + let root_layout = Layout::default() + .direction(Direction::Vertical) + .constraints([ + Constraint::Min(0), // App Screen Content + Constraint::Length(1), // Absolute Footer + Constraint::Length(1), // Bottom Padding Spacer + ]) + .split(f.area()); + match app.screen { AppScreen::Timer => { - let outer_v_chunks = Layout::default() + let timer_v_center = Layout::default() .direction(Direction::Vertical) .constraints([ Constraint::Fill(1), - Constraint::Length(18), + Constraint::Length(15), Constraint::Fill(1), ]) - .split(f.area()); - render_timer_screen(f, app, outer_v_chunks[1]); + .split(root_layout[0]); + + render_timer_screen(f, app, timer_v_center[1]); + + let footer = "tab session • e edit time • space pause • r reset • q quit"; + f.render_widget( + Paragraph::new(footer) + .alignment(Alignment::Center) + .style(Style::default().fg(MOCHA_OVERLAY0)), + root_layout[1] + ); + } + AppScreen::Tasks => { + render_task_screen(f, app, root_layout[1]); } - AppScreen::Tasks => render_task_screen(f, app), } - + if let InputMode::Insert | InputMode::Edit | InputMode::TimerEdit = app.input_mode { render_input_modal(f, app); } @@ -34,13 +54,12 @@ fn render_timer_screen(f: &mut Frame, app: &Pomo, area: Rect) { let chunks = Layout::default() .direction(Direction::Vertical) .constraints([ - Constraint::Length(1), - Constraint::Length(4), - Constraint::Length(5), - Constraint::Length(3), - Constraint::Length(1), - Constraint::Min(1), - Constraint::Length(1), + Constraint::Length(1), // Priority Text + Constraint::Length(4), // Spacer + Constraint::Length(5), // ASCII Timer + Constraint::Length(3), // Spacer + Constraint::Length(1), // Session Dots + Constraint::Min(0), ]) .split(area); @@ -51,7 +70,6 @@ fn render_timer_screen(f: &mut Frame, app: &Pomo, area: Rect) { f.render_widget( Paragraph::new(priority_text) .alignment(Alignment::Center) - .wrap(Wrap { trim: true }) // Added wrapping for the top priority bar .style(Style::default().fg(MOCHA_LAVENDER).bold()), chunks[0] ); @@ -64,12 +82,6 @@ fn render_timer_screen(f: &mut Frame, app: &Pomo, area: Rect) { ); render_session_dots(f, app, chunks[4]); - - let footer = "tab session • e edit time • space pause • r reset • q quit"; - f.render_widget( - Paragraph::new(footer).alignment(Alignment::Center).style(Style::default().fg(MOCHA_OVERLAY0)), - chunks[6] - ); } // Fixed-width monolithic ASCII engine @@ -112,18 +124,9 @@ fn render_session_dots(f: &mut Frame, app: &Pomo, area: Rect) { f.render_widget(Paragraph::new(Line::from(spans)).alignment(Alignment::Center), area); } -pub fn render_task_screen(f: &mut Frame, app: &mut Pomo) { +pub fn render_task_screen(f: &mut Frame, app: &mut Pomo, footer_area: Rect) { let area = centered_rect(60, 80, f.area()); - // Vertical split to house the task list and the footer helper - let chunks = Layout::default() - .direction(Direction::Vertical) - .constraints([ - Constraint::Min(0), // Task List takes all available space - Constraint::Length(1), // Footer takes exactly one line - ]) - .split(area); - let items: Vec = app.tasks.iter().map(|t| { let symbol = if t.is_done { "󰄲" } else { "󰄱" }; ListItem::new(Text::from(format!(" {} {}", symbol, t.title))) @@ -139,16 +142,14 @@ pub fn render_task_screen(f: &mut Frame, app: &mut Pomo) { .highlight_style(Style::default().bg(MOCHA_SURFACE0).fg(MOCHA_TEXT).bold()) .highlight_symbol(">> "); - f.render_stateful_widget(list, chunks[0], &mut app.task_state); + f.render_stateful_widget(list, area, &mut app.task_state); - // --- TASK MENU FOOTER --- - // i: Insert, Enter: Done/Save, e: Edit, d: Delete let footer_text = "i insert • ⏎ toggle • e edit • d delete • t back"; f.render_widget( Paragraph::new(footer_text) .alignment(Alignment::Center) .style(Style::default().fg(MOCHA_OVERLAY0)), - chunks[1] + footer_area ); } -- cgit v1.2.3