Radish alpha
r
Radicle terminal user interface
Radicle
Git (anonymous pull)
Log in to clone via SSH
bin: Adjust to new table column display
Erik Kundt committed 1 year ago
commit 0954d14a00c8112cc77e39fd4c289a578b45772f
parent 68a4a82165d765e72e48048e1e34fb888fe9ec81
3 files changed +25 -49
modified bin/commands/inbox/select/ui.rs
@@ -45,10 +45,6 @@ pub struct BrowserProps<'a> {
    stats: HashMap<String, usize>,
    /// Table columns
    columns: Vec<Column<'a>>,
-
    /// Max. width, before columns are cut-off.
-
    cutoff: usize,
-
    /// Column index that marks where to cut.
-
    cutoff_after: usize,
    /// Current page size (height of table content).
    page_size: usize,
    /// If search widget should be shown.
@@ -90,16 +86,14 @@ impl<'a> From<&State> for BrowserProps<'a> {
                Column::new("", Constraint::Length(3)),
                Column::new("", Constraint::Length(15))
                    .skip(*state.mode.repository() != RepositoryMode::All),
-
                Column::new("", Constraint::Length(25)),
+
                Column::new("", Constraint::Length(25)).hide_small(),
                Column::new("", Constraint::Fill(1)),
                Column::new("", Constraint::Length(8)),
                Column::new("", Constraint::Length(10)),
-
                Column::new("", Constraint::Length(15)),
-
                Column::new("", Constraint::Length(18)),
+
                Column::new("", Constraint::Length(15)).hide_small(),
+
                Column::new("", Constraint::Length(18)).hide_small(),
            ]
            .to_vec(),
-
            cutoff: 200,
-
            cutoff_after: 5,
            page_size: state.browser.page_size,
            search: state.browser.search.read(),
            show_search: state.browser.show_search,
@@ -129,7 +123,6 @@ impl Browser {
                            ]
                            .to_vec(),
                        )
-
                        .cutoff(props.cutoff, props.cutoff_after)
                        .to_boxed_any()
                        .into()
                }))
@@ -150,7 +143,6 @@ impl Browser {
                                .selected(state.browser.selected)
                                .footer(!state.browser.show_search)
                                .page_size(state.browser.page_size)
-
                                .cutoff(props.cutoff, props.cutoff_after)
                                .to_boxed_any()
                                .into()
                        }),
modified bin/commands/issue/select/ui.rs
@@ -49,10 +49,6 @@ pub struct BrowserProps<'a> {
    header: Vec<Column<'a>>,
    /// Table columns
    columns: Vec<Column<'a>>,
-
    /// Max. width, before columns are cut-off.
-
    cutoff: usize,
-
    /// Column index that marks where to cut.
-
    cutoff_after: usize,
    /// Current page size (height of table content).
    page_size: usize,
    /// If search widget should be shown.
@@ -101,26 +97,24 @@ impl<'a> From<&State> for BrowserProps<'a> {
                Column::new(" ● ", Constraint::Length(3)),
                Column::new("ID", Constraint::Length(8)),
                Column::new("Title", Constraint::Fill(5)),
-
                Column::new("Author", Constraint::Length(16)),
-
                Column::new("", Constraint::Length(16)),
-
                Column::new("Labels", Constraint::Fill(1)),
-
                Column::new("Assignees", Constraint::Fill(1)),
-
                Column::new("Opened", Constraint::Length(16)),
+
                Column::new("Author", Constraint::Length(16)).hide_small(),
+
                Column::new("", Constraint::Length(16)).hide_medium(),
+
                Column::new("Labels", Constraint::Fill(1)).hide_medium(),
+
                Column::new("Assignees", Constraint::Fill(1)).hide_medium(),
+
                Column::new("Opened", Constraint::Length(16)).hide_small(),
            ]
            .to_vec(),
            columns: [
                Column::new(" ● ", Constraint::Length(3)),
                Column::new("ID", Constraint::Length(8)),
                Column::new("Title", Constraint::Fill(5)),
-
                Column::new("Author", Constraint::Length(16)),
-
                Column::new("", Constraint::Length(16)),
-
                Column::new("Labels", Constraint::Fill(1)),
-
                Column::new("Assignees", Constraint::Fill(1)),
-
                Column::new("Opened", Constraint::Length(16)),
+
                Column::new("Author", Constraint::Length(16)).hide_small(),
+
                Column::new("", Constraint::Length(16)).hide_medium(),
+
                Column::new("Labels", Constraint::Fill(1)).hide_medium(),
+
                Column::new("Assignees", Constraint::Fill(1)).hide_medium(),
+
                Column::new("Opened", Constraint::Length(16)).hide_small(),
            ]
            .to_vec(),
