refine navigation and loading enteries

This commit is contained in:
Travis Shears 2025-10-02 20:09:57 +02:00
parent 99548e67b7
commit 8414414f98
10 changed files with 148 additions and 41 deletions

12
main.go
View file

@ -14,7 +14,7 @@ type Page string
const (
ActionList Page = "actionList"
EntryList Page = "entryList"
// Entry Page = "entry"
Entry Page = "entry"
)
type SwitchPages struct{ Page Page }
@ -40,12 +40,10 @@ type model struct {
func initialModel(config *gemlog.Config) model {
return model{
ui: uiState{
page: ActionList,
// entryListPage: entryListPageModel{
// cursor: 0,
// entries: []gemlog.GemlogListEntry{},
// },
page: ActionList,
actionListPage: initialActionListPageModel(),
entryListPage: initialEntryListPageModel(),
// entryPage: initialEntryPageModel(),
},
context: &context{
config: config,
@ -80,7 +78,7 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
m.ui.actionListPage = actionListM
cmds = append(cmds, cmd)
entryListM, cmd := m.ui.entryListPage.Update(msg, m.context)
entryListM, cmd := m.ui.entryListPage.Update(msg, m.ui.page == EntryList, m.context)
m.ui.entryListPage = entryListM
cmds = append(cmds, cmd)