aboutsummaryrefslogtreecommitdiffstats
path: root/static
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-11-30 11:38:15 +0100
committerDanilo M. <danix@danix.xyz>2026-11-30 11:38:15 +0100
commit4d6f14e7d106dadeb354081a32dfa8b1f40371e0 (patch)
tree0c2c8c9aee5ccc3085b125462bb17684f472d309 /static
parent30fed7fc778560e759ae5602901d898af80e0a28 (diff)
downloaddeck-it-master.tar.gz
deck-it-master.zip
fix(todo): open tasks at the configured URL, animate done and snoozeHEADmaster
Vikunja's frontend_url said port 80, so a tap opened the wrong page; the frontend lives at the API's address, so open uses [todo] url. A hold now turns the chip green with a ticked box and shrinks it away, a snooze carries it off to the right; the row is redrawn only after the animation, so it is not cut short. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'static')
-rw-r--r--static/dashboard.js39
-rw-r--r--static/deck.css3
2 files changed, 29 insertions, 13 deletions
diff --git a/static/dashboard.js b/static/dashboard.js
index 91ab2ec..072dbe1 100644
--- a/static/dashboard.js
+++ b/static/dashboard.js
@@ -27,7 +27,7 @@ const RUNNING = { k1c: "K1C", sbbuilder: "build", obs: "OBS" }; // the running
const G = { cpu: "", mem: "\u{f035b}", gpu: "\u{f08ae}", net: "\u{f04e1}",
wifi: "", charging: "\u{f0084}", tux: "", clock: "",
- todo: "\u{f0131}" };
+ todo: "\u{f0131}", done: "\u{f0135}" };
const BATTERY = ["", "", "", "", ""];
// Nerd Font distro logos by os-release ID.
const DISTRO = {
@@ -147,7 +147,7 @@ function gestures(el, { tap, hold, swipe }) {
el.addEventListener("pointerup", () => {
const wasTap = timer != null, wasSwipe = sliding && dx > el.offsetWidth / 3;
reset();
- if (wasSwipe) { el.style.transform = "translateX(110%)"; swipe(); }
+ if (wasSwipe) swipe();
else el.style.transform = "";
if (wasTap) tap();
});
@@ -330,15 +330,18 @@ export default {
todo.firstChild.title = st.error;
return;
}
- const act = async (name, id, line) => {
- let ok = false;
- try {
- ok = (await fetch(`/api/todo/${name}`, {
- method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ id }) })).ok;
- if (ok && name !== "open") drawTodo(await (await fetch("/api/todo")).json());
- } catch {}
+ // exit: the chip's leaving animation; the row is redrawn once both it
+ // and the request are over, so the animation is never cut short.
+ const act = async (name, id, line, exit) => {
+ const post = fetch(`/api/todo/${name}`, {
+ method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ id }) })
+ .then((r) => r.ok, () => false);
+ const [ok] = await Promise.all([post, exit?.finished.catch(() => {})]);
+ if (ok && exit) {
+ try { drawTodo(await (await fetch("/api/todo")).json()); } catch {}
+ }
if (!ok) { // back in place, red for a moment
- line.classList.remove("gone");
+ exit?.cancel();
line.style.transform = "";
line.classList.add("fail");
setTimeout(() => line.classList.remove("fail"), 1500);
@@ -354,8 +357,20 @@ export default {
line.querySelector(".due").textContent = due;
line.classList.toggle("late", due.startsWith("overdue"));
gestures(line, { tap: () => act("open", t.id, line),
- hold: () => { line.classList.add("gone"); act("done", t.id, line); },
- swipe: () => act("snooze", t.id, line) });
+ // done: a green check, then the chip shrinks away
+ hold: () => {
+ line.querySelector(".nf").textContent = G.done;
+ line.classList.add("done");
+ act("done", t.id, line, line.animate(
+ [{ opacity: 1, transform: "scale(1)", offset: 0.4 },
+ { opacity: 0, transform: "scale(0.6)" }],
+ { duration: 650, easing: "ease-in", fill: "forwards" }));
+ },
+ // snooze: the chip carries on to the right and fades
+ swipe: () => act("snooze", t.id, line, line.animate(
+ [{ transform: line.style.transform, opacity: 1 },
+ { transform: "translateX(120%)", opacity: 0 }],
+ { duration: 300, easing: "ease-out", fill: "forwards" })) });
todo.append(line);
}
if (tasks.length > 3) {
diff --git a/static/deck.css b/static/deck.css
index 04825a0..9731e25 100644
--- a/static/deck.css
+++ b/static/deck.css
@@ -758,7 +758,8 @@ select {
transition: transform .25s ease, opacity .25s ease, background-color .8s ease; }
.dash-todo .td.sliding { transition: none; }
.dash-todo .td.holding { background: color-mix(in srgb, var(--udt-green) 35%, var(--udt-surface0)); }
-.dash-todo .td.gone { opacity: 0; transform: scale(.97); }
+.dash-todo .td.done { background: color-mix(in srgb, var(--udt-green) 45%, var(--udt-surface0)); }
+.dash-todo .td.done .nf { color: var(--udt-green); }
.dash-todo .td.fail { background: color-mix(in srgb, var(--udt-red) 35%, var(--udt-surface0)); }
.dash-todo .td .nf { color: var(--udt-accent); font-size: 1.1rem; }
.dash-todo .td .col { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }