From b66b44fe15aa71d7edb9df0f73992971960dcd2c Mon Sep 17 00:00:00 2001 From: Erik Kundt Date: Wed, 12 Jul 2023 11:13:01 +0200 Subject: [PATCH] Complete issue detail header --- src/ui/widget/issue.rs | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/ui/widget/issue.rs b/src/ui/widget/issue.rs index 6720a565..ec7994ca 100644 --- a/src/ui/widget/issue.rs +++ b/src/ui/widget/issue.rs @@ -89,13 +89,25 @@ impl IssueHeader { let repo = context.repository(); let (id, issue) = issue; - let item = IssueItem::from((context.profile(), repo, id, issue)); + let by_you = *issue.author().id() == context.profile().did(); + let item = IssueItem::from((context.profile(), repo, id, issue.clone())); let title = Property::new( common::label("Title").foreground(theme.colors.property_name_fg), common::label(item.title()).foreground(theme.colors.browser_list_title), ); + let author = Property::new( + common::label("Author").foreground(theme.colors.property_name_fg), + common::label(&cob::format_author(issue.author().id(), by_you)) + .foreground(theme.colors.browser_list_author), + ); + + let issue_id = Property::new( + common::label("Issue").foreground(theme.colors.property_name_fg), + common::label(&id.to_string()).foreground(theme.colors.browser_list_description), + ); + let tags = Property::new( common::label("Tags").foreground(theme.colors.property_name_fg), common::label(&cob::format_tags(item.tags())) @@ -119,11 +131,12 @@ impl IssueHeader { common::label(&item.state().to_string()).foreground(theme.colors.browser_list_title), ); - // let table = common::property_table(theme, vec![title, tags, assignees, state]); let table = common::property_table( theme, vec![ Widget::new(title), + Widget::new(issue_id), + Widget::new(author), Widget::new(tags), Widget::new(assignees), Widget::new(state), @@ -175,7 +188,7 @@ impl WidgetComponent for IssueDetails { .unwrap_flag(); let layout = Layout::default() .direction(Direction::Vertical) - .constraints([Constraint::Length(6), Constraint::Min(1)]) + .constraints([Constraint::Length(8), Constraint::Min(1)]) .split(area); self.header.view(frame, layout[0]);