twink/tui/notifications.go

44 lines
748 B
Go
Raw Permalink Normal View History

2025-12-07 11:42:57 +01:00
package tui
import tea "github.com/charmbracelet/bubbletea"
type (
NotificationScreenModel struct{
Size Size
}
SwitchNotificationScreenMsg struct{}
)
func SwitchNotificationScreen() tea.Msg {
return SwitchNotificationScreenMsg{}
}
func NewNotificationScreen() NotificationScreenModel {
return NotificationScreenModel{}
}
func (m NotificationScreenModel) Init() tea.Cmd {
return nil
}
func (m NotificationScreenModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
var cmd tea.Cmd
switch msg := msg.(type) {
case tea.KeyMsg:
switch msg.String() {
case "q", "ctrl-c":
cmd = tea.Quit
case "H":
cmd = SwitchHomeScreen
}
}
return m, cmd
}
func (m NotificationScreenModel) View() string {
return "notification screen"
}