Refine task due date color logic

This commit is contained in:
2026-10-04 18:16:12 +02:00
parent c7333ecc8d
commit 8863e29160
+15 -4
View File
@@ -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 {