Add mood tracking persistence, keyboard navigation, and yearly mood summary to YearMood widget
This commit is contained in:
+6
-6
@@ -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()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user