feat(tui): stumble mode — resurface stale entries card by card
Card-by-card walkthrough of entries untouched for 30+ days. Prevents write-mostly decay by bringing old entries back to attention. - S from list triggers stumble, loads entries where modified_at < 30d - Single-card view with markdown body, glyph, tags, age indicator - Actions: n skip, d dismiss, ! pin, p promote, m absorb, esc exit - Progress indicator: stumble [3/12] - After promote/absorb from stumble, returns to deck (not list) - "All caught up" screen when deck exhausted - DB: add ModifiedBefore to ListParams, modified_at sort column
This commit is contained in:
@@ -62,6 +62,14 @@ type railTagsLoadedMsg struct {
|
||||
tags []db.TagCount
|
||||
}
|
||||
|
||||
type staleEntitiesLoadedMsg struct {
|
||||
entities []*db.Entity
|
||||
}
|
||||
|
||||
type stumbleActionMsg struct {
|
||||
action string
|
||||
}
|
||||
|
||||
type statusClearMsg struct{ seq int }
|
||||
|
||||
type editorFinishedMsg struct {
|
||||
@@ -289,3 +297,33 @@ func clearStatusAfter(d time.Duration, seq int) tea.Cmd {
|
||||
return statusClearMsg{seq: seq}
|
||||
})
|
||||
}
|
||||
|
||||
func loadStaleEntities(store *db.Store) tea.Cmd {
|
||||
return func() tea.Msg {
|
||||
entities, err := store.List(staleParams())
|
||||
if err != nil {
|
||||
return errMsg{err}
|
||||
}
|
||||
return staleEntitiesLoadedMsg{entities}
|
||||
}
|
||||
}
|
||||
|
||||
func stumbleDismiss(store *db.Store, id string) tea.Cmd {
|
||||
return func() tea.Msg {
|
||||
if _, err := store.SoftDelete(id); err != nil {
|
||||
return errMsg{err}
|
||||
}
|
||||
return stumbleActionMsg{"dismissed"}
|
||||
}
|
||||
}
|
||||
|
||||
func stumblePin(store *db.Store, id string) tea.Cmd {
|
||||
return func() tea.Msg {
|
||||
pinned := true
|
||||
update := db.EntityUpdate{Pinned: &pinned}
|
||||
if err := store.Update(id, &update); err != nil {
|
||||
return errMsg{err}
|
||||
}
|
||||
return stumbleActionMsg{"pinned"}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user