feat(calendar): a task's length is drawn, resizable, and editable
A timed task was drawn at a fixed half hour whatever its `duration_min` said, so a length the data model already carried was invisible and uneditable. Three parts: - The calendar draws a task at its real length — a quarter-hour floor so a zero-minute task is still grabbable, the day's end as the ceiling — instead of a flat thirty minutes. A ninety-minute task now looks like ninety minutes. - A grip along the foot of a timed task drags its length. Pointer events, not the HTML5 drag the body uses, and stopPropagation between them — otherwise making a task longer would pick it up and move it instead. It snaps to the quarter hour, follows the handle live, and writes once on release through a new store `resize`. Moving a task (the existing day/time drag) leaves the length alone. - The task drawer gains a length field beside the time — minutes, shown only with a time to hang it on, since a duration without a start is a length of nothing and the calendar has nowhere to draw it. So a length can be set off the calendar too. e2e: dragging the foot of a task makes it longer both on screen and in what the server stores, and the time does not move. Full Chromium suite green. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
e3eeb3037c
commit
4f25905d81
@@ -403,6 +403,19 @@ class AppState {
|
||||
await this.update(id, { due_date: date, due_time: clock });
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets how long a task is, in minutes. Nothing else about it moves — the date
|
||||
* and time are left alone, so making a task longer on the calendar does not
|
||||
* also reschedule it.
|
||||
*/
|
||||
async resize(id, minutes) {
|
||||
const previous = this.get(id);
|
||||
if (!previous) return;
|
||||
const rounded = Math.max(15, Math.round(minutes / 15) * 15);
|
||||
if (previous.duration_min === rounded) return;
|
||||
await this.update(id, { duration_min: rounded });
|
||||
}
|
||||
|
||||
async remove(id) {
|
||||
const previous = [...this.tasks];
|
||||
this.tasks = this.tasks.filter((t) => t.id !== id);
|
||||
|
||||
Reference in New Issue
Block a user