diff --git a/src/app.rs b/src/app.rs index fb31517..679d22f 100644 --- a/src/app.rs +++ b/src/app.rs @@ -1,11 +1,9 @@ -use core::panic; - use ratatui::{crossterm::event::KeyCode, widgets::ListState}; use serde::{Deserialize, Serialize}; use crate::snowballing::{Publication, get_publication_by_id}; -use log::{debug, error, info, warn}; +use log::warn; #[derive(Serialize, Deserialize, Default, PartialEq)] pub enum ActivePane { @@ -129,6 +127,7 @@ pub struct App { // TODO: Implement possibility of pushing excluded papers back into pending // TODO: Implement export of included papers as csv for keywording with a spreadsheet // TODO: Implement export of included papers into zotero (Use RIS format somehow) +// TODO: Implement proper ui and actor thread separation // TODO: Log everything relevant impl App { pub async fn add_seed_paper(&mut self, api_link: &String) { diff --git a/src/crossterm.rs b/src/crossterm.rs index 1f04c61..553c78f 100644 --- a/src/crossterm.rs +++ b/src/crossterm.rs @@ -1,6 +1,6 @@ use std::{error::Error, io, time::Duration}; -use log::{warn, error}; +use log::{error}; use ratatui::{ Terminal, backend::{Backend, CrosstermBackend}, @@ -54,11 +54,11 @@ where loop { terminal.draw(|frame| ui::draw(frame, &mut app))?; - // if event::poll(Duration::from_millis(10))? { - if let Event::Key(key) = event::read()? { - app.handle_key(key.code).await; + if event::poll(Duration::from_millis(100))? { + if let Event::Key(key) = event::read()? { + app.handle_key(key.code).await; + } } - // } if app.should_quit { return Ok(app); diff --git a/src/main.rs b/src/main.rs index ffcc698..1bdad29 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,4 @@ -use log::{error, info}; +use log::{error}; use serde_json; mod app; diff --git a/src/ui.rs b/src/ui.rs index 241c727..6ea113d 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -4,7 +4,7 @@ use crate::{ }; use ratatui::{ Frame, - layout::{Constraint, Direction, Layout, Rect, VerticalAlignment}, + layout::{Constraint, Direction, Layout, Rect}, style::{Color, Modifier, Style, Stylize}, text::{Line, Span}, widgets::{Block, Borders, List, ListItem, ListState, Paragraph}, @@ -275,9 +275,9 @@ fn draw_left_pane(frame: &mut Frame, app: &mut App, area: Rect) { frame.render_stateful_widget(list, chunks[0], &mut app.included_list_state); - // Snowballing status + // Snowballing progress - let status = vec![ + let progress = vec![ Line::from(vec![ Span::raw("Iteration: "), Span::styled( @@ -294,14 +294,12 @@ fn draw_left_pane(frame: &mut Frame, app: &mut App, area: Rect) { ]), ]; - let status_widget = - ratatui::widgets::Paragraph::new(status).style(Style::default()); - frame.render_widget(status_widget, chunks[1]); + let progress_widget = + ratatui::widgets::Paragraph::new(progress).style(Style::default()); + frame.render_widget(progress_widget, chunks[1]); } fn draw_right_pane(frame: &mut Frame, app: &mut App, area: Rect) { - // Included Publication list - let items = create_publication_item_list( &app.pending_publications, if app.active_pane == ActivePane::PendingPublications {