Fix UDA colors
This commit is contained in:
@ -3,7 +3,6 @@ package pages
|
||||
import (
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"slices"
|
||||
"strings"
|
||||
"tasksquire/common"
|
||||
|
||||
@ -52,8 +51,6 @@ func NewTaskEditorPage(com *common.Common, task taskwarrior.Task) *TaskEditorPag
|
||||
priorityOptions := append([]string{"(none)"}, p.common.TW.GetPriorities()...)
|
||||
projectOptions := append([]string{"(none)"}, p.common.TW.GetProjects()...)
|
||||
tagOptions := p.common.TW.GetTags()
|
||||
tagOptions = append(tagOptions, strings.Split(p.common.TW.GetConfig().Get("uda.tasksquire.tags.default"), ",")...)
|
||||
slices.Sort(tagOptions)
|
||||
|
||||
p.areas = map[area]tea.Model{
|
||||
areaTask: NewTaskEdit(p.common, &p.task.Description, &p.task.Priority, &p.task.Project, priorityOptions, projectOptions),
|
||||
@ -459,11 +456,11 @@ func NewTaskEdit(common *common.Common, description *string, priority *string, p
|
||||
return &t
|
||||
}
|
||||
|
||||
func (t taskEdit) Init() tea.Cmd {
|
||||
func (t *taskEdit) Init() tea.Cmd {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (t taskEdit) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
func (t *taskEdit) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
switch msg.(type) {
|
||||
case nextFieldMsg:
|
||||
if t.cursor == len(t.fields)-1 {
|
||||
@ -490,7 +487,7 @@ func (t taskEdit) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
return t, nil
|
||||
}
|
||||
|
||||
func (t taskEdit) View() string {
|
||||
func (t *taskEdit) View() string {
|
||||
views := make([]string, len(t.fields))
|
||||
for i, field := range t.fields {
|
||||
views[i] = field.View()
|
||||
@ -540,11 +537,11 @@ func NewTagEdit(common *common.Common, selected *[]string, options []string) *ta
|
||||
return &t
|
||||
}
|
||||
|
||||
func (t tagEdit) Init() tea.Cmd {
|
||||
func (t *tagEdit) Init() tea.Cmd {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (t tagEdit) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
func (t *tagEdit) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
switch msg.(type) {
|
||||
case nextFieldMsg:
|
||||
if t.cursor == len(t.fields)-1 {
|
||||
@ -625,11 +622,11 @@ func NewTimeEdit(common *common.Common, due *string, scheduled *string, wait *st
|
||||
return &t
|
||||
}
|
||||
|
||||
func (t timeEdit) Init() tea.Cmd {
|
||||
func (t *timeEdit) Init() tea.Cmd {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (t timeEdit) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
func (t *timeEdit) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
switch msg.(type) {
|
||||
case nextFieldMsg:
|
||||
if t.cursor == len(t.fields)-1 {
|
||||
@ -655,7 +652,7 @@ func (t timeEdit) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
return t, nil
|
||||
}
|
||||
|
||||
func (t timeEdit) View() string {
|
||||
func (t *timeEdit) View() string {
|
||||
views := make([]string, len(t.fields))
|
||||
for i, field := range t.fields {
|
||||
views[i] = field.View()
|
||||
@ -796,12 +793,15 @@ func (p *TaskEditorPage) updateTasksCmd() tea.Msg {
|
||||
p.task.Priority = ""
|
||||
}
|
||||
|
||||
if *p.areas[areaTask].(taskEdit).newProjectName != "" {
|
||||
p.task.Project = *p.areas[areaTask].(taskEdit).newProjectName
|
||||
if *(p.areas[areaTask].(*taskEdit).newProjectName) != "" {
|
||||
p.task.Project = *p.areas[areaTask].(*taskEdit).newProjectName
|
||||
}
|
||||
|
||||
if *p.areas[areaTags].(tagEdit).newTagsValue != "" {
|
||||
p.task.Tags = append(p.task.Tags, strings.Split(*p.areas[areaTags].(tagEdit).newTagsValue, " ")...)
|
||||
if *(p.areas[areaTags].(*tagEdit).newTagsValue) != "" {
|
||||
newTags := strings.Split(*p.areas[areaTags].(*tagEdit).newTagsValue, " ")
|
||||
if len(newTags) > 0 {
|
||||
p.task.Tags = append(p.task.Tags, newTags...)
|
||||
}
|
||||
}
|
||||
|
||||
// if p.additionalProject != "" {
|
||||
|
||||
Reference in New Issue
Block a user