Radish alpha
r
Radicle terminal user interface
Radicle
Git (anonymous pull)
Log in to clone via SSH
bin: Adjust to improved widget signature
Erik Kundt committed 2 years ago
commit 8ba58140c63cf1b12d0b4c059786872b6ac12475
parent b25e1b5612ef9d9e8c994088bcff4303f939fa24
3 files changed +45 -21
modified bin/commands/inbox/select/ui.rs
@@ -29,7 +29,7 @@ use crate::tui_inbox::common::{InboxOperation, Mode, RepositoryMode, SelectionMo

use super::{Action, State};

-
type BoxedWidget<B> = widget::BoxedWidget<State, Action, B>;
+
type BoxedWidget<B> = widget::BoxedWidget<B, State, Action>;

pub struct ListPageProps {
    show_search: bool,
@@ -128,7 +128,10 @@ impl<'a: 'static, B: Backend + 'a> View<State, Action> for ListPage<B> {
    }
}

-
impl<'a: 'static, B: Backend + 'a> Widget<State, Action, B> for ListPage<B> {
+
impl<'a: 'static, B> Widget<B, State, Action> for ListPage<B>
+
where
+
    B: Backend + 'a,
+
{
    fn render(&self, frame: &mut ratatui::Frame, _area: Rect, _props: &dyn Any) {
        let area = frame.size();
        let layout = tui::ui::layout::default_page(area, 0u16, 1u16);
@@ -239,7 +242,7 @@ where
        Self {
            action_tx: action_tx.clone(),
            props: NotificationsProps::from(state),
-
            table: Box::<Table<'_, State, Action, B, NotificationItem>>::new(
+
            table: Box::<Table<B, State, Action, NotificationItem>>::new(
                Table::new(state, action_tx.clone())
                    .header(
                        Header::new(state, action_tx.clone())
@@ -387,7 +390,7 @@ impl<'a, B: Backend> Notifications<'a, B> {

        let progress = selected
            .map(|selected| {
-
                Table::<State, Action, B, NotificationItem>::progress(
+
                Table::<B, State, Action, NotificationItem>::progress(
                    selected,
                    props.notifications.len(),
                    props.page_size,
@@ -433,7 +436,7 @@ impl<'a, B: Backend> Notifications<'a, B> {
    }
}

-
impl<'a: 'static, B> Widget<State, Action, B> for Notifications<'a, B>
+
impl<'a: 'static, B> Widget<B, State, Action> for Notifications<'a, B>
where
    B: Backend + 'a,
{
@@ -531,7 +534,10 @@ impl<B: Backend> View<State, Action> for Search<B> {
    }
}

-
impl<B: Backend> Widget<State, Action, B> for Search<B> {
+
impl<B> Widget<B, State, Action> for Search<B>
+
where
+
    B: Backend,
+
{
    fn render(&self, frame: &mut ratatui::Frame, area: Rect, _props: &dyn Any) {
        let layout = Layout::horizontal(Constraint::from_mins([0]))
            .horizontal_margin(1)
@@ -763,7 +769,10 @@ impl<'a, B: Backend> View<State, Action> for Help<'a, B> {
    }
}

-
impl<'a: 'static, B: Backend> Widget<State, Action, B> for Help<'a, B> {
+
impl<'a: 'static, B> Widget<B, State, Action> for Help<'a, B>
+
where
+
    B: Backend,
+
{
    fn render(&self, frame: &mut ratatui::Frame, area: Rect, props: &dyn Any) {
        let props = props.downcast_ref::<HelpProps<'_>>().unwrap_or(&self.props);

modified bin/commands/issue/select/ui.rs
@@ -32,7 +32,7 @@ use crate::tui_issue::common::Mode;

use super::{Action, State};

-
type BoxedWidget<B> = widget::BoxedWidget<State, Action, B>;
+
type BoxedWidget<B> = widget::BoxedWidget<B, State, Action>;

pub struct ListPageProps {
    show_search: bool,
@@ -134,7 +134,7 @@ where
    }
}

-
impl<'a: 'static, B> Widget<State, Action, B> for ListPage<B>
+
impl<'a: 'static, B> Widget<B, State, Action> for ListPage<B>
where
    B: Backend + 'a,
{
@@ -255,7 +255,7 @@ where
        Self {
            action_tx: action_tx.clone(),
            props: props.clone(),
-
            table: Box::<Table<'_, State, Action, B, IssueItem>>::new(
+
            table: Box::<Table<B, State, Action, IssueItem>>::new(
                Table::new(state, action_tx.clone())
                    .header(
                        Header::new(state, action_tx.clone())
@@ -403,7 +403,7 @@ impl<'a, B: Backend> Issues<'a, B> {

        let progress = selected
            .map(|selected| {
-
                Table::<State, Action, B, IssueItem>::progress(
+
                Table::<B, State, Action, IssueItem>::progress(
                    selected,
                    props.issues.len(),
                    props.page_size,
@@ -455,7 +455,7 @@ impl<'a, B: Backend> Issues<'a, B> {
    }
}

-
impl<'a: 'static, B> Widget<State, Action, B> for Issues<'a, B>
+
impl<'a: 'static, B> Widget<B, State, Action> for Issues<'a, B>
where
    B: Backend + 'a,
{
@@ -561,7 +561,10 @@ impl<B: Backend> View<State, Action> for Search<B> {
    }
}

-
impl<B: Backend> Widget<State, Action, B> for Search<B> {
+
impl<B> Widget<B, State, Action> for Search<B>
+
where
+
    B: Backend,
+
{
    fn render(&self, frame: &mut ratatui::Frame, area: Rect, _props: &dyn Any) {
        let layout = Layout::horizontal(Constraint::from_mins([0]))
            .horizontal_margin(1)
@@ -793,7 +796,10 @@ impl<'a, B: Backend> View<State, Action> for Help<'a, B> {
    }
}

-
impl<'a: 'static, B: Backend> Widget<State, Action, B> for Help<'a, B> {
+
impl<'a: 'static, B> Widget<B, State, Action> for Help<'a, B>
+
where
+
    B: Backend,
+
{
    fn render(&self, frame: &mut ratatui::Frame, area: Rect, props: &dyn Any) {
        let props = props.downcast_ref::<HelpProps<'_>>().unwrap_or(&self.props);

modified bin/commands/patch/select/ui.rs
@@ -33,7 +33,7 @@ use crate::tui_patch::common::PatchOperation;

use super::{Action, State};

-
type BoxedWidget<B> = widget::BoxedWidget<State, Action, B>;
+
type BoxedWidget<B> = widget::BoxedWidget<B, State, Action>;

pub struct ListPageProps {
    show_search: bool,
@@ -132,7 +132,10 @@ impl<'a: 'static, B: Backend + 'a> View<State, Action> for ListPage<B> {
    }
}

-
impl<'a: 'static, B: Backend + 'a> Widget<State, Action, B> for ListPage<B> {
+
impl<'a: 'static, B> Widget<B, State, Action> for ListPage<B>
+
where
+
    B: Backend + 'a,
+
{
    fn render(&self, frame: &mut ratatui::Frame, _area: Rect, __props: &dyn Any) {
        let area = frame.size();
        let layout = tui::ui::layout::default_page(area, 0u16, 1u16);
@@ -248,7 +251,7 @@ where
        Self {
            action_tx: action_tx.clone(),
            props: props.clone(),
-
            table: Box::<Table<'_, State, Action, B, PatchItem>>::new(
+
            table: Box::<Table<B, State, Action, PatchItem>>::new(
                Table::new(state, action_tx.clone())
                    .header(
                        Header::new(state, action_tx.clone())
@@ -429,7 +432,7 @@ impl<'a, B: Backend> Patches<'a, B> {

        let progress = selected
            .map(|selected| {
-
                Table::<State, Action, B, PatchItem>::progress(
+
                Table::<B, State, Action, PatchItem>::progress(
                    selected,
                    props.patches.len(),
                    props.page_size,
@@ -483,7 +486,7 @@ impl<'a, B: Backend> Patches<'a, B> {
    }
}

-
impl<'a: 'static, B> Widget<State, Action, B> for Patches<'a, B>
+
impl<'a: 'static, B> Widget<B, State, Action> for Patches<'a, B>
where
    B: Backend + 'a,
{
@@ -589,7 +592,10 @@ impl<B: Backend> View<State, Action> for Search<B> {
    }
}

-
impl<B: Backend> Widget<State, Action, B> for Search<B> {
+
impl<B> Widget<B, State, Action> for Search<B>
+
where
+
    B: Backend,
+
{
    fn render(&self, frame: &mut ratatui::Frame, area: Rect, _props: &dyn Any) {
        let layout = Layout::horizontal(Constraint::from_mins([0]))
            .horizontal_margin(1)
@@ -829,7 +835,10 @@ impl<'a, B: Backend> View<State, Action> for Help<'a, B> {
    }
}

-
impl<'a: 'static, B: Backend> Widget<State, Action, B> for Help<'a, B> {
+
impl<'a: 'static, B> Widget<B, State, Action> for Help<'a, B>
+
where
+
    B: Backend,
+
{
    fn render(&self, frame: &mut ratatui::Frame, area: Rect, props: &dyn Any) {
        let props = props.downcast_ref::<HelpProps<'_>>().unwrap_or(&self.props);