diff options
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/ui/table.go | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/internal/ui/table.go b/internal/ui/table.go index 92ad157..c22aaa6 100644 --- a/internal/ui/table.go +++ b/internal/ui/table.go @@ -451,6 +451,7 @@ func (m Model) View() string { view := lipgloss.JoinVertical(lipgloss.Left, m.topStatusLine(), m.tbl.View(), + m.expandedCellView(), m.statusLine(), ) if m.annotating { @@ -554,6 +555,8 @@ func formatDue(s string) string { val = "today" case 1: val = "tomorrow" + case -1: + val = "yesterday" default: val = fmt.Sprintf("%dd", days) } @@ -652,3 +655,40 @@ func taskToRowSearch(t task.Task, re *regexp.Regexp) atable.Row { annStr, } } + +func (m Model) expandedCellView() string { + row := m.tbl.Cursor() + col := m.tbl.ColumnCursor() + if row < 0 || row >= len(m.tasks) || col < 0 { + return "" + } + t := m.tasks[row] + var val string + switch col { + case 0: + val = strconv.Itoa(t.ID) + case 1: + val = ansi.Strip(formatPriority(t.Priority)) + case 2: + if ts, err := time.Parse("20060102T150405Z", t.Entry); err == nil { + days := int(time.Since(ts).Hours() / 24) + val = fmt.Sprintf("%dd", days) + } + case 3: + val = fmt.Sprintf("%.1f", t.Urgency) + case 4: + val = ansi.Strip(formatDue(t.Due)) + case 5: + val = strings.Join(t.Tags, " ") + case 6: + val = t.Description + case 7: + var anns []string + for _, a := range t.Annotations { + anns = append(anns, a.Description) + } + val = strings.Join(anns, "; ") + } + style := lipgloss.NewStyle().Width(m.tbl.Width()) + return style.Render(val) +} |
