Eric Bower
·
17 Dec 24
pages.go
1package pages
2
3import tea "github.com/charmbracelet/bubbletea"
4
5type Page int
6
7const (
8 MenuPage Page = iota
9 CreateAccountPage
10 CreatePubkeyPage
11 CreateTokenPage
12 PubkeysPage
13 TokensPage
14 NotificationsPage
15 PlusPage
16 SettingsPage
17 LogsPage
18 AnalyticsPage
19 ChatPage
20)
21
22type NavigateMsg struct{ Page }
23
24func Navigate(page Page) tea.Cmd {
25 return func() tea.Msg {
26 return NavigateMsg{page}
27 }
28}
29
30func ToTitle(page Page) string {
31 switch page {
32 case CreateAccountPage:
33 return "create account"
34 case CreatePubkeyPage:
35 return "add pubkey"
36 case CreateTokenPage:
37 return "new api token"
38 case MenuPage:
39 return "menu"
40 case NotificationsPage:
41 return "notifications"
42 case PlusPage:
43 return "pico+"
44 case TokensPage:
45 return "api tokens"
46 case PubkeysPage:
47 return "pubkeys"
48 case SettingsPage:
49 return "settings"
50 case LogsPage:
51 return "logs"
52 case AnalyticsPage:
53 return "analytics"
54 case ChatPage:
55 return "chat"
56 }
57
58 return ""
59}