Radish alpha
r
Radicle terminal user interface
Radicle
Git (anonymous pull)
Log in to clone via SSH
issue: Hide irrelevant footer blocks when filtered
Erik Kundt committed 2 years ago
commit b60cf27444931b3db82fc47f4b6dcd1310ba3bac
parent d6311bbe3b9bbcd389f50a20363f3ee6743d4433
1 file changed +50 -24
modified bin/commands/issue/flux/select/ui.rs
@@ -13,7 +13,7 @@ use ratatui::layout::{Constraint, Direction, Layout, Rect};

use radicle_tui as tui;

-
use tui::common::cob::issue::Filter;
+
use tui::common::cob::issue::{Filter, State};
use tui::flux::ui::cob::IssueItem;
use tui::flux::ui::span;
use tui::flux::ui::widget::container::{Footer, FooterProps, Header, HeaderProps};
@@ -369,29 +369,55 @@ impl Issues {
            .progress_percentage(self.props.issues.len(), self.props.page_size);
        let progress = span::default(format!("{}%", progress)).dim();

-
        self.footer.render::<B>(
-
            frame,
-
            area,
-
            FooterProps {
-
                cells: [
-
                    filter.into(),
-
                    open.clone().into(),
-
                    closed.clone().into(),
-
                    sum.clone().into(),
-
                    progress.clone().into(),
-
                ],
-
                widths: [
-
                    Constraint::Fill(1),
-
                    Constraint::Min(open.width() as u16),
-
                    Constraint::Min(closed.width() as u16),
-
                    Constraint::Min(sum.width() as u16),
-
                    Constraint::Min(4),
-
                ],
-
                focus: self.props.focus,
-
                cutoff: self.props.cutoff,
-
                cutoff_after: self.props.cutoff_after,
-
            },
-
        );
+
        match self.props.filter.state() {
+
            Some(state) => {
+
                let block = match state {
+
                    State::Open => open,
+
                    State::Closed | State::Solved => closed,
+
                };
+

+
                self.footer.render::<B>(
+
                    frame,
+
                    area,
+
                    FooterProps {
+
                        cells: [filter.into(), block.clone().into(), progress.clone().into()],
+
                        widths: [
+
                            Constraint::Fill(1),
+
                            Constraint::Min(block.width() as u16),
+
                            Constraint::Min(4),
+
                        ],
+
                        focus: self.props.focus,
+
                        cutoff: self.props.cutoff,
+
                        cutoff_after: self.props.cutoff_after,
+
                    },
+
                );
+
            }
+
            None => {
+
                self.footer.render::<B>(
+
                    frame,
+
                    area,
+
                    FooterProps {
+
                        cells: [
+
                            filter.into(),
+
                            open.clone().into(),
+
                            closed.clone().into(),
+
                            sum.clone().into(),
+
                            progress.clone().into(),
+
                        ],
+
                        widths: [
+
                            Constraint::Fill(1),
+
                            Constraint::Min(open.width() as u16),
+
                            Constraint::Min(closed.width() as u16),
+
                            Constraint::Min(sum.width() as u16),
+
                            Constraint::Min(4),
+
                        ],
+
                        focus: self.props.focus,
+
                        cutoff: self.props.cutoff,
+
                        cutoff_after: self.props.cutoff_after,
+
                    },
+
                );
+
            }
+
        }
    }
}