mirror of
https://seed.radicle.dev/rad:z39mP9rQAaGmERfUMPULfPUi473tY.git
synced 2026-11-11 22:20:45 +08:00
bin: Improve issue select theming
This commit is contained in:
@@ -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()
|
||||
});
|
||||
|
||||
@@ -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()
|
||||
|
||||
+1
-1
@@ -1,8 +1,8 @@
|
||||
mod cob;
|
||||
mod commands;
|
||||
mod git;
|
||||
mod ui;
|
||||
mod settings;
|
||||
mod ui;
|
||||
|
||||
use std::ffi::OsString;
|
||||
use std::io;
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user