Radish alpha
r
Radicle terminal user interface
Radicle
Git (anonymous pull)
Log in to clone via SSH
bin: Use trait for properties
Erik Kundt committed 2 years ago
commit 4f29b65060aa9c23fefe4a8eebdc4cdf5ae69464
parent ab6584f6b7305903d047df1d5691802261f0207e
3 files changed +16 -9
modified bin/commands/inbox/select/ui.rs
@@ -20,8 +20,8 @@ use tui::ui::widget::input::{TextField, TextFieldProps};
use tui::ui::widget::text::{Paragraph, ParagraphProps};
use tui::ui::widget::{self, TableUtils};
use tui::ui::widget::{
-
    Column, EventCallback, Shortcuts, ShortcutsProps, Table, TableProps, UpdateCallback, View,
-
    Widget,
+
    Column, EventCallback, Properties, Shortcuts, ShortcutsProps, Table, TableProps,
+
    UpdateCallback, View, Widget,
};
use tui::Selection;

@@ -214,6 +214,8 @@ impl<'a> From<&State> for NotificationsProps<'a> {
    }
}

+
impl<'a> Properties for NotificationsProps<'a> {}
+

struct Notifications<'a, B: Backend> {
    /// Internal properties
    props: NotificationsProps<'a>,
@@ -273,14 +275,13 @@ where
                    .on_update(|state| {
                        let props = NotificationsProps::from(state);

-
                        Box::<TableProps<'_, NotificationItem>>::new(
                            TableProps::default()
                                .columns(props.columns)
                                .items(state.notifications())
                                .footer(!state.ui.show_search)
                                .page_size(state.ui.page_size)
-
                                .cutoff(props.cutoff, props.cutoff_after),
-
                        )
+
                            .cutoff(props.cutoff, props.cutoff_after)
+
                            .to_boxed()
                    }),
            ),
            footer: Footer::new(state, action_tx).to_boxed(),
@@ -689,6 +690,8 @@ impl<'a> From<&State> for HelpProps<'a> {
    }
}

+
impl<'a> Properties for HelpProps<'a> {}
+

pub struct Help<'a, B: Backend> {
    /// Internal properties
    props: HelpProps<'a>,
modified bin/commands/issue/select/ui.rs
@@ -22,8 +22,8 @@ use tui::ui::widget::input::{TextField, TextFieldProps};
use tui::ui::widget::text::{Paragraph, ParagraphProps};
use tui::ui::widget::{self, TableUtils};
use tui::ui::widget::{
-
    Column, EventCallback, Shortcuts, ShortcutsProps, Table, TableProps, UpdateCallback, View,
-
    Widget,
+
    Column, EventCallback, Properties, Shortcuts, ShortcutsProps, Table, TableProps,
+
    UpdateCallback, View, Widget,
};
use tui::Selection;

modified bin/commands/patch/select/ui.rs
@@ -23,8 +23,8 @@ use tui::ui::widget::input::{TextField, TextFieldProps};
use tui::ui::widget::text::{Paragraph, ParagraphProps};
use tui::ui::widget::{self, TableUtils};
use tui::ui::widget::{
-
    Column, EventCallback, Shortcuts, ShortcutsProps, Table, TableProps, UpdateCallback, View,
-
    Widget,
+
    Column, EventCallback, Properties, Shortcuts, ShortcutsProps, Table, TableProps,
+
    UpdateCallback, View, Widget,
};
use tui::Selection;

@@ -228,6 +228,8 @@ impl<'a> From<&State> for PatchesProps<'a> {
    }
}

+
impl<'a> Properties for PatchesProps<'a> {}
+

struct Patches<'a, B> {
    /// Internal properties
    props: PatchesProps<'a>,
@@ -750,6 +752,8 @@ impl<'a> From<&State> for HelpProps<'a> {
    }
}

+
impl<'a> Properties for HelpProps<'a> {}
+

pub struct Help<'a, B: Backend> {
    /// Internal properties
    props: HelpProps<'a>,