all repos

smutok @ 0ff9ce851c4eada2ffd4d564de030a347b1a59c5

yet another tui rss reader (not abandoned, just paused development)

smutok/internal/tui/tui.go(view raw)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package tui

import (
	tea "github.com/charmbracelet/bubbletea"

	"olexsmir.xyz/smutok/internal/sync"
)

type Model struct {
	isQutting bool
	showErr   bool
	err       error

	sync sync.Strategy
}

func NewModel() *Model {
	return &Model{}
}

func (m *Model) Init() tea.Cmd {
	return nil
}

func (m *Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
	switch msg := msg.(type) {
	case errMsg:
		m.err = msg
		m.showErr = true
		return m, nil

	case tea.WindowSizeMsg:

	case tea.KeyMsg:
		switch msg.String() {
		case "q":
			m.isQutting = true
			return m, tea.Quit
		}
	}
	return m, nil
}

func (m *Model) View() string {
	if m.isQutting {
		return ""
	}
	return "are you feeling smutok?"
}