diff --git a/widgets/board.go b/widgets/board.go index 2c741d5..741156d 100644 --- a/widgets/board.go +++ b/widgets/board.go @@ -5,6 +5,7 @@ import ( "ArinDash/util" "context" "fmt" + "math" "sort" "strings" "time" @@ -101,20 +102,30 @@ func createBoard(ctx context.Context, _ terminalapi.Terminal, _ interface{}) wid title = title + strings.Repeat(" ", colWidth-len(title)) } - color := cell.ColorGreen + fgColor := cell.ColorGreen + bgColor := cell.ColorBlack durr := int(column.Tasks[i].DueDate.Sub(time.Now()).Hours() / 24) + if durr < 0 { + durr = math.MaxInt + } if durr < 14 && !column.IsFinal { - color = cell.ColorRed + fgColor = cell.ColorBlack + bgColor = cell.ColorRed d := fmt.Sprintf("%02dd", durr) title = title[0:colWidth-3] + d } if durr < 28 && !column.IsFinal { - color = cell.ColorYellow + bgColor = cell.ColorYellow + fgColor = cell.ColorBlack d := fmt.Sprintf("%02dd", durr) title = title[0:colWidth-3] + d } + if column.IsFinal { + bgColor = cell.ColorBlack + fgColor = cell.ColorGray + } - if err := widget.Write(title, text.WriteCellOpts(cell.FgColor(color))); err != nil { + if err := widget.Write(title, text.WriteCellOpts(cell.FgColor(fgColor), cell.BgColor(bgColor), cell.Bold())); err != nil { return nil } } else {