No longer use intentention window for status
This commit is contained in:
39
src/main.rs
39
src/main.rs
@@ -94,7 +94,6 @@ impl App {
|
||||
fn to_end(&mut self) {
|
||||
self.state = State::End;
|
||||
self.session_ratings = session_stats_as_vec(&self.session_stats);
|
||||
self.user_intention = "Press 1, 2, 3 to rate titles".to_string();
|
||||
}
|
||||
|
||||
fn tick_50ms(&mut self) {
|
||||
@@ -271,7 +270,6 @@ fn handle_events(app: &mut App) -> Result<()> {
|
||||
|
||||
if app.session_ratings_index >= app.session_ratings.len() {
|
||||
app.state = State::InputIntention;
|
||||
app.user_intention = "Next session!".to_string();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -300,7 +298,8 @@ fn ui(frame: &mut Frame, app: &App) {
|
||||
Constraint::Percentage(100),
|
||||
Constraint::Min(3),
|
||||
]);
|
||||
let [layout_intention, layout_duration, layout_titles, layout_status] = layout.areas(frame.size());
|
||||
let [layout_intention, layout_duration, layout_titles, layout_status] =
|
||||
layout.areas(frame.size());
|
||||
|
||||
let border_type_intention = if app.state == State::InputIntention {
|
||||
BorderType::Thick
|
||||
@@ -350,20 +349,40 @@ fn ui(frame: &mut Frame, app: &App) {
|
||||
}
|
||||
|
||||
if app.user_duration == Duration::ZERO {
|
||||
let span = Span::styled("Provide valid duration in minutes! ", Style::new().fg(Color::LightRed));
|
||||
let span = Span::styled(
|
||||
"Provide valid duration in minutes! ",
|
||||
Style::new().fg(Color::LightRed),
|
||||
);
|
||||
spans.push(span);
|
||||
}
|
||||
|
||||
if app.state == State::InProgress {
|
||||
let span = Span::styled("Session In-Progress", Style::new().fg(Color::LightGreen));
|
||||
spans.push(span);
|
||||
match app.state {
|
||||
State::InputIntention | State::InputDuration => {
|
||||
if spans.len() == 0 {
|
||||
let span = Span::styled(
|
||||
"Ready to start next session.",
|
||||
Style::new().fg(Color::LightGreen),
|
||||
);
|
||||
spans.push(span);
|
||||
}
|
||||
}
|
||||
State::InProgress => {
|
||||
let span = Span::styled("Session In-Progress", Style::new().fg(Color::LightGreen));
|
||||
spans.push(span);
|
||||
}
|
||||
State::ShouldQuit => {}
|
||||
State::End => {
|
||||
let span = Span::styled(
|
||||
"Press 1, 2, 3 to rate titles!",
|
||||
Style::new().fg(Color::LightBlue),
|
||||
);
|
||||
spans.push(span);
|
||||
}
|
||||
}
|
||||
|
||||
let input_status: Vec<Line> = vec![Line::from(spans)];
|
||||
frame.render_widget(
|
||||
Paragraph::new(input_status).block(
|
||||
Block::bordered().title("Status"),
|
||||
),
|
||||
Paragraph::new(input_status).block(Block::bordered().title("Status")),
|
||||
layout_status,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user