1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
# Vikunja todos on the Dashboard
The Dashboard's bottom row (once the action icons) stays empty unless there is
something to do. Then it lists the Vikunja tasks that need attention.
## What shows
Open tasks that are due today or overdue, or whose reminder has passed.
A task with a reminder still in the future is hidden: that is how a snooze
hides it until the reminder fires. Overdue first, then by due date; a task
with no due date (only a reminder) after those. At most 3 lines plus
"+N more". No tasks: no row.
## Server: `deckit/modules/todo.py`
- `[todo] url`, the Vikunja API base (`http://host:3456`). Empty: the module
reports nothing and starts no thread.
- Token: a Vikunja API token allowed to read and update tasks, the first
line of the pass entry `[todo] pass`. Read once and kept in memory; a 401
drops it so the next read asks pass again. Never in the repo or the
shipped config.
- A thread reads `GET /api/v2/tasks?filter=done = false && (due_date <
now/d+1d || reminders < now)` every 60s and right after an action;
`/api/v1/info`'s `frontend_url` once for links.
- State: `{tasks: [{id, title, due}], more, error}`. `due` is an ISO time
or null (Vikunja's `0001-01-01` is null).
- Actions take `{id}`, which must be one the last state listed:
- `open`: `xdg-open <frontend_url>tasks/<id>` on the PC.
- `done`: merge-patch `{done: true}` (a repeating task moves on, Vikunja's
own rule).
- `snooze`: read the task, merge-patch its `reminders` with every old one
plus one at now+30m.
- Unreachable or refused: `error` carries the reason; the last tasks are
dropped.
## Dashboard
A `.dash-todo` row at the bottom of `.dash-mid`, hidden when empty. Each line:
title, and "overdue 2d", "today 15:00" or "reminder". Gestures:
- tap: `open`
- hold (`hold.js`): `done`, the line fades out
- swipe left to right past a third of its width: `snooze`; the line follows
the finger and slides out; a swipe cancels the hold.
An error shows one muted line, "Vikunja unreachable", the reason in its
tooltip.
## Keystone
`todo` under Dashboard parts, labelled "Vikunja todos", and a URL field.
## Tests
`tests/test_todo.py` with a fake HTTP layer: a future reminder hides a task,
sort order, `0001` dates read as none, an unlisted id is refused, snooze keeps
the old reminders and adds one, done sends a partial patch, empty url is
quiet.
|