mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
WTF-730 Fix missing color key config error (#738)
* WTF-730 Fix missing color key config error Signed-off-by: Chris Cummer <chriscummer@me.com> * WTF-730 Add Subheading color formatting to modules Users can now set a `subheading` color in their config to change the color of subheadings in widget display. Defaults to `red`. Signed-off-by: Chris Cummer <chriscummer@me.com> * WTF-730 Fix oustanding color issues Clean up missing color config changes not addressed in earlier commits. Signed-off-by: Chris Cummer <chriscummer@me.com> * Remove unused dependency Signed-off-by: Chris Cummer <chriscummer@me.com> * WTF-730 Base cleanup Signed-off-by: Chris Cummer <chriscummer@me.com> * WTF-730 Fix a few bugs related to color config changes Signed-off-by: Chris Cummer <chriscummer@me.com> * WTF-730 Fix issues with PagerDuty subheading display Signed-off-by: Chris Cummer <chriscummer@me.com> * WTF-730 Fix bug with Todo list colour rendering Signed-off-by: Chris Cummer <chriscummer@me.com>
This commit is contained in:
@@ -10,13 +10,16 @@ import (
|
||||
type Widget struct {
|
||||
view.TextWidget
|
||||
|
||||
client *Client
|
||||
client *Client
|
||||
settings *Settings
|
||||
}
|
||||
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: view.NewTextWidget(app, settings.common),
|
||||
client: NewClient(settings),
|
||||
|
||||
client: NewClient(settings),
|
||||
settings: settings,
|
||||
}
|
||||
|
||||
widget.View.SetBorderPadding(1, 1, 1, 1)
|
||||
@@ -31,18 +34,25 @@ func (widget *Widget) Refresh() {
|
||||
}
|
||||
|
||||
func (widget *Widget) content() (string, string, bool) {
|
||||
usernames := widget.client.screenNames
|
||||
// Add header row
|
||||
str := fmt.Sprintf(
|
||||
"[%s]%-12s %10s %8s[white]\n",
|
||||
widget.settings.common.Colors.Subheading,
|
||||
"Username",
|
||||
"Followers",
|
||||
"Tweets",
|
||||
)
|
||||
|
||||
stats := widget.client.GetStats()
|
||||
|
||||
// Add header row
|
||||
str := fmt.Sprintf("%-16s %8s %8s\n", "Username", "Followers", "Tweets")
|
||||
|
||||
// Add rows for each of the followed usernames
|
||||
for i, username := range usernames {
|
||||
followerCount := stats[i].FollowerCount
|
||||
tweetCount := stats[i].TweetCount
|
||||
|
||||
str += fmt.Sprintf("%-16s %8d %8d\n", username, followerCount, tweetCount)
|
||||
for i, username := range widget.client.screenNames {
|
||||
str += fmt.Sprintf(
|
||||
"%-12s %10d %8d\n",
|
||||
username,
|
||||
stats[i].FollowerCount,
|
||||
stats[i].TweetCount,
|
||||
)
|
||||
}
|
||||
|
||||
return "Twitter Stats", str, true
|
||||
|
||||
Reference in New Issue
Block a user