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
@@ -23,6 +23,9 @@
|
||||
let priority = $state(4);
|
||||
let dueDate = $state('');
|
||||
let dueTime = $state('');
|
||||
// Length in minutes, as a string for the field. Only meaningful with a time —
|
||||
// see the field below — so it is seeded and shown alongside the clock.
|
||||
let duration = $state('');
|
||||
let labels = $state('');
|
||||
let projectId = $state('');
|
||||
let recurrence = $state('');
|
||||
@@ -57,6 +60,7 @@
|
||||
priority = task.priority;
|
||||
dueDate = task.due_date ?? '';
|
||||
dueTime = task.due_datetime ? clockOf(task.due_datetime) : '';
|
||||
duration = task.duration_min ? String(task.duration_min) : '';
|
||||
labels = (task.labels ?? []).join(', ');
|
||||
projectId = task.project_id;
|
||||
recurrence = task.recurrence_rule ?? '';
|
||||
@@ -436,6 +440,21 @@
|
||||
disabled={!dueDate}
|
||||
onchange={() => save({ due_date: dueDate, due_time: dueTime })}
|
||||
/>
|
||||
<!-- Length in minutes, and only with a time to hang it on: a duration
|
||||
without a start is a length of nothing, and the calendar has
|
||||
nowhere to draw it. Empty clears it. -->
|
||||
<input
|
||||
type="number"
|
||||
class="dur"
|
||||
min="0"
|
||||
step="15"
|
||||
aria-label={t('detail.duration')}
|
||||
placeholder={t('detail.durationShort')}
|
||||
bind:value={duration}
|
||||
disabled={!dueTime}
|
||||
onchange={() =>
|
||||
save({ duration_min: duration === '' ? 0 : Math.max(0, Math.round(Number(duration))) })}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -731,6 +750,11 @@
|
||||
width: 7.5rem;
|
||||
}
|
||||
|
||||
.due input.dur {
|
||||
flex: none;
|
||||
width: 5rem;
|
||||
}
|
||||
|
||||
.due input:disabled {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user