From 38af47aeb6b0009ad8dd0d2b3282929e0950ecc8 Mon Sep 17 00:00:00 2001 From: Aculix Technologies Date: Sun, 16 Aug 2026 03:25:35 +0530 Subject: [PATCH] feat: move a task between Today and Tomorrow The app is built around two days and had no way to move anything between them. "I won't get to this today" is the most obvious thing someone wants from a two-day list, and the only route was deleting the task and typing it again somewhere else. Each row gets an arrow next to delete. On Today it sends the task forward, on Tomorrow it points back, so one control covers both directions and the label says which one you are getting. Alt+Right and Alt+Left do the same from the keyboard, and each only acts in the direction that makes sense from the day you are on. The move itself is in src/lib/defer.js with tests, since it touches two date keys at once and the failure modes are worth pinning down: a missing id, the same day twice, an empty destination, and a task that somehow already exists on the other side. --- README.md | 3 ++ src/App.svelte | 42 +++++++++++++++++++++- src/lib/defer.js | 28 +++++++++++++++ src/lib/defer.test.js | 83 +++++++++++++++++++++++++++++++++++++++++++ src/style.css | 17 +++++---- 5 files changed, 166 insertions(+), 7 deletions(-) create mode 100644 src/lib/defer.js create mode 100644 src/lib/defer.test.js diff --git a/README.md b/README.md index 903c04b..96a215e 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ Built with Svelte for speed and simplicity. No overwhelming features, no endless - ↩️ **Undo** - `Cmd/Ctrl+Z` brings back a deleted task, in its original position - 📅 **Today & Tomorrow lists** - Plan ahead with separate task lists - 🔄 **Unfinished work carries over** - When a new day begins, tasks you didn't finish move to Today; completed ones are cleared away +- ➡️ **Push a task to tomorrow** - Didn't get to it? Move it across without retyping it - 🎯 **Reorder by drag or keyboard** - Drag with a mouse, long-press and drag on touch, or use `Alt+↑`/`Alt+↓` - 💾 **Persistent storage** - All tasks saved locally in your browser - 📊 **Task statistics** - See how many tasks remain at a glance @@ -90,6 +91,7 @@ The date, storage, rollover, task and undo logic lives in `src/lib/` as plain mo - **Complete a task**: Click the checkbox next to the task - **Delete a task**: Click the delete icon on the task (it shows on hover, and is always visible on touch), or press `Delete` with the task focused - **Undo a delete**: Press `Cmd/Ctrl+Z`. The task returns to where it was +- **Move a task to Tomorrow**: Click the arrow on the task, or press `Alt+→`. From Tomorrow, the arrow points back and `Alt+←` returns it to Today - **Reorder tasks**: Drag with a mouse, long-press then drag on touch, or focus a task and press `Alt+↑`/`Alt+↓` - **Clear input**: Press Escape while the input is focused @@ -128,6 +130,7 @@ Import only ever adds. Tasks already present are left alone, so importing the sa - **Delete**: Delete the focused task - **Cmd/Ctrl+Z**: Undo the last delete or clear-completed - **Alt+↑ / Alt+↓**: Move the focused task up or down +- **Alt+→ / Alt+←**: Send the focused task to Tomorrow, or bring it back to Today Backspace no longer deletes a task. It is too easily pressed by accident, and deletions used to be unrecoverable. diff --git a/src/App.svelte b/src/App.svelte index 6fbd9c7..80e9591 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -12,6 +12,7 @@ import { createUndoStack, applyUndo } from './lib/undo.js'; import { shouldHandleUndo } from './lib/shortcuts.js'; import { buildExport, serialize, parseImport, mergeImport } from './lib/backup.js'; + import { moveTaskToDay } from './lib/defer.js'; const storage = createStorage(); const undoStack = createUndoStack(); @@ -75,6 +76,15 @@ setTasks(taskOps.clearCompleted(tasks)); } + const viewingToday = $derived(selectedKey === todayKey); + + /** "Not today, tomorrow" and its reverse. Which direction depends only on + * which day you are looking at, so one control covers both. */ + function deferTask(taskId) { + const destination = viewingToday ? tomorrowKey() : todayKey; + tasks = moveTaskToDay(storage, selectedKey, destination, taskId); + } + function undo() { const entry = undoStack.pop(); if (entry) setTasks(applyUndo(tasks, entry)); @@ -183,6 +193,17 @@ if (event.altKey && (event.key === 'ArrowUp' || event.key === 'ArrowDown')) { event.preventDefault(); moveTask(taskId, event.key === 'ArrowUp' ? -1 : 1); + return; + } + + // Right sends a task forward to Tomorrow, left brings it back. Only the + // one that makes sense from here does anything. + if (event.altKey && event.key === 'ArrowRight' && viewingToday) { + event.preventDefault(); + deferTask(taskId); + } else if (event.altKey && event.key === 'ArrowLeft' && !viewingToday) { + event.preventDefault(); + deferTask(taskId); } } @@ -595,7 +616,26 @@ {task.text} + +