Skip to content

Commit

Permalink
refactor: moving response viewer logic to its module
Browse files Browse the repository at this point in the history
  • Loading branch information
wllfaria committed Jun 1, 2024
1 parent 0fbb850 commit 611bcc7
Show file tree
Hide file tree
Showing 12 changed files with 347 additions and 378 deletions.
2 changes: 1 addition & 1 deletion hac-client/benches/collection_viewer_bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::sync::{Arc, RwLock};

use crossterm::event::{KeyCode, KeyEvent, KeyEventKind, KeyEventState, KeyModifiers};
use hac_client::{
pages::{collection_viewer::CollectionViewer, Eventful, Page},
pages::{collection_viewer::CollectionViewer, Component, Eventful},
utils::build_syntax_highlighted_lines,
};
use hac_core::{
Expand Down
2 changes: 1 addition & 1 deletion hac-client/src/app.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::{
event_pool::{Event, EventPool},
pages::{Eventful, Page},
pages::{Component, Eventful},
screen_manager::ScreenManager,
};
use hac_core::{collection::Collection, command::Command};
Expand Down
2 changes: 1 addition & 1 deletion hac-client/src/pages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use ratatui::{layout::Rect, Frame};
use tokio::sync::mpsc::UnboundedSender;

/// A `Page` is anything that is a top level page and can be drawn to the screen
pub trait Page {
pub trait Component {
fn draw(&mut self, frame: &mut Frame, size: Rect) -> anyhow::Result<()>;

/// pages need to adapt to change of sizes on the application, this function is called
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::pages::{
confirm_popup::ConfirmPopup,
error_popup::ErrorPopup,
overlay::draw_overlay,
Eventful, Page,
Component, Eventful,
};
use hac_core::{collection::types::Collection, command::Command};

Expand Down Expand Up @@ -520,7 +520,7 @@ impl<'a> CollectionDashboard<'a> {
}
}

impl Page for CollectionDashboard<'_> {
impl Component for CollectionDashboard<'_> {
fn draw(&mut self, frame: &mut Frame, size: Rect) -> anyhow::Result<()> {
self.draw_background(size, frame);
self.draw_title(frame)?;
Expand Down
Loading

0 comments on commit 611bcc7

Please sign in to comment.