Skip to content

Commit

Permalink
added component/manager.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
Eiafuawn committed Feb 15, 2024
1 parent 8d117a4 commit 636cc74
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ pub struct App {
pub tick_rate: f64,
pub frame_rate: f64,
pub components: Vec<Box<dyn Component>>,
pub manager: Vec<Box<dyn Component>>,
pub should_quit: bool,
pub should_suspend: bool,
pub mode: Mode,
Expand All @@ -35,6 +36,7 @@ impl App {
tick_rate,
frame_rate,
components: vec![Box::new(home), Box::new(fps), Box::new(spotify), Box::new(download)],
manager: vec![Box::new(home), Box::new(manager), Box::new(download)],
should_quit: false,
should_suspend: false,
config,
Expand Down
1 change: 1 addition & 0 deletions src/components.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ pub mod fps;
pub mod home;
pub mod download;
pub mod spotify;
pub mod manager;

/// `Component` is a trait that represents a visual and interactive element of the user interface.
/// Implementors of this trait can be registered with the main application loop and will be able to receive events,
Expand Down
26 changes: 26 additions & 0 deletions src/components/manager.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
use std::time::Instant;

use color_eyre::eyre::Result;
use ratatui::{prelude::*, widgets::*};

use super::Component;
use crate::{action::Action, tui::Frame};

#[derive(Debug, Clone)]
struct Manager {}

impl Manager {
pub fn new() -> Self {
Self {}
}
}

impl Component for Manager {
fn update(&mut self, action: Action) -> Result<Option<Action>> {
Ok(None)
}

fn draw(&mut self, f: &mut Frame<'_>, rect: Rect) -> Result<()> {
Ok(())
}
}

0 comments on commit 636cc74

Please sign in to comment.