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
Reminders: drag a reminder onto another list to move it there
Yashwanth Kamireddi87e6f0d6618b
diff --git a/.uiverify/reminders-drag-list.mjs b/.uiverify/reminders-drag-list.mjsnew file mode 100644index 0000000..6b5a821--- /dev/null+++ b/.uiverify/reminders-drag-list.mjs@@ -0,0 +1,40 @@+// A reminder dragged onto another list in the sidebar moves to it, as on the Mac: it leaves the+// list on screen at once and the move goes to Apple. Dropped on its own list, nothing happens.+// BASE=http://localhost:4173 ENGINE=webkit node .uiverify/reminders-drag-list.mjs+import { engine } from "./engine.mjs";+import { SERVICES, installStub, openScreen } from "./stub.mjs";++const BASE = process.env.BASE ?? "http://localhost:4173";+const b = await engine.launch();+let failures = 0;+const ok = (p, m) => { console.log(`${p ? "PASS" : "FAIL"} ${m}`); if (!p) failures++; };+const until = (page, fn, arg) => page.waitForFunction(fn, arg, { timeout: 8000, polling: "raf" }).then(() => true, () => false);++const ctx = await b.newContext({ viewport: { width: 1200, height: 800 } });+await ctx.addInitScript(() => { window.__filterLists = true; window.__keepMoves = true; });+await ctx.addInitScript(installStub, { screen: "library", services: SERVICES, twoFactor: null, remindersFixture: true });+const page = await ctx.newPage();+page.on("pageerror", (e) => ok(false, `page error: ${e.message}`));+await page.goto(BASE, { waitUntil: "networkidle" });+await openScreen(page, "Reminders");+await page.locator(".rx-list", { hasText: "Daily" }).click();+await until(page, () => document.querySelector('.rx-row[data-guid="r1"]'));++// Onto its own list: nothing.+await page.locator('.rx-row[data-guid="r1"]').dragTo(page.locator(".rx-list", { hasText: "Daily" }));+await page.waitForTimeout(300);+ok(!(await page.evaluate(() => (window.__edits ?? []).some((e) => "listGuid" in e))), "dropped on its own list, nothing moves");++// Onto GYM: it moves there.+await page.locator('.rx-row[data-guid="r1"]').dragTo(page.locator(".rx-list", { hasText: "GYM" }));+ok(await until(page, () => (window.__edits ?? []).some((e) => e.listGuid === "l2")), "dropped on another list, it is moved there");+ok(await until(page, () => !document.querySelector('.rx-row[data-guid="r1"]')), "and leaves the list on screen");+ok(await page.locator(".rx-list.is-drop-target").count() === 0, "with no list left marked");++await page.locator(".rx-list", { hasText: "GYM" }).click();+ok(await until(page, () => [...document.querySelectorAll(".rx-row .rx-title")].some((t) => t.value === "Plan tomorrow")), "and is in the list it was dropped on");++await ctx.close();+await b.close();+console.log(failures ? `\n${failures} FAILED` : "\nall passed");+process.exit(failures ? 1 : 0);diff --git a/.uiverify/stub.mjs b/.uiverify/stub.mjsindex 42590c5..43de881 100644--- a/.uiverify/stub.mjs+++ b/.uiverify/stub.mjs@@ -333,7 +333,8 @@ export function installStub({ screen, services, twoFactor, calendarFixture, note(window.__edits ??= []).push(args.edit);// Kept, as Apple keeps it, so the read after a write shows the write.const r = [...reminderItems, ...(window.__extraReminders ?? [])].find((x) => x.guid === args.guid);- if (r) for (const [k, v] of Object.entries(args.edit)) if (k !== "listGuid") r[k] = v;+ // A move to another list is kept only where a suite asks (`__keepMoves`).+ if (r) for (const [k, v] of Object.entries(args.edit)) if (k !== "listGuid" || window.__keepMoves) r[k] = v;return null;}case "reminder_reorder": {diff --git a/src/screens/RemindersView.tsx b/src/screens/RemindersView.tsxindex fceeb31..e71ff50 100644--- a/src/screens/RemindersView.tsx+++ b/src/screens/RemindersView.tsx@@ -1112,7 +1112,8 @@ export function RemindersView() {// The reminder the keys act on: the row the focus is in, or the one whose details are open.const chosen = () => {const row = (document.activeElement as HTMLElement | null)?.closest?.<HTMLElement>(".rx-row");- const guid = row?.dataset.guid ?? openGuid;+ // In a row with no reminder yet (the next one being typed), there is none to act on.+ const guid = row ? (row.dataset.guid ?? null) : openGuid;return guid ? (items.find((r) => r.guid === guid) ?? null) : null;};if (command && e.shiftKey && (k === "f" || k === "c")) {@@ -1778,6 +1779,26 @@ export function RemindersView() {e.preventDefault();setListMenu({ list, at: { x: e.clientX, y: e.clientY, alignRight: false } });}}+ // A reminder dragged onto another list moves to it, its subtasks with it, as on the+ // Mac. Marked on the element itself while it is over it, as the rows mark a drop.+ onDragOver={(e) => {+ const moving = draggingRef.current ? items.find((x) => x.guid === draggingRef.current) : null;+ if (!moving || moving.listGuid === list.guid) return;+ e.preventDefault();+ e.dataTransfer.dropEffect = "move";+ e.currentTarget.classList.add("is-drop-target");+ }}+ onDragLeave={(e) => e.currentTarget.classList.remove("is-drop-target")}+ onDrop={(e) => {+ e.currentTarget.classList.remove("is-drop-target");+ const moving = draggingRef.current ? items.find((x) => x.guid === draggingRef.current) : null;+ if (!moving || moving.listGuid === list.guid) return;+ e.preventDefault();+ markDrop(null);+ draggingRef.current = null;+ setDragging(null);+ void moveToList(moving, list.guid);+ }}><span className="rx-badge" style={{ background: colourOf(list) }}><Glyph name={emblemGlyph(list.emblem)} />diff --git a/src/styles/reminders.css b/src/styles/reminders.cssindex e489e23..fe9a84d 100644--- a/src/styles/reminders.css+++ b/src/styles/reminders.css@@ -568,6 +568,8 @@ button.rx-tag:hover { background: color-mix(in srgb, var(--text) 12%, transparen.rx-row[draggable="true"] { cursor: grab; }.rx-row.is-dragging { opacity: 0.45; }.rx-row.is-drop-before { box-shadow: inset 0 2px 0 var(--sys-blue, #0a84ff); }+/* A list a dragged reminder would move to, ringed as the Mac's sidebar rings a drop target. */+.rx-list.is-drop-target { box-shadow: inset 0 0 0 2px var(--sys-blue, #0a84ff); }/* A row's marks, as the phone's list shows them: another zone's clock beside the time, theUrgent alarm, and chips for a place, a person and a link. */