diff --git a/bin/commands/issue/suite/ui.rs b/bin/commands/issue/suite/ui.rs index 0600c8ea..594bc5bd 100644 --- a/bin/commands/issue/suite/ui.rs +++ b/bin/commands/issue/suite/ui.rs @@ -177,10 +177,16 @@ impl IssueHeader { tui::ui::label(item.title()).foreground(theme.colors.browser_list_title), ); + let author = match alias { + Some(_) => tui::ui::label(&cob::format_author(issue.author().id(), &alias, by_you)) + .foreground(theme.colors.browser_list_author), + None => tui::ui::label(&cob::format_author(issue.author().id(), &alias, by_you)) + .foreground(theme.colors.browser_list_author) + .dim(), + }; let author = Property::new( tui::ui::label("Author").foreground(theme.colors.property_name_fg), - tui::ui::label(&cob::format_author(issue.author().id(), &alias, by_you)) - .foreground(theme.colors.browser_list_author), + author, ); let issue_id = Property::new( diff --git a/src/ui/cob.rs b/src/ui/cob.rs index bee1a0ff..e721b943 100644 --- a/src/ui/cob.rs +++ b/src/ui/cob.rs @@ -2,7 +2,7 @@ pub mod format; use radicle_surf; -use tuirealm::props::{Color, Style}; +use tuirealm::props::{Color, Style, TextModifiers}; use tuirealm::tui::text::{Span, Spans}; use tuirealm::tui::widgets::Cell; @@ -152,12 +152,18 @@ impl TableItem<8> for PatchItem { let title = Cell::from(self.title.clone()) .style(Style::default().fg(theme.colors.browser_list_title)); + let author_style = match &self.author.alias { + Some(_) => Style::default().fg(theme.colors.browser_list_author), + None => Style::default() + .fg(theme.colors.browser_list_author) + .add_modifier(TextModifiers::DIM), + }; let author = Cell::from(format_author( &self.author.did, &self.author.alias, self.author.is_you, )) - .style(Style::default().fg(theme.colors.browser_list_author)); + .style(author_style); let head = Cell::from(format::oid(self.head)) .style(Style::default().fg(theme.colors.browser_patch_list_head)); @@ -266,12 +272,18 @@ impl TableItem<7> for IssueItem { let title = Cell::from(self.title.clone()) .style(Style::default().fg(theme.colors.browser_list_title)); + let author_style = match &self.author.alias { + Some(_) => Style::default().fg(theme.colors.browser_list_author), + None => Style::default() + .fg(theme.colors.browser_list_author) + .add_modifier(TextModifiers::DIM), + }; let author = Cell::from(format_author( &self.author.did, &self.author.alias, self.author.is_you, )) - .style(Style::default().fg(theme.colors.browser_list_author)); + .style(author_style); let labels = Cell::from(format_labels(&self.labels)) .style(Style::default().fg(theme.colors.browser_list_labels)); @@ -294,6 +306,12 @@ impl TableItem<7> for IssueItem { impl ListItem for IssueItem { fn row(&self, theme: &Theme) -> tuirealm::tui::widgets::ListItem { let (state, state_color) = format_issue_state(&self.state); + let author_style = match &self.author.alias { + Some(_) => Style::default().fg(theme.colors.browser_list_author), + None => Style::default() + .fg(theme.colors.browser_list_author) + .add_modifier(TextModifiers::DIM), + }; let lines = vec![ Spans::from(vec![ Span::styled(state, Style::default().fg(state_color)), @@ -306,7 +324,7 @@ impl ListItem for IssueItem { Span::raw(String::from(" ")), Span::styled( format_author(&self.author.did, &self.author.alias, self.author.is_you), - Style::default().fg(theme.colors.browser_list_author), + author_style, ), Span::styled( format!(" {} ", theme.icons.property_divider), diff --git a/src/ui/widget.rs b/src/ui/widget.rs index a5aa34bd..f677a5c6 100644 --- a/src/ui/widget.rs +++ b/src/ui/widget.rs @@ -8,7 +8,7 @@ mod utils; use std::ops::Deref; use tuirealm::command::{Cmd, CmdResult}; -use tuirealm::props::{AttrValue, Attribute, Color, Layout, Props}; +use tuirealm::props::{AttrValue, Attribute, Color, Layout, Props, TextModifiers}; use tuirealm::tui::layout::Rect; use tuirealm::{Frame, MockComponent, State}; @@ -49,6 +49,18 @@ impl Widget { self } + pub fn dim(mut self) -> Self { + let props = self + .query(Attribute::TextProps) + .unwrap_or(AttrValue::TextModifiers(TextModifiers::empty())); + + self.attr( + Attribute::TextProps, + AttrValue::TextModifiers(props.unwrap_text_modifiers() | TextModifiers::DIM), + ); + self + } + pub fn highlight(mut self, fg: Color) -> Self { self.attr(Attribute::HighlightedColor, AttrValue::Color(fg)); self