-
            cutoff: 200,
-
            cutoff_after: 5,
            page_size: state.browser.page_size,
            search: state.browser.search.read(),
            show_search: state.browser.show_search,
@@ -144,7 +138,6 @@ impl Browser {
                    let props = BrowserProps::from(state);
                    HeaderProps::default()
                        .columns(props.header.clone())
-
                        .cutoff(props.cutoff, props.cutoff_after)
                        .to_boxed_any()
                        .into()
                }))
@@ -165,7 +158,6 @@ impl Browser {
                                .selected(state.browser.selected)
                                .footer(!state.browser.show_search)
                                .page_size(state.browser.page_size)
-
                                .cutoff(props.cutoff, props.cutoff_after)
                                .to_boxed_any()
                                .into()
                        }),
modified bin/commands/patch/select/ui.rs
@@ -51,10 +51,6 @@ pub struct BrowserProps<'a> {
    header: Vec<Column<'a>>,
    /// Table columns
    columns: Vec<Column<'a>>,
-
    /// Max. width, before columns are cut-off.
-
    cutoff: usize,
-
    /// Column index that marks where to cut.
-
    cutoff_after: usize,
    /// Current page size (height of table content).
    page_size: usize,
    /// If search widget should be shown.
@@ -100,28 +96,26 @@ impl<'a> From<&State> for BrowserProps<'a> {
                Column::new(" ● ", Constraint::Length(3)),
                Column::new("ID", Constraint::Length(8)),
                Column::new("Title", Constraint::Fill(1)),
-
                Column::new("Author", Constraint::Length(16)),
-
                Column::new("", Constraint::Length(16)),
-
                Column::new("Head", Constraint::Length(8)),
-
                Column::new("+", Constraint::Length(6)),
-
                Column::new("-", Constraint::Length(6)),
-
                Column::new("Updated", Constraint::Length(16)),
+
                Column::new("Author", Constraint::Length(16)).hide_small(),
+
                Column::new("", Constraint::Length(16)).hide_medium(),
+
                Column::new("Head", Constraint::Length(8)).hide_small(),
+
                Column::new("+", Constraint::Length(6)).hide_small(),
+
                Column::new("-", Constraint::Length(6)).hide_small(),
+
                Column::new("Updated", Constraint::Length(16)).hide_small(),
            ]
            .to_vec(),
            columns: [
                Column::new(" ● ", Constraint::Length(3)),
                Column::new("ID", Constraint::Length(8)),
                Column::new("Title", Constraint::Fill(1)),
-
                Column::new("Author", Constraint::Length(16)),
-
                Column::new("", Constraint::Length(16)),
-
                Column::new("Head", Constraint::Length(8)),
-
                Column::new("+", Constraint::Length(6)),
-
                Column::new("-", Constraint::Length(6)),
-
                Column::new("Updated", Constraint::Length(16)),
+
                Column::new("Author", Constraint::Length(16)).hide_small(),
+
                Column::new("", Constraint::Length(16)).hide_medium(),
+
                Column::new("Head", Constraint::Length(8)).hide_small(),
+
                Column::new("+", Constraint::Length(6)).hide_small(),
+
                Column::new("-", Constraint::Length(6)).hide_small(),
+
                Column::new("Updated", Constraint::Length(16)).hide_small(),
            ]
            .to_vec(),
-
            cutoff: 150,
-
            cutoff_after: 5,
            page_size: state.browser.page_size,
            show_search: state.browser.show_search,
            search: state.browser.search.read(),
@@ -145,7 +139,6 @@ impl Browser {
                    let props = BrowserProps::from(state);
                    HeaderProps::default()
                        .columns(props.header.clone())
-
                        .cutoff(props.cutoff, props.cutoff_after)
                        .to_boxed_any()
                        .into()
                }))
@@ -166,7 +159,6 @@ impl Browser {
                                .selected(state.browser.selected)
                                .footer(!state.browser.show_search)
                                .page_size(state.browser.page_size)
-
                                .cutoff(props.cutoff, props.cutoff_after)
                                .to_boxed_any()
                                .into()
                        }),