From 636cc741a0ba7e360f627d1862213952139a481c Mon Sep 17 00:00:00 2001 From: myschkin Date: Thu, 15 Feb 2024 18:00:04 +0100 Subject: [PATCH] added component/manager.rs --- src/app.rs | 2 ++ src/components.rs | 1 + src/components/manager.rs | 26 ++++++++++++++++++++++++++ 3 files changed, 29 insertions(+) create mode 100644 src/components/manager.rs diff --git a/src/app.rs b/src/app.rs index dcd95e4..ccb7e7d 100644 --- a/src/app.rs +++ b/src/app.rs @@ -18,6 +18,7 @@ pub struct App { pub tick_rate: f64, pub frame_rate: f64, pub components: Vec>, + pub manager: Vec>, pub should_quit: bool, pub should_suspend: bool, pub mode: Mode, @@ -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, diff --git a/src/components.rs b/src/components.rs index 47ff283..4555524 100644 --- a/src/components.rs +++ b/src/components.rs @@ -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, diff --git a/src/components/manager.rs b/src/components/manager.rs new file mode 100644 index 0000000..37cbbf9 --- /dev/null +++ b/src/components/manager.rs @@ -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> { + Ok(None) + } + + fn draw(&mut self, f: &mut Frame<'_>, rect: Rect) -> Result<()> { + Ok(()) + } +}