Fixes
This commit is contained in:
@ -107,9 +107,9 @@ func NewStyles(config *taskwarrior.TWConfig) *Styles {
|
||||
|
||||
styles.Form = formTheme
|
||||
|
||||
styles.ColumnFocused = lipgloss.NewStyle().Width(30).Height(50).Border(lipgloss.DoubleBorder(), true)
|
||||
styles.ColumnBlurred = lipgloss.NewStyle().Width(30).Height(50).Border(lipgloss.HiddenBorder(), true)
|
||||
styles.ColumnInsert = lipgloss.NewStyle().Width(30).Height(50).Border(lipgloss.DoubleBorder(), true).BorderForeground(styles.Active.GetForeground())
|
||||
styles.ColumnFocused = lipgloss.NewStyle().Width(50).Height(30).Border(lipgloss.DoubleBorder(), true)
|
||||
styles.ColumnBlurred = lipgloss.NewStyle().Width(50).Height(30).Border(lipgloss.HiddenBorder(), true)
|
||||
styles.ColumnInsert = lipgloss.NewStyle().Width(50).Height(30).Border(lipgloss.DoubleBorder(), true).BorderForeground(styles.Active.GetForeground())
|
||||
|
||||
return styles
|
||||
}
|
||||
|
||||
@ -190,17 +190,6 @@ func (m *Model) parseRowStyles(rows taskwarrior.Tasks) []lipgloss.Style {
|
||||
styles[i] = m.common.Styles.Recurring.Inherit(m.styles.Cell).Margin(m.styles.Cell.GetMargin()).Padding(m.styles.Cell.GetPadding())
|
||||
continue
|
||||
}
|
||||
// TOOD: move udas to proper location
|
||||
if len(m.common.Udas) > 0 {
|
||||
for _, uda := range m.common.Udas {
|
||||
if u, ok := task.Udas[uda]; ok {
|
||||
if style, ok := m.common.Styles.Colors[fmt.Sprintf("uda.%s.%s", uda, u)]; ok {
|
||||
styles[i] = style.Inherit(m.styles.Cell).Margin(m.styles.Cell.GetMargin()).Padding(m.styles.Cell.GetPadding())
|
||||
}
|
||||
}
|
||||
}
|
||||
continue
|
||||
}
|
||||
// TODO: make styles optional and discard if empty
|
||||
if len(task.Tags) > 0 {
|
||||
styles[i] = m.common.Styles.Tagged.Inherit(m.styles.Cell).Margin(m.styles.Cell.GetMargin()).Padding(m.styles.Cell.GetPadding())
|
||||
@ -213,6 +202,16 @@ func (m *Model) parseRowStyles(rows taskwarrior.Tasks) []lipgloss.Style {
|
||||
}
|
||||
continue
|
||||
}
|
||||
if len(m.common.Udas) > 0 {
|
||||
for _, uda := range m.common.Udas {
|
||||
if u, ok := task.Udas[uda]; ok {
|
||||
if style, ok := m.common.Styles.Colors[fmt.Sprintf("uda.%s.%s", uda, u)]; ok {
|
||||
styles[i] = style.Inherit(m.styles.Cell).Margin(m.styles.Cell.GetMargin()).Padding(m.styles.Cell.GetPadding())
|
||||
continue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
styles[i] = m.common.Styles.Base.Inherit(m.styles.Cell).Margin(m.styles.Cell.GetMargin()).Padding(m.styles.Cell.GetPadding())
|
||||
}
|
||||
return styles
|
||||
|
||||
13
main.go
13
main.go
@ -15,7 +15,18 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
ts := taskwarrior.NewTaskSquire("./test/taskrc")
|
||||
var taskrcPath string
|
||||
if taskrcEnv := os.Getenv("TASKRC"); taskrcEnv != "" {
|
||||
taskrcPath = taskrcEnv
|
||||
} else if _, err := os.Stat(os.Getenv("HOME") + "/.taskrc"); err == nil {
|
||||
taskrcPath = os.Getenv("HOME") + "/.taskrc"
|
||||
} else if _, err := os.Stat(os.Getenv("HOME") + "/.config/task/taskrc"); err == nil {
|
||||
taskrcPath = os.Getenv("HOME") + "/.config/task/taskrc"
|
||||
} else {
|
||||
log.Fatal("Unable to find taskrc file")
|
||||
}
|
||||
|
||||
ts := taskwarrior.NewTaskSquire(taskrcPath)
|
||||
ctx := context.Background()
|
||||
common := common.NewCommon(ctx, ts)
|
||||
|
||||
|
||||
@ -210,8 +210,9 @@ func (p *TaskEditorPage) View() string {
|
||||
area = focusStyle.Render(p.areas[p.area].View())
|
||||
|
||||
}
|
||||
|
||||
return lipgloss.JoinHorizontal(
|
||||
lipgloss.Left,
|
||||
lipgloss.Center,
|
||||
picker,
|
||||
area,
|
||||
)
|
||||
@ -352,6 +353,9 @@ func NewAreaPicker(common *common.Common, items []string) *areaPicker {
|
||||
list := list.New(listItems, list.DefaultDelegate{}, 20, 50)
|
||||
list.SetFilteringEnabled(false)
|
||||
list.SetShowStatusBar(false)
|
||||
list.SetShowHelp(false)
|
||||
list.SetShowPagination(false)
|
||||
list.SetShowTitle(false)
|
||||
|
||||
return &areaPicker{
|
||||
common: common,
|
||||
|
||||
@ -186,9 +186,15 @@ func (t *Task) GetString(fieldWFormat string) string {
|
||||
return t.Recur
|
||||
|
||||
default:
|
||||
if val, ok := t.Udas[field]; ok {
|
||||
if strVal, ok := val.(string); ok {
|
||||
return strVal
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
slog.Error(fmt.Sprintf("Field not implemented: %s", field))
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
func (t *Task) GetDate(dateString string) time.Time {
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user