mirror of
				https://github.com/taigrr/wtf
				synced 2025-01-18 04:03:14 -08:00 
			
		
		
		
	
		
			
				
	
	
		
			52 lines
		
	
	
		
			856 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			52 lines
		
	
	
		
			856 B
		
	
	
	
		
			Go
		
	
	
	
	
	
package jira
 | 
						|
 | 
						|
import (
 | 
						|
	"fmt"
 | 
						|
	"time"
 | 
						|
 | 
						|
	"github.com/rivo/tview"
 | 
						|
	"github.com/senorprogrammer/wtf/wtf"
 | 
						|
)
 | 
						|
 | 
						|
type Widget struct {
 | 
						|
	wtf.BaseWidget
 | 
						|
	View *tview.TextView
 | 
						|
}
 | 
						|
 | 
						|
func NewWidget() *Widget {
 | 
						|
	widget := Widget{
 | 
						|
		BaseWidget: wtf.BaseWidget{
 | 
						|
			Name:        "JIRA",
 | 
						|
			RefreshedAt: time.Now(),
 | 
						|
			RefreshInt:  900,
 | 
						|
		},
 | 
						|
	}
 | 
						|
 | 
						|
	widget.addView()
 | 
						|
	go wtf.Refresh(&widget)
 | 
						|
 | 
						|
	return &widget
 | 
						|
}
 | 
						|
 | 
						|
/* -------------------- Exported Functions -------------------- */
 | 
						|
 | 
						|
func (widget *Widget) Refresh() {
 | 
						|
	widget.View.SetTitle(" JIRA ")
 | 
						|
	widget.RefreshedAt = time.Now()
 | 
						|
 | 
						|
	widget.View.Clear()
 | 
						|
	fmt.Fprintf(widget.View, "%s", "jira")
 | 
						|
}
 | 
						|
 | 
						|
/* -------------------- Unexported Functions -------------------- */
 | 
						|
 | 
						|
func (widget *Widget) addView() {
 | 
						|
	view := tview.NewTextView()
 | 
						|
 | 
						|
	view.SetBorder(true)
 | 
						|
	view.SetDynamicColors(true)
 | 
						|
	view.SetTitle(widget.Name)
 | 
						|
 | 
						|
	widget.View = view
 | 
						|
}
 |