mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Flexible 1on1 lookup (need to move this sort of thing into Config)
This commit is contained in:
parent
8e3287ba5c
commit
3a3efbd59f
@ -158,11 +158,15 @@ func (widget *Widget) hasConflict(event *calendar.Event, events *calendar.Events
|
|||||||
return conflict
|
return conflict
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (widget *Widget) isOneOnOne(event *calendar.Event) bool {
|
||||||
|
return strings.Contains(event.Summary, "1on1") || strings.Contains(event.Summary, "1/1")
|
||||||
|
}
|
||||||
|
|
||||||
func (widget *Widget) titleColor(event *calendar.Event) string {
|
func (widget *Widget) titleColor(event *calendar.Event) string {
|
||||||
ts, _ := time.Parse(time.RFC3339, event.Start.DateTime)
|
ts, _ := time.Parse(time.RFC3339, event.Start.DateTime)
|
||||||
|
|
||||||
color := "red"
|
color := "red"
|
||||||
if strings.Contains(event.Summary, "1on1") {
|
if widget.isOneOnOne(event) {
|
||||||
color = "green"
|
color = "green"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ type Widget struct {
|
|||||||
|
|
||||||
func NewWidget() *Widget {
|
func NewWidget() *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
TextWidget: wtf.NewTextWidget(" JIRA ", "jira"),
|
TextWidget: wtf.NewTextWidget("JIRA", "jira"),
|
||||||
}
|
}
|
||||||
|
|
||||||
widget.addView()
|
widget.addView()
|
||||||
@ -47,10 +47,9 @@ func (widget *Widget) Refresh() {
|
|||||||
widget.View.SetWrap(false)
|
widget.View.SetWrap(false)
|
||||||
widget.View.SetTitle(
|
widget.View.SetTitle(
|
||||||
fmt.Sprintf(
|
fmt.Sprintf(
|
||||||
" %s: [green]%s[white] (%d)",
|
" %s: [green]%s[white] ",
|
||||||
widget.Name,
|
widget.Name,
|
||||||
Config.UString("wtf.mods.jira.project"),
|
Config.UString("wtf.mods.jira.project"),
|
||||||
len(searchResult.Issues),
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
fmt.Fprintf(widget.View, "%s", widget.contentFrom(searchResult))
|
fmt.Fprintf(widget.View, "%s", widget.contentFrom(searchResult))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user