diff options
| author | Danilo M. <danix@danix.xyz> | 2026-11-30 11:13:47 +0100 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-11-30 11:13:47 +0100 |
| commit | 41c503645122f3d2d79ea4a428d6eb72c399c5b5 (patch) | |
| tree | 92dfb9879824a9d2d67de8b7262b348fa1303930 /tests/test_dashboard.mjs | |
| parent | 88f120cb544296f4c760546a204f1e2268a2e5dd (diff) | |
| download | deck-it-41c503645122f3d2d79ea4a428d6eb72c399c5b5.tar.gz deck-it-41c503645122f3d2d79ea4a428d6eb72c399c5b5.zip | |
feat(todo): Vikunja tasks due now on the Dashboard
A row under the music and spending cards lists the open Vikunja tasks
that are due today or overdue, or whose reminder has passed, and is
hidden when there are none. A task with a reminder still ahead is left
out, so snoozing adds a reminder 30 min ahead and the task returns when
it fires. Tap opens the task in the PC's browser, hold marks it done,
a swipe right snoozes it.
[todo] url points at Vikunja; the API token lives in
~/.config/deck-it/vikunja-token.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tests/test_dashboard.mjs')
| -rw-r--r-- | tests/test_dashboard.mjs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/test_dashboard.mjs b/tests/test_dashboard.mjs index 2448c38..78fcefc 100644 --- a/tests/test_dashboard.mjs +++ b/tests/test_dashboard.mjs @@ -15,7 +15,7 @@ // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. import assert from "node:assert/strict"; -import { area, line, push, spendParts, batteryGlyph, HISTORY } from "../static/dashboard.js"; +import { area, line, push, spendParts, batteryGlyph, dueLabel, HISTORY } from "../static/dashboard.js"; import { busy as printing } from "../static/modules/k1c.js"; import { busy as building, planRows } from "../static/modules/sbbuilder.js"; import { busy as live } from "../static/modules/obs.js"; @@ -64,3 +64,10 @@ assert.deepEqual(planRows({ plan: ["a/x", "b/y", "c/z"], progress: { results: { "a/x": "failed" }, current: "b/y" } }).map((r) => r.status), ["failed", "building", "waiting"]); assert.deepEqual(planRows(undefined), []); + +// dueLabel: reminder-only, later today, hours and days overdue +const now = new Date(2026, 10, 30, 12, 0); +assert.equal(dueLabel(null, now), "reminder"); +assert.match(dueLabel(new Date(2026, 10, 30, 15, 0).toISOString(), now), /^today 15.00$/); +assert.equal(dueLabel(new Date(2026, 10, 30, 9, 0).toISOString(), now), "overdue 3h"); +assert.equal(dueLabel(new Date(2026, 10, 27, 12, 0).toISOString(), now), "overdue 3d"); |
