Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
tui: Add placeholder for issue browser
Erik Kundt committed 3 years ago
commit 1bde528a1b41b2e538988ada9443e459a503a90b
parent f7799e1474fcad718e3f290b8574bb3ad58b7e1c
3 files changed +46 -3
modified radicle-tui/src/app.rs
@@ -16,7 +16,7 @@ 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, PatchActivity, PatchFiles};
+
use radicle_tui::ui::components::workspace::{Browser, IssueBrowser, PatchActivity, PatchFiles};
use radicle_tui::ui::layout;
use radicle_tui::ui::theme::{self, Theme};
use radicle_tui::ui::widget::Widget;
@@ -230,7 +230,7 @@ impl ViewPage for Home {
        let navigation = ui::home_navigation(theme).to_boxed();

        let dashboard = ui::dashboard(theme, &context.id, &context.project).to_boxed();
-
        let issue_browser = Box::<Phantom>::default();
+
        let issue_browser = ui::issue_browser(&theme).to_boxed();
        let patch_browser = ui::patch_browser(theme, &context.patches, &context.profile).to_boxed();

        let shortcuts = ui::shortcuts(
@@ -430,6 +430,12 @@ impl tuirealm::Component<Message, NoUserEvent> for Widget<Browser<(PatchId, Patc
    }
}

+
impl tuirealm::Component<Message, NoUserEvent> for Widget<IssueBrowser> {
+
    fn on(&mut self, _event: Event<NoUserEvent>) -> Option<Message> {
+
        None
+
    }
+
}
+

impl tuirealm::Component<Message, NoUserEvent> for Widget<PatchActivity> {
    fn on(&mut self, event: Event<NoUserEvent>) -> Option<Message> {
        match event {
modified 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, PatchActivity, PatchFiles};
+
use self::components::workspace::{Browser, IssueBrowser, PatchActivity, PatchFiles};
use self::theme::Theme;

pub fn global_listener() -> Widget<GlobalListener> {
@@ -121,6 +121,13 @@ pub fn table(theme: &theme::Theme, items: &[impl List], profile: &Profile) -> Wi
        .highlight(theme.colors.item_list_highlighted_bg)
}

+
pub fn issue_browser(theme: &theme::Theme) -> Widget<IssueBrowser> {
+
    let not_implemented = label("not implemented").foreground(theme.colors.default_fg);
+
    let browser = IssueBrowser::new(not_implemented);
+

+
    Widget::new(browser)
+
}
+

pub fn patch_browser(
    theme: &theme::Theme,
    items: &[(PatchId, Patch)],
modified radicle-tui/src/ui/components/workspace.rs
@@ -44,6 +44,36 @@ impl<T: List> WidgetComponent for Browser<T> {
    }
}

+
pub struct IssueBrowser {
+
    label: Widget<Label>,
+
}
+
impl IssueBrowser {
+
    pub fn new(label: Widget<Label>) -> Self {
+
        Self { label }
+
    }
+
}
+

+
impl WidgetComponent for IssueBrowser {
+
    fn view(&mut self, _properties: &Props, frame: &mut Frame, area: Rect) {
+
        let label_w = self
+
            .label
+
            .query(Attribute::Width)
+
            .unwrap_or(AttrValue::Size(1))
+
            .unwrap_size();
+
        let rect = layout::centered_label(label_w, area);
+

+
        self.label.view(frame, rect);
+
    }
+

+
    fn state(&self) -> State {
+
        State::None
+
    }
+

+
    fn perform(&mut self, _properties: &Props, _cmd: Cmd) -> CmdResult {
+
        CmdResult::None
+
    }
+
}
+

pub struct PatchActivity {
    label: Widget<Label>,
}