mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
49 lines
816 B
Go
49 lines
816 B
Go
package status
|
|
|
|
import (
|
|
"fmt"
|
|
"time"
|
|
|
|
"github.com/rivo/tview"
|
|
)
|
|
|
|
type Widget struct {
|
|
RefreshedAt time.Time
|
|
View *tview.TextView
|
|
}
|
|
|
|
func NewWidget() *Widget {
|
|
widget := Widget{
|
|
RefreshedAt: time.Now(),
|
|
}
|
|
|
|
widget.addView()
|
|
|
|
return &widget
|
|
}
|
|
|
|
/* -------------------- Exported Functions -------------------- */
|
|
|
|
func (widget *Widget) Refresh() {
|
|
widget.View.SetTitle(" 🦊 Status ")
|
|
widget.RefreshedAt = time.Now()
|
|
|
|
fmt.Fprintf(widget.View, "%s", widget.contentFrom())
|
|
}
|
|
|
|
/* -------------------- Unexported Functions -------------------- */
|
|
|
|
func (widget *Widget) addView() {
|
|
view := tview.NewTextView()
|
|
|
|
view.SetBorder(true)
|
|
view.SetDynamicColors(true)
|
|
view.SetTitle(" BambooHR ")
|
|
|
|
widget.View = view
|
|
}
|
|
|
|
func (widget *Widget) contentFrom() string {
|
|
return "cats and gods\ndogs and tacs"
|
|
}
|