mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
* Create generalized todo module Makes existing modules "backends" This gives us a consistent interface * Fix check issues * Fix lint errors * Make changes to stay on wtfutil todoist fork
44 lines
818 B
Go
44 lines
818 B
Go
package todo_plus
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/rivo/tview"
|
|
"github.com/wtfutil/wtf/utils"
|
|
)
|
|
|
|
func (widget *Widget) content() (string, string, bool) {
|
|
proj := widget.CurrentProject()
|
|
|
|
if proj == nil {
|
|
return widget.CommonSettings().Title, "", false
|
|
}
|
|
|
|
if proj.Err != nil {
|
|
return widget.CommonSettings().Title, proj.Err.Error(), true
|
|
}
|
|
|
|
title := fmt.Sprintf(
|
|
"[%s]%s[white]",
|
|
widget.settings.common.Colors.TextTheme.Title,
|
|
proj.Name)
|
|
|
|
str := ""
|
|
|
|
for idx, item := range proj.Tasks {
|
|
row := fmt.Sprintf(
|
|
`[%s]| | %s[%s]`,
|
|
widget.RowColor(idx),
|
|
tview.Escape(item.Name),
|
|
widget.RowColor(idx),
|
|
)
|
|
|
|
str += utils.HighlightableHelper(widget.View, row, idx, len(item.Name))
|
|
}
|
|
return title, str, false
|
|
}
|
|
|
|
func (widget *Widget) display() {
|
|
widget.ScrollableWidget.Redraw(widget.content)
|
|
}
|