Add mood tracking persistence, keyboard navigation, and yearly mood summary to YearMood widget

This commit is contained in:
2025-12-31 15:53:11 +01:00
parent 2f918332a3
commit f05e7395f3
2 changed files with 305 additions and 93 deletions
+6 -6
View File
@@ -100,15 +100,15 @@ func NewNewsText(opts ...text.Option) (*NewsText, error) {
return &NewsText{Text: t}, nil
}
func (t *NewsText) Keyboard(k *terminalapi.Keyboard, _ *widgetapi.EventMeta) error {
func (widget *NewsText) Keyboard(k *terminalapi.Keyboard, _ *widgetapi.EventMeta) error {
if k.Key == keyboard.KeyArrowLeft {
if t.Selected == 0 {
t.Selected = len(t.newsArticles.Articles) - 1
if widget.Selected == 0 {
widget.Selected = len(widget.newsArticles.Articles) - 1
} else {
t.Selected = t.Selected - 1
widget.Selected = widget.Selected - 1
}
} else if k.Key == keyboard.KeyArrowRight {
t.Selected = (t.Selected + 1) % len(t.newsArticles.Articles)
widget.Selected = (widget.Selected + 1) % len(widget.newsArticles.Articles)
}
return t.drawNews()
return widget.drawNews()
}