feat(tui): layout and interaction polish #33
@@ -786,13 +786,10 @@ func (m model) listContent() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m model) headerView() string {
|
func (m model) headerView() string {
|
||||||
header := titleStyle.Render("nib")
|
header := titleStyle.Render("nib") + " "
|
||||||
|
header += renderTab("stream", "1", m.mode == modeStream)
|
||||||
modeName := "stream"
|
header += " " + separatorStyle.Render("│") + " "
|
||||||
if m.mode == modeCards {
|
header += renderTab("cards", "2", m.mode == modeCards)
|
||||||
modeName = "cards"
|
|
||||||
}
|
|
||||||
header += " " + modeStyle.Render(modeName)
|
|
||||||
|
|
||||||
if m.filterTag != "" {
|
if m.filterTag != "" {
|
||||||
header += " " + filterPillStyle.Render("#"+m.filterTag)
|
header += " " + filterPillStyle.Render("#"+m.filterTag)
|
||||||
|
|||||||
@@ -20,14 +20,28 @@ func renderHints(hints []hint) string {
|
|||||||
return strings.Join(parts, " ")
|
return strings.Join(parts, " ")
|
||||||
}
|
}
|
||||||
|
|
||||||
func renderStatusBar(m model, width int) string {
|
func renderTab(label, key string, active bool) string {
|
||||||
left := countText(m)
|
if active {
|
||||||
if m.status != "" {
|
return hintKeyStyle.Render(label) + " " + hintDescStyle.Render(key)
|
||||||
left = m.status
|
}
|
||||||
|
return hintDescStyle.Render(label) + " " + hintKeyStyle.Render(key)
|
||||||
}
|
}
|
||||||
right := renderHints(contextHints(m))
|
|
||||||
|
|
||||||
leftRendered := statusStyle.Render(left)
|
func renderStatusBar(m model, width int) string {
|
||||||
|
var leftParts []string
|
||||||
|
|
||||||
|
if m.state == stateList {
|
||||||
|
leftParts = append(leftParts, renderTab("capture", "a", false))
|
||||||
|
}
|
||||||
|
|
||||||
|
if m.status != "" {
|
||||||
|
leftParts = append(leftParts, statusStyle.Render(m.status))
|
||||||
|
} else {
|
||||||
|
leftParts = append(leftParts, statusStyle.Render(countText(m)))
|
||||||
|
}
|
||||||
|
|
||||||
|
leftRendered := strings.Join(leftParts, " "+separatorStyle.Render("│")+" ")
|
||||||
|
right := renderHints(contextHints(m))
|
||||||
|
|
||||||
gap := width - lipgloss.Width(leftRendered) - lipgloss.Width(right)
|
gap := width - lipgloss.Width(leftRendered) - lipgloss.Width(right)
|
||||||
if gap < 0 {
|
if gap < 0 {
|
||||||
@@ -77,11 +91,11 @@ func contextHints(m model) []hint {
|
|||||||
if m.focus == focusDetail {
|
if m.focus == focusDetail {
|
||||||
return []hint{{"h", "list"}, {"c", "copy"}, {"e", "edit"}, {"p", "promote"}, {"D", "demote"}, {"!", "pin"}, {"esc", "back"}}
|
return []hint{{"h", "list"}, {"c", "copy"}, {"e", "edit"}, {"p", "promote"}, {"D", "demote"}, {"!", "pin"}, {"esc", "back"}}
|
||||||
}
|
}
|
||||||
return []hint{{"l", "detail"}, {"a", "add"}, {"d", "del"}, {"#", "filter"}, {"esc", "close"}, {"?", "help"}, {"q", "quit"}}
|
return []hint{{"l", "detail"}, {"d", "del"}, {"#", "filter"}, {"esc", "close"}, {"?", "help"}, {"q", "quit"}}
|
||||||
}
|
}
|
||||||
if m.mode == modeCards {
|
if m.mode == modeCards {
|
||||||
return []hint{{"1", "stream"}, {"2", "cards"}, {"s", "sort"}, {"tab", "intent"}, {"a", "add"}, {"?", "help"}, {"q", "quit"}}
|
return []hint{{"s", "sort"}, {"tab", "intent"}, {"?", "help"}, {"q", "quit"}}
|
||||||
}
|
}
|
||||||
return []hint{{"1", "stream"}, {"2", "cards"}, {"a", "add"}, {"?", "search"}, {"m", "absorb"}, {"d", "del"}, {"#", "filter"}, {"?", "help"}, {"q", "quit"}}
|
return []hint{{"?", "search"}, {"m", "absorb"}, {"d", "del"}, {"#", "filter"}, {"?", "help"}, {"q", "quit"}}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user