Skip to content

Commit

Permalink
feat: show merge status
Browse files Browse the repository at this point in the history
  • Loading branch information
dlvhdr committed Feb 22, 2025
1 parent 400a01e commit 313d504
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
8 changes: 7 additions & 1 deletion ui/common/styles.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ type CommonStyles struct {
WaitingGlyph string
FailureGlyph string
SuccessGlyph string
MergedGlyph string
CommentGlyph string
}

Expand Down Expand Up @@ -61,6 +62,11 @@ func BuildStyles(theme theme.Theme) CommonStyles {
s.DraftGlyph = lipgloss.NewStyle().
Foreground(theme.PrimaryText).
Render(constants.DraftIcon)

s.MergedGlyph = lipgloss.NewStyle().
Foreground(lipgloss.AdaptiveColor{
Light: "#A371F7",
Dark: "#A371F7",
}).
Render(constants.MergedIcon)
return s
}
18 changes: 18 additions & 0 deletions ui/components/prsidebar/checks.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ func (m *Model) renderChecks() string {
header := m.ctx.Styles.Common.MainTextStyle.MarginBottom(1).Underline(true).Render(" Checks")
w := m.getIndentedContentWidth()

if m.pr.Data.State == "MERGED" {
return lipgloss.JoinVertical(lipgloss.Left,
header,
m.viewMergedStatus(),
)
}

review, rStatus := m.viewReviewStatus()
checks, cStatus := m.viewChecksStatus()
merge, mStatus := m.viewMergeStatus()
Expand Down Expand Up @@ -115,6 +122,17 @@ func (m *Model) viewMergeStatus() (string, checkSectionStatus) {
return m.viewCheckCategory(icon, title, subtitle, true), status
}

func (m *Model) viewMergedStatus() string {
w := m.getIndentedContentWidth()
box := lipgloss.NewStyle().Border(lipgloss.RoundedBorder()).BorderForeground(m.ctx.Styles.Colors.MergedPR).Width(w)
return box.Render(m.viewCheckCategory(
m.ctx.Styles.Common.MergedGlyph,
"Pull request successfully merged and closed",
"The branch has been merged",
true,
))
}

func (m *Model) viewReviewStatus() (string, checkSectionStatus) {
pr := m.pr
if pr.Data == nil {
Expand Down

0 comments on commit 313d504

Please sign in to comment.