mirror of
https://seed.radicle.dev/rad:z39mP9rQAaGmERfUMPULfPUi473tY.git
synced 2026-11-15 16:00:38 +08:00
bin: Use trait for properties
This commit is contained in:
@@ -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>,
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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>,
|
||||
|
||||
Reference in New Issue
Block a user