Draws the whole TUI
(&mut self)
| 54 | |
| 55 | /// Draws the whole TUI |
| 56 | pub fn draw(&mut self) { |
| 57 | let frame_size = self.frame.area(); |
| 58 | let (left_area, right_area) = self.split_layout(frame_size); |
| 59 | |
| 60 | self.draw_paper_list(left_area); |
| 61 | if let Some(paper) = self.state.selected_paper().cloned() { |
| 62 | self.draw_paper_details(&paper, right_area); |
| 63 | } |
| 64 | |
| 65 | // TODO (autoparallel): This could definitely be made far more simple |
| 66 | match &self.state.dialog { |
| 67 | DialogType::ExitConfirm => self.draw_exit_dialog(), |
| 68 | DialogType::PDFNotFound => self.draw_pdf_not_found_dialog(), |
| 69 | DialogType::CommandInput => self.draw_command_input(), |
| 70 | DialogType::RemoveConfirm { papers, args } => |
| 71 | self.draw_remove_confirm_dialog(&papers.clone(), &args.clone()), |
| 72 | DialogType::SearchResults { papers, query, selected } => |
| 73 | self.draw_search_results(&papers.clone(), &query.clone(), &selected.clone()), |
| 74 | DialogType::PDFConfirm { paper } => self.draw_pdf_confirm_dialog(&paper.clone()), |
| 75 | DialogType::Success { message } => self.draw_success_dialog(&message.clone()), |
| 76 | DialogType::None => {}, |
| 77 | } |
| 78 | |
| 79 | self.state.needs_redraw = false; |
| 80 | } |
| 81 | |
| 82 | /// Draws the pop up with search results |
| 83 | fn draw_search_results(&mut self, papers: &[Paper], query: &str, selected: &ListState) { |
no test coverage detected