From 87084844d2d8780cc26a775b8472dcb3d5556dc2 Mon Sep 17 00:00:00 2001 From: Dolev Hadar <6196971+dlvhdr@users.noreply.github.com> Date: Wed, 25 Sep 2024 19:51:04 +0300 Subject: [PATCH] fix: new layout - hide base if hidden (#456) * fix: new layout - hide base if hidden * fix: invert if branch --- ui/components/pr/pr.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ui/components/pr/pr.go b/ui/components/pr/pr.go index b33e7b4c..82b05395 100644 --- a/ui/components/pr/pr.go +++ b/ui/components/pr/pr.go @@ -191,10 +191,13 @@ func (pr *PullRequest) renderExtendedTitle(isSelected bool) string { baseStyle = baseStyle.Foreground(pr.Ctx.Theme.SecondaryText).Background(pr.Ctx.Theme.SelectedBackground) } - repoName := baseStyle.Render(lipgloss.JoinHorizontal(lipgloss.Top, pr.Data.Repository.NameWithOwner, fmt.Sprintf(" #%d", pr.Data.Number))) author := baseStyle.Render(fmt.Sprintf("@%s", pr.Data.Author.Login)) - branch := baseStyle.Render(pr.Data.HeadRefName) - top := lipgloss.JoinHorizontal(lipgloss.Top, repoName, baseStyle.Render(" · "), branch, baseStyle.Render(" · "), author) + top := lipgloss.JoinHorizontal(lipgloss.Top, pr.Data.Repository.NameWithOwner, fmt.Sprintf(" #%d by %s", pr.Data.Number, author)) + branchHidden := pr.Ctx.Config.Defaults.Layout.Prs.Base.Hidden + if branchHidden == nil || !*branchHidden { + branch := baseStyle.Render(pr.Data.HeadRefName) + top = lipgloss.JoinHorizontal(lipgloss.Top, top, baseStyle.Render(" · "), branch) + } title := pr.Data.Title var titleColumn table.Column for _, column := range pr.Columns {