Native iCloud apps for Windows and Linux, built in Rust. Notes, Reminders, Calendar, Contacts, Drive and Photos, offline and in sync with your iPhone.
Rust apple-notesapple-reminderscloudkitcrdtdesktop-appicloudicloud-calendaricloud-driveicloud-notesicloud-photosiphonelinuxlinux-desktoplocal-firstoffline-firstprivacyrusttauritauri-appwindows
Calendar: drag an event's bottom edge to change when it ends
Yashwanth Kamireddi1c36b793f7fb
diff --git a/.uiverify/calendar.mjs b/.uiverify/calendar.mjsindex fdba144..d9aeeb9 100644--- a/.uiverify/calendar.mjs+++ b/.uiverify/calendar.mjs@@ -219,6 +219,31 @@ ok(/Sep/.test(title) && /Oct/.test(title), `a week across two months is named foawait tall.close();}+// An event's bottom edge, dragged, changes when it ends — its start stays where it was.+{+ const p = await ctx.newPage();+ await p.goto("http://localhost:4173", { waitUntil: "networkidle" });+ await p.getByRole("button", { name: "Week", exact: true }).click();+ await p.waitForTimeout(300);+ const grip = p.locator(".cx-block", { hasText: "New Event" }).first().locator(".cx-block-grip");+ const box = await grip.boundingBox();+ if (!box) {+ ok(false, "", "the event has no edge to drag");+ } else {+ await p.mouse.move(box.x + box.width / 2, box.y + box.height / 2);+ await p.mouse.down();+ await p.mouse.move(box.x + box.width / 2, box.y + box.height / 2 + 48, { steps: 6 });+ await p.mouse.up();+ await p.waitForTimeout(300);+ const saved = await p.evaluate(() => (window.__saved ?? []).at(-1));+ const start = Math.floor(new Date(2026, 8, 29, 19, 0).getTime() / 1000);+ ok(saved && saved.startsAt === start && saved.endsAt === start + 75 * 60,+ "dragging an event's bottom edge changes its end, not its start",+ `saved: ${JSON.stringify(saved && { startsAt: saved.startsAt - start, endsAt: saved.endsAt - start })}`);+ }+ await p.close();+}+// A delete iCloud turns down says so in a sentence, with a way to put it away — not a red// line of the request and Apple's JSON under the toolbar.{diff --git a/src/screens/calendar/CalendarView.tsx b/src/screens/calendar/CalendarView.tsxindex b572042..db553de 100644--- a/src/screens/calendar/CalendarView.tsx+++ b/src/screens/calendar/CalendarView.tsx@@ -902,7 +902,9 @@ function MonthView({type Drag =| { kind: "create"; day: Date; column: number; from: number; to: number }- | { kind: "move"; event: CalendarEvent; startX: number; startY: number; dx: number; dMinutes: number };+ | { kind: "move"; event: CalendarEvent; startX: number; startY: number; dx: number; dMinutes: number }+ /** Dragging an event's bottom edge: its end moves, its start stays. */+ | { kind: "resize"; event: CalendarEvent; startY: number; dMinutes: number };function TimeGrid({days,@@ -985,6 +987,10 @@ function TimeGrid({if (!current || !at) return;if (current.kind === "create") {setDragNow({ ...current, to: Math.max(current.from + 15, snap(at.minutes)) });+ } else if (current.kind === "resize") {+ // Never shorter than a quarter hour, as Calendar holds it.+ const length = (current.event.endsAt - current.event.startsAt) / 60;+ setDragNow({ ...current, dMinutes: Math.max(15 - length, snap(((clientY - current.startY) / HOUR) * 60)) });} else {const el = columnsEl.current;const width = el ? el.getBoundingClientRect().width / days.length : 1;@@ -1007,6 +1013,8 @@ function TimeGrid({const base = seconds(done.day);onCreate(base + done.from * 60, base + done.to * 60, false, besideColumn(done.column, clientY));}+ } else if (done.kind === "resize") {+ if (done.dMinutes !== 0) onMove(done.event, done.event.startsAt, done.event.endsAt + done.dMinutes * 60);} else if (done.dx !== 0 || done.dMinutes !== 0) {const shift = done.dMinutes * 60;const moved = (t: number) => {@@ -1176,16 +1184,17 @@ function TimeGrid({<div className={`cx-column${d.getDay() === 0 || d.getDay() === 6 ? " is-weekend" : ""}`} key={dayKey(d)}>{layouts[column].events.map((p) => {const moving = drag?.kind === "move" && drag.event.guid === p.event.guid ? drag : null;+ const sizing = drag?.kind === "resize" && drag.event.guid === p.event.guid ? drag : null;const c = calendars.get(p.event.calendarGuid);return (<buttonkey={p.event.guid}- className={`cx-block${moving ? " is-moving" : ""}${p.length < 45 ? " is-short" : ""}`}+ className={`cx-block${moving || sizing ? " is-moving" : ""}${p.length < 45 ? " is-short" : ""}`}style={{"--cal": tint(c),top: `${((p.top + (moving?.dMinutes ?? 0)) / 60) * HOUR}px`,- height: `${Math.max((p.length / 60) * HOUR - 2, 20)}px`,+ height: `${Math.max(((p.length + (sizing?.dMinutes ?? 0)) / 60) * HOUR - 2, 20)}px`,left: `calc(${(p.column / p.columns) * 100}% + ${(moving?.dx ?? 0) * 100}%)`,width: `calc(${100 / p.columns}% - 3px)`,} as React.CSSProperties@@ -1210,6 +1219,18 @@ function TimeGrid({<span className="cx-block-title">{p.event.title}</span><span className="cx-block-time">{clock(p.event.startsAt)}</span>{p.event.location && <span className="cx-block-where">{p.event.location}</span>}+ {canWrite(p.event.calendarGuid) && (+ <span+ className="cx-block-grip"+ aria-hidden="true"+ onPointerDown={(e) => {+ if (e.button !== 0) return;+ e.stopPropagation();+ e.preventDefault();+ setDragNow({ kind: "resize", event: p.event, startY: e.clientY, dMinutes: 0 });+ }}+ />+ )}</button>);})}diff --git a/src/styles/calendar.css b/src/styles/calendar.cssindex 54d16cc..1461746 100644--- a/src/styles/calendar.css+++ b/src/styles/calendar.css@@ -664,3 +664,6 @@font-weight: 600;cursor: default;}++/* The bottom edge of an event that can be changed: drag it to change when it ends. */+.cx-block-grip { position: absolute; left: 0; right: 0; bottom: 0; height: 7px; cursor: ns-resize; }