Code cleanup
This commit is contained in:
parent
ac89e93b7a
commit
33b3fe59db
@ -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) {
|
||||
|
||||
@ -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 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);
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
use log::{error, info};
|
||||
use log::{error};
|
||||
use serde_json;
|
||||
|
||||
mod app;
|
||||
|
||||
14
src/ui.rs
14
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 {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user