Skip to content

Commit c06efe8

Browse files
committed
fix: empty checks + sidebar fixes
1 parent b20e4ac commit c06efe8

File tree

4 files changed

+28
-3
lines changed

4 files changed

+28
-3
lines changed

ui/components/prsidebar/checks.go

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,18 @@ func (m *Model) renderChecksOverview() string {
4141
}
4242

4343
box := lipgloss.NewStyle().Border(lipgloss.RoundedBorder()).BorderForeground(borderColor).Width(w)
44+
parts := make([]string, 0)
45+
if review != "" {
46+
parts = append(parts, review)
47+
}
48+
if checks != "" {
49+
parts = append(parts, checks)
50+
}
51+
if merge != "" {
52+
parts = append(parts, merge)
53+
}
4454

45-
return box.Render(lipgloss.JoinVertical(lipgloss.Left, review, checks, merge))
55+
return box.Render(lipgloss.JoinVertical(lipgloss.Left, parts...))
4656
}
4757

4858
func (m *Model) viewChecksStatus() (string, checkSectionStatus) {
@@ -214,6 +224,9 @@ func (m *Model) viewCheckCategory(icon, title, subtitle string, isLast bool) str
214224
if subtitle != "" {
215225
category = lipgloss.JoinVertical(lipgloss.Left, category, sSub.MarginLeft(2).Render(subtitle))
216226
}
227+
if category == "" {
228+
return ""
229+
}
217230
return part.Render(category)
218231
}
219232

ui/components/prsidebar/prsidebar.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ func (m *Model) renderDescription() string {
310310
desc,
311311
"",
312312
lipgloss.JoinHorizontal(lipgloss.Top,
313-
lipgloss.NewStyle().Foreground(m.ctx.Theme.FaintText).Render(lipgloss.NewStyle().Bold(true).Render("@"+m.pr.Data.Author.Login)),
313+
lipgloss.NewStyle().Foreground(m.ctx.Theme.PrimaryText).Render(lipgloss.NewStyle().Bold(true).Render("@"+m.pr.Data.Author.Login)),
314314
" ",
315315
lipgloss.NewStyle().Foreground(m.ctx.Theme.FaintText).Render("commented", time, "ago"),
316316
),
@@ -497,3 +497,7 @@ func (m *Model) prAssignees() []string {
497497
}
498498
return assignees
499499
}
500+
501+
func (m *Model) GoToFirstTab() {
502+
m.carousel.SetCursor(0)
503+
}

ui/context/styles.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,10 @@ func InitStyles(theme theme.Theme) Styles {
9797
Dark: "#3DF294",
9898
}
9999
s.Colors.OpenPR = s.Colors.OpenIssue
100-
s.Colors.ClosedPR = s.Colors.ClosedIssue
100+
s.Colors.ClosedPR = lipgloss.AdaptiveColor{
101+
Light: "#656C76",
102+
Dark: "#656C76",
103+
}
101104
s.Colors.MergedPR = lipgloss.AdaptiveColor{
102105
Light: "#A371F7",
103106
Dark: "#A371F7",

ui/ui.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,7 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
351351
cmds = append(cmds, m.openBrowser())
352352

353353
case key.Matches(msg, keys.PRKeys.Approve):
354+
m.prSidebar.GoToFirstTab()
354355
m.sidebar.IsOpen = true
355356
cmd = m.prSidebar.SetIsApproving(true)
356357
m.syncMainContentWidth()
@@ -359,6 +360,7 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
359360
return m, cmd
360361

361362
case key.Matches(msg, keys.PRKeys.Assign):
363+
m.prSidebar.GoToFirstTab()
362364
m.sidebar.IsOpen = true
363365
cmd = m.prSidebar.SetIsAssigning(true)
364366
m.syncMainContentWidth()
@@ -367,6 +369,7 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
367369
return m, cmd
368370

369371
case key.Matches(msg, keys.PRKeys.Unassign):
372+
m.prSidebar.GoToFirstTab()
370373
m.sidebar.IsOpen = true
371374
cmd = m.prSidebar.SetIsUnassigning(true)
372375
m.syncMainContentWidth()
@@ -375,6 +378,7 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
375378
return m, cmd
376379

377380
case key.Matches(msg, keys.PRKeys.Comment):
381+
m.prSidebar.GoToFirstTab()
378382
m.sidebar.IsOpen = true
379383
cmd = m.prSidebar.SetIsCommenting(true)
380384
m.syncMainContentWidth()
@@ -672,6 +676,7 @@ func (m *Model) setCurrSectionId(newSectionId int) {
672676
}
673677

674678
func (m *Model) onViewedRowChanged() tea.Cmd {
679+
m.prSidebar.GoToFirstTab()
675680
cmd := m.syncSidebar()
676681
m.sidebar.ScrollToTop()
677682
return cmd

0 commit comments

Comments
 (0)