ce335cabd6
Stream/cards toggle with 1/2 keys. Cards view with intent filtering (tab cycles grab/read/fill/all), sort cycling (s key), pinned-first ordering, and affordance badges. Promote picker (p key) with card type selection and auto-detection from body content. Detail view renders card_data per type: checklist steps, template slots, decision fields, link URLs. Extracts generateCardData to internal/carddata for reuse across cmd and tui packages.
57 lines
1.3 KiB
Go
57 lines
1.3 KiB
Go
package tui
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/charmbracelet/lipgloss"
|
|
)
|
|
|
|
func renderStatusBar(m model, width int) string {
|
|
left := countText(m)
|
|
right := contextHints(m)
|
|
|
|
leftRendered := statusStyle.Render(left)
|
|
rightRendered := helpStyle.Render(right)
|
|
|
|
gap := width - lipgloss.Width(leftRendered) - lipgloss.Width(rightRendered)
|
|
if gap < 0 {
|
|
gap = 0
|
|
}
|
|
|
|
pad := lipgloss.NewStyle().Width(gap).Render("")
|
|
return leftRendered + pad + rightRendered
|
|
}
|
|
|
|
func countText(m model) string {
|
|
var total int
|
|
if m.mode == modeCards {
|
|
total = len(m.cards.filtered)
|
|
} else {
|
|
total = len(m.list.entities)
|
|
}
|
|
if m.filterTag != "" {
|
|
return fmt.Sprintf("%d entities #%s", total, m.filterTag)
|
|
}
|
|
return fmt.Sprintf("%d entities", total)
|
|
}
|
|
|
|
func contextHints(m model) string {
|
|
switch m.state {
|
|
case stateDetail:
|
|
return "p:promote D:demote c:copy e:edit !:pin esc:back"
|
|
case stateInput:
|
|
return "enter:submit esc:cancel"
|
|
case stateTagFilter:
|
|
return "j/k:nav enter:select esc:cancel"
|
|
case stateConfirm:
|
|
return "y:confirm n:cancel"
|
|
case statePromote:
|
|
return "j/k:nav enter:select esc:cancel"
|
|
default:
|
|
if m.mode == modeCards {
|
|
return "1:stream 2:cards s:sort tab:intent a:add ?:help q:quit"
|
|
}
|
|
return "1:stream 2:cards a:add d:del x:todo #:filter ?:help q:quit"
|
|
}
|
|
}
|