Skip to content

Commit 9e38159

Browse files
committed
feat(tui): optimize details layout and catalog tab click coordinates
1 parent 165ad55 commit 9e38159

2 files changed

Lines changed: 23 additions & 10 deletions

File tree

go/tui/tui.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,24 @@ func (m *TuiModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
158158
m.statusMsg = "Logs cleared."
159159
return m, nil
160160
}
161+
if msg.Y == 10 {
162+
if msg.X <= 13 {
163+
m.activeTab, m.selectedIndex, m.scrollOffset = 0, 0, 0
164+
return m, nil
165+
}
166+
if msg.X >= 14 && msg.X <= 22 {
167+
m.activeTab, m.selectedIndex, m.scrollOffset = 1, 0, 0
168+
return m, nil
169+
}
170+
if msg.X >= 23 && msg.X <= 34 {
171+
m.activeTab, m.selectedIndex, m.scrollOffset = 2, 0, 0
172+
return m, nil
173+
}
174+
if msg.X >= 35 {
175+
m.activeTab, m.selectedIndex, m.scrollOffset = 3, 0, 0
176+
return m, nil
177+
}
178+
}
161179
}
162180
return m, nil
163181

go/tui/view.go

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ func (m *TuiModel) View() string {
2222
if h < 11 {
2323
h = 11
2424
}
25-
h = h - 1 // Safety margin of 1 line at the bottom to prevent scrolling
25+
// h = h - 1 // Safety margin of 1 line at the bottom to prevent scrolling
2626

2727
showRightPanel := w >= 120
2828

2929
// Heights
3030
topH := 9 // top panels row (with borders = 9 rows)
31-
barH := 5 // status bar: 3 blank lines + line1 + line2 = 5 rows
31+
barH := 4 // status bar: 1 blank line + line1 + line2 = 4 rows
3232
// catalog gets the remaining height
3333
catalogH := h - topH - barH
3434
if catalogH < 4 {
@@ -69,7 +69,7 @@ func (m *TuiModel) View() string {
6969
}
7070
baseStyle := lipgloss.NewStyle().Foreground(colorWhite).Bold(true)
7171
styledBase := baseStyle.Render(baseTitle)
72-
clearBtn := lipgloss.NewStyle().Foreground(colorAccent).Bold(true).Render("[Clear]")
72+
clearBtn := lipgloss.NewStyle().Foreground(colorAccent).Bold(true).Render("[clear]")
7373
rightPanelTitle := styledBase + " " + clearBtn
7474

7575
rightPanel = drawPanel(rightW, h-barH, rightPanelTitle, logContent, false)
@@ -470,10 +470,6 @@ func (m *TuiModel) renderDetailRow(items []bridge.CatalogEntry) string {
470470
if item.Stars > 0 {
471471
stars = fmt.Sprintf("★ %d", item.Stars)
472472
}
473-
desc := "No description provided."
474-
if item.Description != "" {
475-
desc = item.Description
476-
}
477473

478474
var status string
479475
if item.Installed {
@@ -495,7 +491,6 @@ func (m *TuiModel) renderDetailRow(items []bridge.CatalogEntry) string {
495491
" " + mutedStyle.Render("Stars:") + " " + boldStyle.Render(stars),
496492
" " + mutedStyle.Render("Status:") + " " + status,
497493
" " + mutedStyle.Render("Type:") + " " + boldStyle.Render(kind),
498-
" " + mutedStyle.Render("—") + " " + mutedStyle.Render(desc),
499494
}
500495

501496
return " " + strings.Join(parts, " ")
@@ -752,8 +747,8 @@ func (m *TuiModel) renderStatusBar(w int) string {
752747
line2Raw = truncate(line2Raw, w)
753748
}
754749

755-
// Always return exactly 5 lines: 3 blank + line1 + line2
756-
return "\n\n\n" + line1Raw + "\n" + line2Raw
750+
// Always return exactly 4 lines: 1 blank + line1 + line2
751+
return "\n\n" + line1Raw + "\n" + line2Raw
757752
}
758753

759754
func (m *TuiModel) getActiveItems() []bridge.CatalogEntry {

0 commit comments

Comments
 (0)