Add News widget and integrate NewsAPI for live updates

This commit is contained in:
2025-12-29 21:19:05 +01:00
parent d638a8ae97
commit 9b5afc3d7c
9 changed files with 260 additions and 38 deletions
+4
View File
@@ -27,6 +27,10 @@ func createWeather(ctx context.Context, _ terminalapi.Terminal, _ interface{}) w
go util.Periodic(ctx, 1*time.Hour, func() error {
weather := openWeatherMap.FetchCurrentWeather()
widget.Reset()
if weather.ErrorMessage != "" {
widget.Write(weather.ErrorMessage, text.WriteCellOpts(cell.FgColor(cell.ColorRed)))
return nil
}
weatherIcon := getIcon(weather.Weather[0].Icon)