diff options
| author | eltrac <hi@eltr.ac> | 2026-03-04 11:17:06 +0800 |
|---|---|---|
| committer | eltrac <hi@eltr.ac> | 2026-03-04 11:17:06 +0800 |
| commit | 1941516829e25b513f3be173c54fa563c534b2d5 (patch) | |
| tree | eca427bf6dfff448389142ff0d3fcafff5cd01ac /view.go | |
| parent | 4d2843cbdc04098fef4141179f00fdacdb63bcc4 (diff) | |
refactor: move View() to model_list
I didn't quite understand the architecture of Bubble Tea before, now I
know I need to put Init, Update and View in the same model
Diffstat (limited to 'view.go')
| -rw-r--r-- | view.go | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/view.go b/view.go deleted file mode 100644 index 4ee430e..0000000 --- a/view.go +++ /dev/null @@ -1,37 +0,0 @@ -package main - -import ( - "fmt" - "time" - - tea "charm.land/bubbletea/v2" -) - -func (m model) View() tea.View { - s := "Unpublished drafts of this Hugo site:\n\n" - - for i, choice := range m.choices { - cursor := " " // no cursor - if m.cursor == i { - cursor = ">" - } - - checked := " " // not checked - if _, ok := m.selected[i]; ok { - checked = "x" - } - - title := choice[2] - t, err := time.Parse(time.RFC3339, choice[3]) - if err != nil { - - } - datetime := t.Format("2006-01-02 15:04") - - s += fmt.Sprintf("%s [%s] %s \t %s\n", cursor, checked, datetime, title) - } - - s += "\n[q] quit | [Enter] edit | [SPACE] select | [↑/k] up | [↓/j] down\n" - - return tea.NewView(s) -} |
