Add due date color coding for tasks
This commit is contained in:
+18
-3
@@ -4,6 +4,7 @@ import (
|
||||
"ArinDash/apis/kaneo"
|
||||
"ArinDash/util"
|
||||
"context"
|
||||
"fmt"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -60,7 +61,7 @@ func createBoard(ctx context.Context, _ terminalapi.Terminal, _ interface{}) wid
|
||||
name = name + strings.Repeat(" ", colWidth-len(name))
|
||||
}
|
||||
|
||||
if err := widget.Write(name, text.WriteCellOpts(cell.FgColor(cell.ColorGreen))); err != nil {
|
||||
if err := widget.Write(name, text.WriteCellOpts(cell.FgColor(cell.ColorWhite))); err != nil {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
@@ -72,7 +73,7 @@ func createBoard(ctx context.Context, _ terminalapi.Terminal, _ interface{}) wid
|
||||
return err
|
||||
}
|
||||
|
||||
for i := range 6 {
|
||||
for i := range 10 {
|
||||
if i != 0 {
|
||||
if err := writeMiddle(widget, colWidth, widget.board.Columns); err != nil {
|
||||
return err
|
||||
@@ -99,7 +100,21 @@ func createBoard(ctx context.Context, _ terminalapi.Terminal, _ interface{}) wid
|
||||
if len(title) < colWidth {
|
||||
title = title + strings.Repeat(" ", colWidth-len(title))
|
||||
}
|
||||
if err := widget.Write(title, text.WriteCellOpts(cell.FgColor(cell.ColorWhite))); err != nil {
|
||||
|
||||
color := cell.ColorGreen
|
||||
durr := int(column.Tasks[i].DueDate.Sub(time.Now()).Hours() / 24)
|
||||
if durr < 14 && !column.IsFinal {
|
||||
color = cell.ColorRed
|
||||
d := fmt.Sprintf("%02dd", durr)
|
||||
title = title[0:colWidth-3] + d
|
||||
}
|
||||
if durr < 28 && !column.IsFinal {
|
||||
color = cell.ColorYellow
|
||||
d := fmt.Sprintf("%02dd", durr)
|
||||
title = title[0:colWidth-3] + d
|
||||
}
|
||||
|
||||
if err := widget.Write(title, text.WriteCellOpts(cell.FgColor(color))); err != nil {
|
||||
return nil
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user