feat(tui): add cards view, mode switching, promote picker, and card detail

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.
This commit is contained in:
2026-05-17 21:14:14 -04:00
parent c2ea63dd16
commit ce335cabd6
12 changed files with 786 additions and 112 deletions
+7 -4
View File
@@ -8,6 +8,7 @@ import (
"github.com/atotto/clipboard"
tea "github.com/charmbracelet/bubbletea"
"github.com/lerko/nib/internal/carddata"
"github.com/lerko/nib/internal/db"
)
@@ -29,7 +30,8 @@ type entityUpdatedMsg struct {
}
type entityPromotedMsg struct {
id string
id string
cardType db.CardType
}
type entityDemotedMsg struct {
@@ -122,12 +124,13 @@ func pinEntity(store *db.Store, e *db.Entity) tea.Cmd {
}
}
func promoteEntity(store *db.Store, id string) tea.Cmd {
func promoteEntity(store *db.Store, id string, ct db.CardType, body string) tea.Cmd {
return func() tea.Msg {
if err := store.Promote(id, db.CardSnippet, nil); err != nil {
cd := carddata.GenerateCardData(ct, body)
if err := store.Promote(id, ct, cd); err != nil {
return errMsg{err}
}
return entityPromotedMsg{id}
return entityPromotedMsg{id, ct}
}
}