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
Fix the layout on a full-size window
Yashwanth Kamireddi1cf28a38fdef
diff --git a/.uiverify/assert.mjs b/.uiverify/assert.mjsindex 5743e3f..aee54d2 100644--- a/.uiverify/assert.mjs+++ b/.uiverify/assert.mjs@@ -3,6 +3,17 @@ import { chromium } from "playwright";const b = await chromium.launch();const ctx = await b.newContext({ viewport: { width: 1040, height: 900 } });await ctx.addInitScript(({ services }) => {+ // Enough reminders to measure a real row. The checks below are about layout, so the data+ // only has to be shaped right.+ const lists = [+ { guid: "L1", title: "Quizzes & Exams", colour: "#c8912a", ctag: null, sortOrder: 0, enabled: true },+ { guid: "L2", title: "Life Goals", colour: "#1badf8", ctag: null, sortOrder: 1, enabled: true },+ ];+ const items = [+ { guid: "R1", listGuid: "L1", title: "Plan tomorrow", notes: null,+ dueAt: 4102444800, completedAt: null, priority: 0, flagged: false, parentGuid: null,+ recurFrequency: null, recurInterval: null, etag: "t1" },+ ];window.__TAURI_INTERNALS__ = {transformCallback: (cb) => cb,invoke: async (cmd) => {@@ -15,15 +26,15 @@ await ctx.addInitScript(({ services }) => {if (cmd === "event_delete") return null;if (cmd === "calendar_sync") return { calendars: 0, events: 0 };if (cmd === "reminder_counts") return { today: 4, scheduled: 7, flagged: 2, all: 12, lists: [["L1", 5], ["L2", 3], ["lists", 4]] };- if (cmd === "reminder_lists") return [];- if (cmd === "reminders_in") return [];+ if (cmd === "reminder_lists") return lists;+ if (cmd === "reminders_in") return items;if (cmd === "reminders_due_between") return [];if (cmd === "reminder_create") return null;if (cmd === "reminder_delete") return null;if (cmd === "reminder_set_done") return null;if (cmd === "reminder_set_repeat") return null;if (cmd === "reminder_edit") return null;- if (cmd === "reminders_smart") return [];+ if (cmd === "reminders_smart") return items;if (cmd === "reminder_list_create" || cmd === "reminder_list_rename" || cmd === "reminder_list_delete") return null;if (cmd === "note_folders") return [];if (cmd === "notes_in") return [];@@ -115,5 +126,58 @@ let failures = 0;await page.close();}++// ── Nothing is truncated, and nothing is stranded, on a real-sized window ──────────────+// Both of these shipped: "Quizzes & Ex…" and "Recently Delet…" cut off in sidebars that+// were too narrow, and list rows capped so tightly that on a wide display they sat in the+// left third with their separators ending in mid-air. A picture would not have caught+// either; measuring does.+{+ const page = await ctx.newPage();+ await page.setViewportSize({ width: 1920, height: 1080 });+ await page.goto("http://localhost:4173", { waitUntil: "networkidle" });++ const clipped = (selector) =>+ page.$$eval(selector, (nodes) =>+ nodes+ .filter((n) => n.scrollWidth > n.clientWidth + 1)+ .map((n) => n.textContent?.trim().slice(0, 30))+ );++ for (const [screen, selector] of [+ ["Reminders", ".rem-list-name, .rem-smart-name"],+ ["Notes", ".notes-folders .note-folder, .notes-folders button"],+ ]) {+ await page.getByRole("button", { name: screen, exact: true }).click();+ await page.waitForTimeout(400);+ const cut = await clipped(selector);+ console.log(+ cut.length === 0+ ? `PASS ${screen} sidebar shows every name in full`+ : `FAIL ${screen} sidebar truncates: ${JSON.stringify(cut)}`+ );+ if (cut.length > 0) failures++;+ }++ // A list that occupies a sliver of a wide pane reads as broken, whatever it says.+ await page.getByRole("button", { name: "Reminders", exact: true }).click();+ await page.waitForTimeout(400);+ const fill = await page.evaluate(() => {+ const pane = document.querySelector(".rem-items");+ const row = document.querySelector(".rem-list-items li, .rem-add");+ if (!pane || !row) return null;+ return row.getBoundingClientRect().width / pane.getBoundingClientRect().width;+ });+ console.log(+ fill === null+ ? "FAIL could not measure the reminders list"+ : fill >= 0.9+ ? `PASS reminder rows fill their pane (${Math.round(fill * 100)}%)`+ : `FAIL reminder rows fill only ${Math.round(fill * 100)}% of their pane`+ );+ if (fill === null || fill < 0.9) failures++;+ await page.close();+}+await b.close();process.exitCode = collapsed && selectsBuilt && failures === 0 ? 0 : 1;diff --git a/.uiverify/shots.mjs b/.uiverify/shots.mjsindex e8693c1..46d48e4 100644--- a/.uiverify/shots.mjs+++ b/.uiverify/shots.mjs@@ -245,6 +245,21 @@ const shots = [await p.waitForTimeout(200);await p.click('.rem-more >> nth=0');} },+ // A full-screen window on a large display is where content stranded in a narrow column+ // becomes obvious, and every shot above is too small to show it.+ { name: "14-reminders-wide", screen: "library", theme: "dark", remindersFixture: true,+ viewport: { width: 1920, height: 1080 },+ act: async (p) => {+ await p.click('.nav-item:has-text("Reminders")');+ await p.waitForSelector(".rem-list-items li");+ } },+ { name: "15-notes-full", screen: "library", theme: "dark", notesFixture: true,+ viewport: { width: 1920, height: 1080 },+ act: async (p) => {+ await p.click('.nav-item:has-text("Notes")');+ await p.waitForSelector(".note-rows .note-row");+ await p.click('.note-row:has-text("These sources")');+ } },{ name: "04-library", screen: "library", theme: "light" },{ name: "05-library-dark", screen: "library", theme: "dark" },];diff --git a/Cargo.lock b/Cargo.lockindex 20decd6..e0f5987 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -3204,6 +3204,7 @@ name = "quince-probe"version = "0.0.0"dependencies = ["anyhow",+ "base64 0.22.1","jiff","quince-auth","quince-core",diff --git a/probe/Cargo.toml b/probe/Cargo.tomlindex d2af204..6441358 100644--- a/probe/Cargo.toml+++ b/probe/Cargo.toml@@ -11,6 +11,7 @@ serde_json.workspace = truetokio.workspace = truerpassword = "7"jiff = "0.2.37"+base64 = "0.22"uuid.workspace = truequince-auth = { path = "../crates/quince-auth" }quince-core = { path = "../crates/quince-core" }diff --git a/probe/src/main.rs b/probe/src/main.rsindex 75e4c69..69bcdc7 100644--- a/probe/src/main.rs+++ b/probe/src/main.rs@@ -1938,6 +1938,174 @@ async fn main() -> Result<()> {}}+ // ---- how does a reminder belong to a section? ----------------------------------+ // No reminder field names a section, so membership is expressed some other way. Find it+ // before building anything on a guess.+ println!("\n\x1b[1m── Reminders: how section membership is expressed ──\x1b[0m");+ if let Some(ck) = session.service_url("ckdatabasews") {+ let zc = quince_icloud::cloudkit::ZoneClient::new(+ client.http(),+ &ck,+ "com.apple.reminders",+ client.service_params(),+ );+ if let Ok(quince_icloud::cloudkit::ZoneWalk { records, .. }) =+ zc.all_records("Reminders", None).await+ {+ let sections: std::collections::HashMap<String, String> = records+ .iter()+ .filter(|r| r.get("recordType").and_then(|t| t.as_str()) == Some("ListSection"))+ .filter(|r| !quince_icloud::cloudkit::field::flag(r, "Deleted"))+ .filter_map(|r| {+ Some((+ quince_icloud::cloudkit::field::record_name(r)?,+ quince_icloud::cloudkit::field::string(r, "DisplayName")+ .unwrap_or_default(),+ ))+ })+ .collect();+ println!(" live sections: {sections:?}");++ // Does any reminder point its List reference at a section rather than a list?+ let mut via_list = 0;+ for rec in records+ .iter()+ .filter(|r| r.get("recordType").and_then(|t| t.as_str()) == Some("Reminder"))+ {+ if let Some(target) = quince_icloud::cloudkit::field::reference(rec, "List") {+ if sections.contains_key(&target) {+ via_list += 1;+ if via_list <= 3 {+ println!(+ " \x1b[32m{}\x1b[0m has List -> {} ({})",+ quince_icloud::cloudkit::field::document_text(rec, "TitleDocument")+ .unwrap_or_default()+ .chars()+ .take(34)+ .collect::<String>(),+ target,+ sections[&target]+ );+ }+ }+ }+ }+ println!(" reminders whose List points at a section: {via_list}");++ // And what does the owning List record say about its sections?+ for rec in records+ .iter()+ .filter(|r| r.get("recordType").and_then(|t| t.as_str()) == Some("List"))+ .filter(|r| {+ quince_icloud::cloudkit::field::record_name(r).as_deref()+ == Some("List/A233F124-67A7-46EC-9FFB-2908DA86C61D")+ })+ {+ println!(" the list that owns a section:");+ if let Some(fields) = rec.get("fields").and_then(|f| f.as_object()) {+ for (k, v) in fields {+ println!(+ " {k} = {}",+ v.to_string().chars().take(120).collect::<String>()+ );+ }+ }+ }+ }+ }++ // ---- is the section-membership asset readable? ---------------------------------+ // Membership lives in a CloudKit asset with a checksum beside it, not in a reference.+ // Whether sections can be shown at all depends on that blob being tractable, so look+ // before promising anything.+ println!("\n\x1b[1m── Section membership: what is in the asset ──\x1b[0m");+ if let Some(ck) = session.service_url("ckdatabasews") {+ let zc = quince_icloud::cloudkit::ZoneClient::new(+ client.http(),+ &ck,+ "com.apple.reminders",+ client.service_params(),+ );+ if let Ok(quince_icloud::cloudkit::ZoneWalk { records, .. }) =+ zc.all_records("Reminders", None).await+ {+ let asset = records+ .iter()+ .filter(|r| r.get("recordType").and_then(|t| t.as_str()) == Some("List"))+ .find_map(|r| {+ r.pointer("/fields/MembershipsOfRemindersInSectionsAsData/value/downloadURL")+ .and_then(|v| v.as_str())+ .map(ToString::to_string)+ });++ match asset {+ None => println!(" no list on this account carries one"),+ Some(url) => match client.http().get(&url).send().await {+ Err(e) => println!(" \x1b[31mdownload failed:\x1b[0m {e}"),+ Ok(response) => {+ let status = response.status();+ let bytes = response.bytes().await.unwrap_or_default();+ println!(" {status}, {} byte(s)", bytes.len());+ if bytes.is_empty() {+ return Ok(());+ }+ println!(+ " first bytes: {}",+ bytes+ .iter()+ .take(24)+ .map(|b| format!("{b:02x}"))+ .collect::<Vec<_>>()+ .join(" ")+ );+ // It starts `{"memberships":` — this is plain JSON, not a blob.+ match std::str::from_utf8(&bytes)+ .ok()+ .and_then(|t| serde_json::from_str::<serde_json::Value>(t).ok())+ {+ None => println!(" not readable as JSON"),+ Some(parsed) => {+ if let Some(obj) = parsed.as_object() {+ println!(+ " top-level keys: {}",+ obj.keys().cloned().collect::<Vec<_>>().join(", ")+ );+ }+ // What does ONE membership entry carry? If nothing names a+ // section, membership must be expressed somewhere else.+ if let Some(first) =+ parsed.pointer("/memberships/0").and_then(|v| v.as_object())+ {+ println!(+ " one membership's keys: {}",+ first.keys().cloned().collect::<Vec<_>>().join(", ")+ );+ }+ let count = parsed+ .pointer("/memberships")+ .and_then(|v| v.as_array())+ .map_or(0, Vec::len);+ println!(" {count} membership(s) in this list's asset");+ // Anything that is not the memberships array is the part+ // that would say which section.+ if let Some(obj) = parsed.as_object() {+ for (k, v) in obj {+ if k != "memberships" {+ println!(+ " {k} = {}",+ v.to_string().chars().take(300).collect::<String>()+ );+ }+ }+ }+ }+ }+ }+ },+ }+ }+ }+// ---- CloudKit containers ----------------------------------------------------// Apple's legacy /rd and /ca endpoints answer with a placeholder once data has been// upgraded to the modern format. The real records live in CloudKit, so find out whichdiff --git a/run.sh b/run.shnew file mode 100755index 0000000..25131d0--- /dev/null+++ b/run.sh@@ -0,0 +1,30 @@+#!/usr/bin/env bash+# Build Quince and open it. Nothing else — no dev server, no watch mode.+set -euo pipefail+cd "$(dirname "$0")"++# Rust installs itself here but only adds it to the PATH of shells it knows how to edit,+# which is not every shell. Adding it unconditionally means this works from any of them.+export PATH="$HOME/.cargo/bin:$PATH"++for tool in cargo npm; do+ command -v "$tool" >/dev/null || {+ echo "Can't find $tool. Is it installed?" >&2+ exit 1+ }+done++echo "Building the interface…"+npm run build --silent >/dev/null++echo "Building the app…"+cargo build -p quince-app --quiet++# One window at a time, so a second run replaces the first rather than stacking.+pkill -f 'quince-ap[p]' 2>/dev/null || true+sleep 1++echo+echo "Opening Quince. Close the window, or press Ctrl-C here, to stop it."+echo+exec ./target/debug/quince-appdiff --git a/src/screens/RemindersView.tsx b/src/screens/RemindersView.tsxindex ce17623..d13e908 100644--- a/src/screens/RemindersView.tsx+++ b/src/screens/RemindersView.tsx@@ -570,6 +570,31 @@ export function RemindersView() {<span className="rem-notes">{reminder.notes}</span>)}+ {/* Under the title, where Apple puts it. Out at the end of the row it sat+ a thousand pixels from the thing it describes on a wide window. */}+ {(due || repeat || justMoved) && (+ <span className="rem-meta">+ {justMoved ? (+ <span className="rem-moved" role="status">+ Moved to {justMoved}+ </span>+ ) : (+ <>+ {due && (+ <span className={`rem-due${due.overdue ? " overdue" : ""}`}>+ {due.text}+ </span>+ )}+ {repeat && (+ <span className="rem-repeat" role="img" aria-label={repeat} title={repeat}>+ ↻+ </span>+ )}+ </>+ )}+ </span>+ )}+{isOpen && (<div className="rem-detail"><label>@@ -667,31 +692,6 @@ export function RemindersView() {</div><span className="rem-trailing">- {justMoved ? (- <span className="rem-moved" role="status">- Moved to {justMoved}- </span>- ) : (- <>- {repeat && (- <span- className="rem-repeat"- role="img"- aria-label={repeat}- title={repeat}- >- ↻- </span>- )}- {due && (- <span- className={`rem-due${due.overdue ? " overdue" : ""}`}- >- {due.text}- </span>- )}- </>- )}<buttonclassName={`rem-flag${reminder.flagged ? " on" : ""}`}aria-label={diff --git a/src/styles/app.css b/src/styles/app.cssindex 9366dfc..76c849c 100644--- a/src/styles/app.css+++ b/src/styles/app.css@@ -429,16 +429,21 @@margin-bottom: 14px;}-.cal-nav { display: flex; align-items: center; gap: 8px; }+/* Title and its count sit together, as one thing. */+.cal-nav { display: flex; align-items: baseline; gap: 8px; min-width: 0; }.cal-nav h1 {- margin: 0 10px 0 0;+ margin: 0;font-size: var(--t-22);font-weight: 600;letter-spacing: -0.021em;- min-width: 8.5ch;}+/* Only the calendar needs a reserved width, and only so the arrows either side of a month+ name stay put as it changes. Everywhere else it left the count stranded beside a short+ title with nothing between them. */+.cal .cal-nav h1 { min-width: 8.5ch; margin-right: 10px; }+.chev {width: 26px;height: 24px;@@ -603,7 +608,9 @@.rem {display: grid;- grid-template-columns: 176px 1fr;+ /* Wide enough for a real list name and its count side by side. At 176px "Quizzes &+ Exams" was cut to "Quizzes & Ex…" and the four tiles had eighty pixels each. */+ grid-template-columns: 212px 1fr;gap: 20px;height: 100%;min-height: 0;@@ -658,10 +665,10 @@.rem-smart {display: flex;flex-direction: column;- gap: 3px;+ gap: 4px;min-width: 0;border: 0;- padding: 7px 9px 8px;+ padding: 9px 10px 10px;border-radius: var(--r-plateau);background: color-mix(in srgb, var(--text) 5%, transparent);color: var(--text);@@ -684,18 +691,18 @@.rem-smart-glyph {flex: none;- width: 19px;- height: 19px;+ width: 21px;+ height: 21px;border-radius: var(--r-pill);display: grid;place-items: center;- font-size: 10px;+ font-size: 11px;line-height: 1;color: #fff;}.rem-smart-count {- font-size: var(--t-17);+ font-size: var(--t-22);font-weight: 620;font-variant-numeric: tabular-nums;letter-spacing: -0.3px;@@ -712,8 +719,9 @@.rem-items { display: flex; flex-direction: column; min-height: 0; min-width: 0; }-/* Rows stay a comfortable width on a large display rather than stretching edge to edge. */-.rem-items > * { width: 100%; max-width: 78ch; }+/* Rows run the width of the pane, as they do in Reminders. Capping them left the list+ stranded in the left third of a wide window with its separators ending in mid-air. */+.rem-items > * { width: 100%; }.rem-list-items {list-style: none;@@ -771,6 +779,14 @@white-space: nowrap;}+/* The line under a title: when it is due, and whether it comes back. */+.rem-meta {+ display: flex;+ align-items: center;+ gap: 6px;+ min-width: 0;+}+.rem-due {font-size: var(--t-11);color: var(--text-2);@@ -861,7 +877,9 @@.notes {display: grid;- grid-template-columns: 150px 250px 1fr;+ /* Wide enough for "Recently Deleted", which is the longest name Apple ever puts here and+ the one that was being cut to "Recently Delet…". */+ grid-template-columns: 184px minmax(260px, 320px) minmax(0, 1fr);gap: 16px;height: 100%;min-height: 0;@@ -944,7 +962,7 @@.note-body {overflow-y: auto;min-height: 0;- padding: 4px 32px 40px;+ padding: 4px 40px 40px;display: flex;flex-direction: column;align-items: center;@@ -952,7 +970,9 @@.note-body > * {width: 100%;- max-width: 66ch;+ /* A measure that grows with the window instead of stopping dead: comfortable to read on+ a laptop, and not a ribbon of text on a wide display. */+ max-width: min(92ch, 100%);}.note-body h2 {@@ -1011,11 +1031,16 @@ textarea.note-text:disabled {.note-bar {display: flex;align-items: center;- justify-content: space-between;- gap: 12px;+ gap: 10px;flex-wrap: wrap;+ padding-bottom: 10px;+ margin-bottom: 14px;+ border-bottom: 1px solid var(--separator);}+/* The date leads, the actions follow it — not flung to the far end of the measure. */+.note-bar .note-when { margin: 0; margin-right: auto; }+.note-bar-actions {display: flex;align-items: center;@@ -1037,7 +1062,7 @@ textarea.note-text:disabled {/* Apple gives Notes three columns; our service sidebar already takes one, so these have toearn their width. Folders are few and short, the list carries two lines per row, and thebody gets everything left over. */-.notes { grid-template-columns: 132px minmax(240px, 292px) minmax(0, 1fr); gap: 0; }+.notes { grid-template-columns: 184px minmax(260px, 320px) minmax(0, 1fr); gap: 0; }/* Hidden while the folder column is visible; the media query below reveals it. Declaredfirst so equal specificity resolves in the query's favour. */