Skip to content

Native iCloud apps for Windows and Linux, built in Rust. Notes, Reminders, Calendar, Contacts, Drive and Photos, offline and in sync with your iPhone.

Calendar instant writes + URL kept on edit; read-only events as info cards; calmer popover; Notes Delete Now/Recover from Recently Deleted; no doubled Notes folder

Yashwanth Kamireddidfafc0488dd0
diff --git a/.uiverify/calendar-instant.mjs b/.uiverify/calendar-instant.mjs
new file mode 100644
index 0000000..a608e1f
--- /dev/null
+++ b/.uiverify/calendar-instant.mjs
@@ -0,0 +1,56 @@
+// Calendar writes show at once, and an edit keeps what the editor does not show.
+// The stub holds every write for 1.5 s, as a slow network would.
+import { engine } from "./engine.mjs";
+import { SERVICES, installStub, openScreen } from "./stub.mjs";
+
+const b = await engine.launch();
+const ctx = await b.newContext({ viewport: { width: 1300, height: 850 } });
+await ctx.addInitScript(installStub, { screen: "library", services: SERVICES, twoFactor: null, calendarFixture: true });
+await ctx.addInitScript(() => {
+ window.__saves = [];
+ const wrap = () => {
+ const t = window.__TAURI_INTERNALS__;
+ if (!t || t.__slow) return;
+ const inner = t.invoke;
+ t.invoke = async (cmd, args) => {
+ if (cmd === "event_save") window.__saves.push(args);
+ if (cmd === "event_save" || cmd === "event_delete") await new Promise((r) => setTimeout(r, 1500));
+ const out = await inner(cmd, args);
+ if (cmd === "calendar_events" && Array.isArray(out))
+ return out.map((e) => (e.guid === "e2" ? { ...e, url: "https://meet.example/dentist" } : e));
+ return out;
+ };
+ t.__slow = true;
+ };
+ wrap(); document.addEventListener("DOMContentLoaded", wrap);
+});
+const page = await ctx.newPage();
+await page.goto("http://localhost:4173", { waitUntil: "networkidle" });
+await openScreen(page, "Calendar");
+await page.keyboard.press("Control+2");
+await page.waitForTimeout(400);
+let failures = 0;
+const ok = (p, m) => { console.log(`${p ? "PASS" : "FAIL"} ${m}`); if (!p) failures++; };
+
+// An edit sends the event's link back as it was.
+await page.locator(".cx-block", { hasText: "Dentist" }).first().click();
+await page.waitForTimeout(300);
+const title = page.locator('input[placeholder="New Event"]').first();
+await title.fill("Dentist, again");
+await title.press("Enter");
+await page.waitForTimeout(150);
+ok(await page.locator(".cx-block", { hasText: "Dentist, again" }).count() > 0, "a retitled event shows its new title at once");
+await page.waitForTimeout(1800);
+const sent = await page.evaluate(() => window.__saves.at(-1));
+ok(sent?.draft?.url === "https://meet.example/dentist",
+ `an edit keeps the event's link [${JSON.stringify(sent?.draft?.url)}]`);
+
+// A delete takes the event off the calendar at once.
+await page.locator(".cx-block", { hasText: "Design review" }).first().click();
+await page.waitForTimeout(250);
+await page.evaluate(() => document.activeElement?.blur());
+await page.keyboard.press("Delete");
+await page.waitForTimeout(150);
+ok(await page.locator(".cx-block", { hasText: "Design review" }).count() === 0, "a deleted event leaves at once");
+await b.close();
+process.exitCode = failures ? 1 : 0;
diff --git a/.uiverify/occasions.mjs b/.uiverify/occasions.mjs
index 6ed9b3c..74b2c0b 100644
--- a/.uiverify/occasions.mjs
+++ b/.uiverify/occasions.mjs
@@ -31,11 +31,13 @@ const pop = await page.evaluate(() => {
return p && {
del: Boolean(p.querySelector(".cx-pop-delete")),
buttons: [...p.querySelectorAll("button")].map((x) => x.textContent.trim()),
- editable: [...p.querySelectorAll("input, textarea")].some((i) => !i.readOnly && !i.disabled && i.type !== "checkbox"),
+ fields: p.querySelectorAll("input, textarea, select").length,
+ title: p.querySelector(".cx-info-title")?.textContent,
};
});
-ok(pop && !pop.del && pop.buttons.includes("Close") && !pop.editable,
- "a birthday opens read-only, with Close and nothing to delete", `its popover: ${JSON.stringify(pop)}`);
+// As Calendar shows one: what it is and when, not a form of fields that cannot be used.
+ok(pop && !pop.del && pop.fields === 0 && pop.title === "Zoya Ahuja’s Birthday",
+ "a birthday opens as an info card, with no fields and nothing to delete", `its popover: ${JSON.stringify(pop)}`);
await page.keyboard.press("Escape");
await page.locator(".cx-cal", { hasText: "Birthdays" }).click().catch(async () => {
diff --git a/check.sh b/check.sh
index 610e6fe..13eface 100755
--- a/check.sh
+++ b/check.sh
@@ -50,6 +50,7 @@ step "birthdays in contacts" node .uiverify/contact-birthday.mjs
step "empty today" node .uiverify/reminders-empty.mjs
step "calendar keys" node .uiverify/calendar-keys.mjs
step "reminders instant" node .uiverify/reminders-instant.mjs
+step "calendar instant" node .uiverify/calendar-instant.mjs
# The same screens in WebKit, the engine Quince draws in. Chromium above catches most things;
# this catches what only WebKit does — pointer capture, blur on removal, its own layout.
diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs
index 400feae..e96378f 100644
--- a/src-tauri/src/main.rs
+++ b/src-tauri/src/main.rs
@@ -883,10 +883,14 @@ async fn resync_notes(
/// One note, by record name. `None` once Apple no longer has it.
async fn note_by_guid(data: &State<'_, Data>, guid: &str) -> Result<Note, String> {
let library = data.0.lock().await;
- library
- .notes_in(None)
- .map_err(|e| e.to_string())?
- .into_iter()
+ // Recently Deleted too: "All" leaves it out, and Delete Now and Recover act on what is
+ // in it — looking only in "All" answered every one of them "no longer in the library".
+ let all = library.notes_in(None).map_err(|e| e.to_string())?;
+ let trash = library
+ .notes_in(Some(quince_core::notes::TRASH_FOLDER))
+ .map_err(|e| e.to_string())?;
+ all.into_iter()
+ .chain(trash)
.find(|n| n.guid == guid)
.ok_or_else(|| "That note is no longer in the local library.".into())
}
diff --git a/src/screens/NotesView.tsx b/src/screens/NotesView.tsx
index dc173d9..5378556 100644
--- a/src/screens/NotesView.tsx
+++ b/src/screens/NotesView.tsx
@@ -554,18 +554,22 @@ export function NotesView() {
</p>
{!composing && open && !open.locked && (
<div className="note-bar-actions">
- <Picker
+ {!inTrash && <Picker
label={`Folder for ${open.title}`}
value={open.folderGuid ?? ALL}
disabled={busy}
onChange={(guid) => void moveTo(guid)}
options={[
- { value: ALL, label: "Notes" },
+ // "No folder" only for an account without Apple's default "Notes" folder;
+ // with one, it was a second "Notes" that meant something else.
+ ...(folders.some((f) => f.guid === "DefaultFolder-CloudKit")
+ ? []
+ : [{ value: ALL, label: "Notes" }]),
...folders
.filter((f) => f.guid !== TRASH_FOLDER)
.map((f) => ({ value: f.guid, label: f.title })),
]}
- />
+ />}
{!inTrash && (
<button
className="notes-icon"
diff --git a/src/screens/calendar/CalendarView.tsx b/src/screens/calendar/CalendarView.tsx
index bf49ef5..7aca64f 100644
--- a/src/screens/calendar/CalendarView.tsx
+++ b/src/screens/calendar/CalendarView.tsx
@@ -73,6 +73,9 @@ type Draft = {
endsAt: number;
allDay: boolean;
notes: string;
+ /** Carried through untouched: the editor has no field for it yet, and sending null wiped
+ * the link off every event that was edited, moved or resized here. */
+ url: string | null;
};
const draftOf = (e: CalendarEvent): Draft => ({
@@ -84,6 +87,7 @@ const draftOf = (e: CalendarEvent): Draft => ({
endsAt: e.endsAt,
allDay: e.allDay,
notes: e.notes ?? "",
+ url: e.url,
});
/** `YYYY-MM-DDTHH:mm` and `YYYY-MM-DD` for the date inputs, in local time. */
@@ -263,17 +267,23 @@ export function CalendarView() {
return next;
});
- /** Every write goes to Apple first, then the library is re-read. */
+ /**
+ * Every write shows at once — an event moved, resized, retitled or deleted is drawn that
+ * way the moment it is asked for — then goes to Apple and the library is re-read. A
+ * refusal re-reads, which puts the event back where it was, and says why.
+ */
const write = useCallback(
- async (run: () => Promise<void>) => {
+ async (run: () => Promise<void>, predict?: (rows: CalendarEvent[]) => CalendarEvent[]) => {
setBusy(true);
setError(null);
+ if (predict) setEvents((rows) => predict(rows));
try {
await run();
await read();
return true;
} catch (e) {
setError(messageOf(e));
+ read().catch(() => {});
return false;
} finally {
setBusy(false);
@@ -295,8 +305,17 @@ export function CalendarView() {
allDay: d.allDay,
timezone: ZONE,
notes: d.notes.trim() || null,
- url: null,
+ url: d.url,
});
+ }, (rows) => {
+ // Shown where it now sits at once; a new one is drawn by its draft until Apple names it.
+ if (!d.guid) return rows;
+ return rows.map((e) => e.guid === d.guid ? {
+ ...e, calendarGuid: d.calendarGuid, title: d.title.trim() || "New Event",
+ location: d.location.trim() || null, startsAt: d.startsAt,
+ endsAt: Math.max(d.endsAt, d.startsAt + (d.allDay ? 86_400 : 900)),
+ allDay: d.allDay, notes: d.notes.trim() || null,
+ } : e);
}),
[write]
);
@@ -308,8 +327,8 @@ export function CalendarView() {
const remove = useCallback(
async (guid: string) => {
const gone = events.find((e) => e.guid === guid) ?? null;
- if (await write(() => api.eventDelete(guid))) {
- setDraft(null);
+ setDraft(null);
+ if (await write(() => api.eventDelete(guid), (rows) => rows.filter((e) => e.guid !== guid))) {
setUndo(gone);
}
},
@@ -333,7 +352,7 @@ export function CalendarView() {
const newAt = (startsAt: number, endsAt: number, allDay: boolean, at: Anchor) => {
if (!target) return;
openDraft(
- { guid: null, calendarGuid: target.guid, title: "", location: "", startsAt, endsAt, allDay, notes: "" },
+ { guid: null, calendarGuid: target.guid, title: "", location: "", startsAt, endsAt, allDay, notes: "", url: null },
at
);
};
@@ -1495,6 +1514,36 @@ function EventPopover({
}, [onClose, onDelete, editable]);
const set = (patch: Partial<Draft>) => onChange({ ...draft, ...patch });
+
+ // A holiday, a birthday, a subscribed feed: nothing to change, so Calendar shows what it
+ // is — not a form of greyed fields with a note saying they cannot be used.
+ if (!editable) {
+ const start = dateOf(draft.startsAt);
+ const end = dateOf(Math.max(draft.startsAt, draft.endsAt - (draft.allDay ? 86_400 : 0)));
+ const day = (d: Date) => d.toLocaleDateString(undefined, { weekday: "long", day: "numeric", month: "long", year: "numeric" });
+ const time = (d: Date) => d.toLocaleTimeString(undefined, { hour: "numeric", minute: "2-digit" });
+ const sameDay = start.toDateString() === end.toDateString();
+ const when = draft.allDay
+ ? sameDay ? day(start) : `${day(start)} – ${day(end)}`
+ : sameDay ? `${day(start)}, ${time(start)} – ${time(end)}` : `${day(start)}, ${time(start)} – ${day(end)}, ${time(end)}`;
+ return (
+ <form
+ ref={box}
+ className="cx-popover is-info"
+ role="dialog"
+ aria-label={draft.title || "Event"}
+ style={{ left: pos.left, top: pos.top, "--cal": tint(calendar) } as React.CSSProperties}
+ onSubmit={(e) => { e.preventDefault(); onClose(); }}
+ >
+ <h3 className="cx-info-title">{draft.title}</h3>
+ {draft.location && <p className="cx-info-line">{draft.location}</p>}
+ <p className="cx-info-line">{when}</p>
+ <p className="cx-info-cal"><span className="cx-info-dot" aria-hidden="true" />{calendar?.title}</p>
+ {draft.notes && <p className="cx-info-notes">{draft.notes}</p>}
+ </form>
+ );
+ }
+
return (
<form
ref={box}
@@ -1604,7 +1653,6 @@ function EventPopover({
)}
</span>
</div>
- {!editable && <p className="cx-pop-note">This calendar can be read here but not changed.</p>}
</form>
);
}
diff --git a/src/styles/calendar.css b/src/styles/calendar.css
index 3a43b72..6b0e5c8 100644
--- a/src/styles/calendar.css
+++ b/src/styles/calendar.css
@@ -583,9 +583,19 @@
border-radius: 12px;
background: var(--sheet);
box-shadow: var(--shadow-sheet);
- animation: cx-pop 160ms var(--ease) both;
-}
-@keyframes cx-pop { from { opacity: 0; transform: scale(0.97); } to { opacity: 1; transform: none; } }
+ /* Opacity and a small lift only, on the compositor: scaling from the corner read as a
+ jump toward the click, and re-ran on every re-anchor. */
+ animation: cx-pop 140ms cubic-bezier(0.2, 0.9, 0.3, 1) both;
+ will-change: opacity, transform;
+}
+@keyframes cx-pop { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
+@media (prefers-reduced-motion: reduce) { .cx-popover { animation: none; } }
+.cx-popover.is-info { gap: 4px; width: 280px; padding: 14px 16px; }
+.cx-info-title { margin: 0 0 2px; font-size: var(--t-17); font-weight: 700; line-height: 1.25; }
+.cx-info-line { margin: 0; font-size: var(--t-13); color: var(--text-2); }
+.cx-info-cal { display: flex; align-items: center; gap: 6px; margin: 6px 0 0; font-size: var(--t-13); color: var(--text-2); }
+.cx-info-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--cal); }
+.cx-info-notes { margin: 8px 0 0; padding-top: 8px; border-top: 1px solid var(--separator); font-size: var(--t-13); white-space: pre-wrap; }
.cx-popover input,
.cx-popover textarea {
border: 0;