From 41c503645122f3d2d79ea4a428d6eb72c399c5b5 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Mon, 30 Nov 2026 11:13:47 +0100 Subject: 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 --- tests/test_dashboard.mjs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'tests/test_dashboard.mjs') 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"); -- cgit v1.2.3