mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
add the module to the widget_maker.go
This commit is contained in:
parent
1ff75dd4cf
commit
5c6833a0df
@ -73,6 +73,7 @@ import (
|
||||
"github.com/wtfutil/wtf/modules/weatherservices/weather"
|
||||
"github.com/wtfutil/wtf/modules/zendesk"
|
||||
"github.com/wtfutil/wtf/wtf"
|
||||
"github.com/wtfutil/wtf/modules/finnhub"
|
||||
)
|
||||
|
||||
// MakeWidget creates and returns instances of widgets
|
||||
@ -308,6 +309,9 @@ func MakeWidget(
|
||||
case "exchangerates":
|
||||
settings := exchangerates.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = exchangerates.NewWidget(app, pages, settings)
|
||||
case "finnhub":
|
||||
settings := finnhub.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = finnhub.NewWidget(app, settings)
|
||||
default:
|
||||
settings := unknown.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = unknown.NewWidget(app, settings)
|
||||
|
@ -5,7 +5,6 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
"encoding/json"
|
||||
//"github.com/wtfutil/wtf/utils"
|
||||
)
|
||||
|
||||
// Client ..
|
||||
|
@ -9,7 +9,7 @@ import (
|
||||
|
||||
const (
|
||||
defaultFocusable = true
|
||||
defaultTitle = "Stocks"
|
||||
defaultTitle = "Finnhub Stock Price"
|
||||
)
|
||||
|
||||
// Settings defines the configuration properties for this module
|
||||
|
@ -42,7 +42,7 @@ func (widget *Widget) Refresh() {
|
||||
func (widget *Widget) content() (string, string, bool) {
|
||||
quotes, err := widget.Client.Getquote()
|
||||
|
||||
title := fmt.Sprintf("%s - from finnhub api", widget.CommonSettings().Title)
|
||||
title := fmt.Sprintf("%s", widget.CommonSettings().Title)
|
||||
var str string
|
||||
wrap := false
|
||||
if err != nil {
|
||||
@ -55,7 +55,8 @@ func (widget *Widget) content() (string, string, bool) {
|
||||
}
|
||||
|
||||
str += fmt.Sprintf(
|
||||
"[%s]: %s \n",
|
||||
"[%d]: %s %.2f\n",
|
||||
idx,
|
||||
q.Stock,
|
||||
q.C,
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user