Radish alpha
r
Radicle terminal user interface
Radicle
Git (anonymous pull)
Log in to clone via SSH
bin: Improve issue select theming
Erik Kundt committed 1 year ago
commit 8d9bc1645ff2078ea9e80096c2f07de6f3686e07
parent 03daadabada65fed742b151172d9e8b39cbe5314
4 files changed +32 -15
modified bin/commands/issue/select.rs
@@ -294,7 +294,7 @@ impl TryFrom<(&Context, &TerminalInfo)> for State {
                show_search: false,
            },
            preview: PreviewState {
-
                show: false,
+
                show: true,
                issue: items.first().cloned(),
                selected_comments,
                comment: CommentState { cursor: (0, 0) },
@@ -492,7 +492,7 @@ fn browser_page(channel: &Channel<Message>) -> Widget<State, Message> {
                if state.section == Some(Section::Browser) {
                    shortcuts = [shortcuts, [("/", "search")].to_vec()].concat()
                }
-
                [shortcuts, [("p", "preview"), ("?", "help")].to_vec()].concat()
+
                [shortcuts, [("p", "toggle preview"), ("?", "help")].to_vec()].concat()
            };

            ShortcutsProps::default()
@@ -579,8 +579,8 @@ fn issue(channel: &Channel<Message>) -> Widget<State, Message> {
        .on_update(|state| {
            SplitContainerProps::default()
                .heights([Constraint::Length(5), Constraint::Min(1)])
-
                .border_color(state.theme.border_color)
-
                .focus_border_color(state.theme.focus_border_color)
+
                .border_style(state.theme.border_style)
+
                .focus_border_style(state.theme.focus_border_style)
                .split_focus(SplitContainerFocus::Bottom)
                .to_boxed_any()
                .into()
@@ -595,6 +595,7 @@ fn issue_details(channel: &Channel<Message>) -> Widget<State, Message> {
        .on_update(|state: &State| {
            IssueDetailsProps::default()
                .issue(state.preview.issue.clone())
+
                .dim(state.theme.dim_no_focus)
                .to_boxed_any()
                .into()
        })
@@ -622,6 +623,7 @@ fn comment_tree(channel: &Channel<Message>) -> Widget<State, Message> {
                .items(root.to_vec())
                .selected(Some(selected))
                .opened(Some(opened.clone()))
+
                .dim(state.theme.dim_no_focus)
                .to_boxed_any()
                .into()
        })
@@ -666,6 +668,7 @@ fn comment(channel: &Channel<Message>) -> Widget<State, Message> {
                        .footer(Some(reactions))
                        .cursor(state.preview.comment.cursor)
                        .show_scroll_progress(true)
+
                        .dim(state.theme.dim_no_focus)
                        .to_boxed_any()
                        .into()
                }),
@@ -673,8 +676,8 @@ fn comment(channel: &Channel<Message>) -> Widget<State, Message> {
        .to_widget(tx.clone())
        .on_update(|state| {
            ContainerProps::default()
-
                .border_color(state.theme.border_color)
-
                .focus_border_color(state.theme.focus_border_color)
+
                .border_style(state.theme.border_style)
+
                .focus_border_style(state.theme.focus_border_style)
                .to_boxed_any()
                .into()
        })
@@ -705,6 +708,7 @@ fn help_page(channel: &Channel<Message>) -> Widget<State, Message> {
                    TextViewProps::default()
                        .content(help_text())
                        .cursor(state.help.cursor)
+
                        .dim(state.theme.dim_no_focus)
                        .to_boxed_any()
                        .into()
                }),
@@ -731,8 +735,8 @@ fn help_page(channel: &Channel<Message>) -> Widget<State, Message> {
        .to_widget(tx.clone())
        .on_update(|state| {
            ContainerProps::default()
-
                .border_color(state.theme.border_color)
-
                .focus_border_color(state.theme.focus_border_color)
+
                .border_style(state.theme.border_style)
+
                .focus_border_style(state.theme.focus_border_style)
                .to_boxed_any()
                .into()
        });
modified bin/commands/issue/select/ui.rs
@@ -127,8 +127,8 @@ impl Browser {

                    HeaderProps::default()
                        .columns(props.header.clone())
-
                        .border_color(state.theme.border_color)
-
                        .focus_border_color(state.theme.focus_border_color)
+
                        .border_style(state.theme.border_style)
+
                        .focus_border_style(state.theme.focus_border_style)
                        .to_boxed_any()
                        .into()
                }))
@@ -149,6 +149,7 @@ impl Browser {
                                .columns(props.columns)
                                .items(state.browser.issues())
                                .selected(state.browser.selected)
+
                                .dim(state.theme.dim_no_focus)
                                .to_boxed_any()
                                .into()
                        }),
@@ -158,16 +159,16 @@ impl Browser {

                    FooterProps::default()
                        .columns(browse_footer(&props))
-
                        .border_color(state.theme.border_color)
-
                        .focus_border_color(state.theme.focus_border_color)
+
                        .border_style(state.theme.border_style)
+
                        .focus_border_style(state.theme.focus_border_style)
                        .to_boxed_any()
                        .into()
                }))
                .to_widget(tx.clone())
                .on_update(|state| {
                    ContainerProps::default()
-
                        .border_color(state.theme.border_color)
-
                        .focus_border_color(state.theme.focus_border_color)
+
                        .border_style(state.theme.border_style)
+
                        .focus_border_style(state.theme.focus_border_style)
                        .hide_footer(BrowserProps::from(state).show_search)
                        .to_boxed_any()
                        .into()
modified bin/main.rs
@@ -1,8 +1,8 @@
mod cob;
mod commands;
mod git;
-
mod ui;
mod settings;
+
mod ui;

use std::ffi::OsString;
use std::io;
modified bin/ui/widget.rs
@@ -19,6 +19,7 @@ use super::items::IssueItem;
#[derive(Clone, Default)]
pub struct IssueDetailsProps {
    issue: Option<IssueItem>,
+
    dim: bool,
}

impl IssueDetailsProps {
@@ -26,6 +27,11 @@ impl IssueDetailsProps {
        self.issue = issue;
        self
    }
+

+
    pub fn dim(mut self, dim: bool) -> Self {
+
        self.dim = dim;
+
        self
+
    }
}

pub struct IssueDetails<S, M> {
@@ -120,6 +126,12 @@ impl<S, M> View for IssueDetails<S, M> {
                [Constraint::Length(8), Constraint::Fill(1)],
            );

+
            let table = if !render.focus && props.dim {
+
                table.dim()
+
            } else {
+
                table
+
            };
+

            frame.render_widget(table, area);
        } else {
            let center = layout::centered_rect(render.area, 50, 10);