diff --git a/radicle-tui/src/app.rs b/radicle-tui/src/app.rs index 41065b7f..e17478c0 100644 --- a/radicle-tui/src/app.rs +++ b/radicle-tui/src/app.rs @@ -14,7 +14,9 @@ use radicle_tui::ui; use radicle_tui::ui::components::container::{GlobalListener, LabeledContainer, Tabs}; use radicle_tui::ui::components::context::{ContextBar, Shortcuts}; use radicle_tui::ui::components::list::PropertyList; -use radicle_tui::ui::components::workspace::{Browser, IssueBrowser, PatchActivity, PatchFiles}; +use radicle_tui::ui::components::workspace::{ + Browser, Dashboard, IssueBrowser, PatchActivity, PatchFiles, +}; use radicle_tui::ui::layout; use radicle_tui::ui::theme::{self, Theme}; use radicle_tui::ui::widget::Widget; @@ -428,6 +430,12 @@ impl tuirealm::Component for Widget for Widget { + fn on(&mut self, _event: Event) -> Option { + None + } +} + impl tuirealm::Component for Widget { fn on(&mut self, _event: Event) -> Option { None diff --git a/radicle-tui/src/ui.rs b/radicle-tui/src/ui.rs index fad82751..8ad88457 100644 --- a/radicle-tui/src/ui.rs +++ b/radicle-tui/src/ui.rs @@ -22,7 +22,7 @@ use widget::Widget; use self::cob::patch; use self::components::context::ContextBar; use self::components::list::{List, Table}; -use self::components::workspace::{Browser, IssueBrowser, PatchActivity, PatchFiles}; +use self::components::workspace::{Browser, Dashboard, IssueBrowser, PatchActivity, PatchFiles}; use self::theme::Theme; pub fn global_listener() -> Widget { @@ -212,8 +212,8 @@ pub fn patch_navigation(theme: &theme::Theme) -> Widget { tabs(theme, vec![label("activity"), label("files")]) } -pub fn dashboard(theme: &theme::Theme, id: &Id, project: &Project) -> Widget { - labeled_container( +pub fn dashboard(theme: &theme::Theme, id: &Id, project: &Project) -> Widget { + let about = labeled_container( theme, "about", property_list( @@ -225,5 +225,8 @@ pub fn dashboard(theme: &theme::Theme, id: &Id, project: &Project) -> Widget WidgetComponent for Browser { } } +pub struct Dashboard { + about: Widget, +} +impl Dashboard { + pub fn new(about: Widget) -> Self { + Self { about } + } +} + +impl WidgetComponent for Dashboard { + fn view(&mut self, _properties: &Props, frame: &mut Frame, area: Rect) { + let layout = Layout::default() + .direction(Direction::Vertical) + .constraints(vec![Constraint::Length(4)].as_ref()) + .split(area); + self.about.view(frame, layout[0]); + } + + fn state(&self) -> State { + State::None + } + + fn perform(&mut self, _properties: &Props, _cmd: Cmd) -> CmdResult { + CmdResult::None + } +} + pub struct IssueBrowser { label: Widget