Skip to content

Commit fe58dba

Browse files
committed
feat(tui): swap tags and title column order in list view
Move title before tags for better readability - the most important information (bean title) now appears earlier in each row. - Update RenderBeanRow in styles.go (TUI list) - Update RenderTree in tree.go (CLI list)
1 parent 6f704a2 commit fe58dba

File tree

3 files changed

+17
-12
lines changed

3 files changed

+17
-12
lines changed

.beans/beans-mrs4--tui-swap-order-of-tags-and-title-columns.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
22
title: 'TUI: swap order of tags and title columns!'
3-
status: todo
3+
status: completed
44
type: feature
55
priority: normal
66
created_at: 2025-12-13T00:34:57Z
7-
updated_at: 2025-12-13T00:39:41Z
7+
updated_at: 2025-12-13T00:42:04Z
88
parent: beans-xnp8
99
---
1010

internal/ui/styles.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ func RenderBeanRow(id, status, typeName, title string, cfg BeanRowConfig) string
499499
}
500500

501501
if cfg.ShowTags {
502-
return cursor + idCol + typeCol + statusCol + tagsCol + prioritySymbol + titleStyled
502+
return cursor + idCol + typeCol + statusCol + prioritySymbol + titleStyled + " " + tagsCol
503503
}
504504
return cursor + idCol + typeCol + statusCol + prioritySymbol + titleStyled
505505
}

internal/ui/tree.go

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ func RenderTree(nodes []*TreeNode, cfg *config.Config, maxIDWidth int, hasTags b
188188
idStyle := lipgloss.NewStyle().Width(treeColWidth)
189189
typeStyle := lipgloss.NewStyle().Width(12)
190190
statusStyle := lipgloss.NewStyle().Width(14)
191-
tagsStyle := lipgloss.NewStyle().Width(24)
191+
titleStyle := lipgloss.NewStyle().Width(50)
192192
headerCol := lipgloss.NewStyle().Foreground(ColorMuted)
193193

194194
// Header
@@ -199,18 +199,18 @@ func RenderTree(nodes []*TreeNode, cfg *config.Config, maxIDWidth int, hasTags b
199199
idStyle.Render(headerCol.Render("ID")),
200200
typeStyle.Render(headerCol.Render("TYPE")),
201201
statusStyle.Render(headerCol.Render("STATUS")),
202-
tagsStyle.Render(headerCol.Render("TAGS")),
203-
headerCol.Render("TITLE"),
202+
titleStyle.Render(headerCol.Render("TITLE")),
203+
headerCol.Render("TAGS"),
204204
)
205-
dividerWidth = treeColWidth + 12 + 14 + 24 + 30
205+
dividerWidth = treeColWidth + 12 + 14 + 50 + 24
206206
} else {
207207
header = lipgloss.JoinHorizontal(lipgloss.Top,
208208
idStyle.Render(headerCol.Render("ID")),
209209
typeStyle.Render(headerCol.Render("TYPE")),
210210
statusStyle.Render(headerCol.Render("STATUS")),
211211
headerCol.Render("TITLE"),
212212
)
213-
dividerWidth = treeColWidth + 12 + 14 + 30
213+
dividerWidth = treeColWidth + 12 + 14 + 50
214214
}
215215
sb.WriteString(header)
216216
sb.WriteString("\n")
@@ -266,7 +266,7 @@ func renderNode(sb *strings.Builder, node *TreeNode, depth int, isLast bool, cfg
266266
// Column styles - fixed widths for alignment
267267
typeStyle := lipgloss.NewStyle().Width(12)
268268
statusStyle := lipgloss.NewStyle().Width(14)
269-
tagsStyle := lipgloss.NewStyle().Width(24)
269+
titleStyle := lipgloss.NewStyle().Width(50)
270270

271271
// Build indentation and connector
272272
// depth 0: no indent, no connector
@@ -324,7 +324,12 @@ func renderNode(sb *strings.Builder, node *TreeNode, depth int, isLast bool, cfg
324324
}
325325

326326
var titleText string
327-
title := truncateString(b.Title, 50)
327+
// Account for priority symbol width when truncating (symbol + space = 2 chars)
328+
maxTitleWidth := 50
329+
if prioritySymbol != "" {
330+
maxTitleWidth -= 2
331+
}
332+
title := truncateString(b.Title, maxTitleWidth)
328333
if node.Matched {
329334
titleText = prioritySymbol + title
330335
} else {
@@ -350,8 +355,8 @@ func renderNode(sb *strings.Builder, node *TreeNode, depth int, isLast bool, cfg
350355
idCell,
351356
typeStyle.Render(typeText),
352357
statusStyle.Render(statusText),
353-
tagsStyle.Render(tagsStr),
354-
titleText,
358+
titleStyle.Render(titleText),
359+
tagsStr,
355360
)
356361
} else {
357362
row = lipgloss.JoinHorizontal(lipgloss.Top,

0 commit comments

Comments
 (0)