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
Drive: Get Info — kind, size or contents, where, created, modified
Yashwanth Kamireddie1e0727e8bc9
diff --git a/.uiverify/drive-info.mjs b/.uiverify/drive-info.mjsnew file mode 100644index 0000000..f605e16--- /dev/null+++ b/.uiverify/drive-info.mjs@@ -0,0 +1,22 @@+// Get Info: a file's kind, size, place and dates, as icloud.com's File Info shows them.+import { engine } from "./engine.mjs";+import { SERVICES, installStub, openScreen } from "./stub.mjs";+const b = await engine.launch();+const ctx = await b.newContext({ viewport: { width: 1200, height: 800 } });+await ctx.addInitScript(installStub, { screen: "library", services: SERVICES, twoFactor: null, driveFixture: true });+const page = await ctx.newPage();+await page.goto("http://localhost:4173", { waitUntil: "networkidle" });+await openScreen(page, "iCloud Drive");+await page.waitForTimeout(300);+let failures = 0;+const ok = (p, m) => { console.log(`${p ? "PASS" : "FAIL"} ${m}`); if (!p) failures++; };+await page.locator(".drive-row", { hasText: "Semester Plan" }).hover();+await page.getByRole("button", { name: "Get Info for Semester Plan.pdf" }).click();+await page.waitForTimeout(200);+const facts = await page.evaluate(() => Object.fromEntries([...document.querySelectorAll(".info-rows > div")].map((d) => [d.querySelector("dt").textContent, d.querySelector("dd").textContent])));+ok(facts.Kind === "PDF document" && facts.Size === "2.3 MB" && facts.Where === "iCloud Drive", `File Info ${JSON.stringify(facts)}`);+await page.keyboard.press("Escape");+await page.waitForTimeout(150);+ok((await page.locator(".info-sheet").count()) === 0, "Escape closes it");+await b.close();+process.exitCode = failures ? 1 : 0;diff --git a/check.sh b/check.shindex cafea0d..cfe502b 100755--- a/check.sh+++ b/check.sh@@ -54,6 +54,7 @@ step "calendar instant" node .uiverify/calendar-instant.mjsstep "notes instant" node .uiverify/notes-instant.mjsstep "drive sort" node .uiverify/drive-sort.mjsstep "drive trash" node .uiverify/drive-trash.mjs+step "drive info" node .uiverify/drive-info.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/components/FileGlyph.tsx b/src/components/FileGlyph.tsxindex 61501c4..3bc83ba 100644--- a/src/components/FileGlyph.tsx+++ b/src/components/FileGlyph.tsx@@ -114,7 +114,7 @@ export function FileGlyph({ kind, extension }: { kind: string; extension: string}/** Actions on a row, at the same weight as everything else drawn here. */-export type ActionName = "download" | "rename" | "move" | "delete" | "upload" | "newFolder";+export type ActionName = "download" | "rename" | "move" | "delete" | "upload" | "newFolder" | "info";const ACTIONS: Record<ActionName, React.ReactNode> = {download: <path d="M8 2.8v7.4M4.8 7.2 8 10.4l3.2-3.2M3.2 12.6h9.6" />,@@ -122,6 +122,7 @@ const ACTIONS: Record<ActionName, React.ReactNode> = {move: <path d="M2.6 5.2a1.4 1.4 0 0 1 1.4-1.4h2.3l1 1.2h5.1a1.4 1.4 0 0 1 1.4 1.4M6.4 10.6h6.4M10.4 8.2l2.4 2.4-2.4 2.4" />,delete: <path d="M3.4 4.8h9.2M6.4 4.8V3.4h3.2v1.4M5 4.8l.6 8h4.8l.6-8M7 7v3.6M9 7v3.6" />,upload: <path d="M8 13.2V5.8M4.8 9 8 5.8 11.2 9M3.2 3.4h9.6" />,+ info: <path d="M8 13.4A5.4 5.4 0 1 0 8 2.6a5.4 5.4 0 0 0 0 10.8zM8 7.4v3.4M8 5.2v.1" />,newFolder: <path d="M2.6 5.2a1.4 1.4 0 0 1 1.4-1.4h2.3l1 1.2h5.1a1.4 1.4 0 0 1 1.4 1.4v5.4a1.4 1.4 0 0 1-1.4 1.4H4a1.4 1.4 0 0 1-1.4-1.4zM8 7.6v3.4M6.3 9.3h3.4" />,};diff --git a/src/screens/DriveView.tsx b/src/screens/DriveView.tsxindex 226f9c1..8ac1c08 100644--- a/src/screens/DriveView.tsx+++ b/src/screens/DriveView.tsx@@ -155,6 +155,61 @@ function DriveTrash({ onClose }: { onClose: () => void }) {);}+/** What a file's kind is called, as icloud.com's File Info names it. */+const KINDS: Record<string, string> = {+ pdf: "PDF document", png: "PNG image", jpg: "JPEG image", jpeg: "JPEG image", heic: "HEIC image",+ gif: "GIF image", webp: "WebP image", mp4: "MPEG-4 movie", mov: "QuickTime movie", mp3: "MP3 audio",+ m4a: "Apple MPEG-4 audio", wav: "WAVE audio", txt: "Plain text document", md: "Markdown document",+ csv: "Comma-separated values", json: "JSON document", zip: "ZIP archive", html: "HTML document",+ docx: "Office Open XML word processing document", doc: "Microsoft Word document",+ xlsx: "Office Open XML spreadsheet", pptx: "Office Open XML presentation",+ pages: "Pages document", numbers: "Numbers spreadsheet", key: "Keynote presentation",+};+function kindName(item: DriveItem) {+ if (item.kind === "FOLDER") return "Folder";+ if (item.kind === "APP_LIBRARY") return "Application Library";+ const ext = (item.extension ?? "").toLowerCase();+ return KINDS[ext] ?? (ext ? `${ext.toUpperCase()} file` : "Document");+}++/** File Info, as icloud.com shows it: the mark, the name, then what it is and where. */+function InfoSheet({ item, where, onClose }: { item: DriveItem; where: string; onClose: () => void }) {+ const done = useRef<HTMLButtonElement | null>(null);+ useEffect(() => {+ const id = window.setTimeout(() => done.current?.focus(), 0);+ const onKey = (e: KeyboardEvent) => e.key === "Escape" && onClose();+ window.addEventListener("keydown", onKey);+ return () => { window.clearTimeout(id); window.removeEventListener("keydown", onKey); };+ }, [onClose]);+ const when = (s: number | null) => (s === null ? "—" : new Date(s * 1000).toLocaleString(undefined, { dateStyle: "medium", timeStyle: "short" }));+ const rows: [string, string][] = [+ ["Kind", kindName(item)],+ ...(isContainer(item)+ ? item.childCount === null ? [] : [["Contents", `${item.childCount} item${item.childCount === 1 ? "" : "s"}`] as [string, string]]+ : [["Size", fileSize(item.size)] as [string, string]]),+ ["Where", where],+ ["Created", when(item.createdAt)],+ ["Modified", when(item.modifiedAt ?? item.createdAt)],+ ];+ return (+ <div className="modal-veil" onClick={onClose}>+ <div className="modal-sheet info-sheet" role="dialog" aria-label="File Info" onClick={(e) => e.stopPropagation()}>+ <header className="info-head">+ <h2>{isContainer(item) ? "Folder Info" : "File Info"}</h2>+ <button ref={done} className="quiet info-done" onClick={onClose}>Done</button>+ </header>+ <div className="info-mark" aria-hidden="true"><FileGlyph kind={item.kind} extension={item.extension} /></div>+ <p className="info-name">{driveName(item)}</p>+ <dl className="info-rows">+ {rows.map(([k, v]) => (+ <div key={k}><dt>{k}</dt><dd>{v}</dd></div>+ ))}+ </dl>+ </div>+ </div>+ );+}+type Crumb = { id: string; name: string };export function DriveView() {@@ -204,6 +259,7 @@ export function DriveView() {const [newFolderName, setNewFolderName] = useState("");/** The item a Move dialog is open for, if any. */const [moving, setMoving] = useState<DriveItem | null>(null);+ const [info, setInfo] = useState<DriveItem | null>(null);/** True while files are held over the window, so the drop target can say so. */const [dropping, setDropping] = useState(false);@@ -755,6 +811,14 @@ export function DriveView() {><ActionGlyph name="rename" /></button>+ <button+ className="drive-action"+ aria-label={`Get Info for ${driveName(item)}`}+ title="Get Info"+ onClick={() => setInfo(item)}+ >+ <ActionGlyph name="info" />+ </button><buttonclassName="drive-action danger"aria-label={`Delete ${driveName(item)}`}@@ -788,6 +852,10 @@ export function DriveView() {/>)}+ {info && (+ <InfoSheet item={info} where={trail.map((c) => c.name).join(" › ")} onClose={() => setInfo(null)} />+ )}+<UploadTray uploads={[...uploads.values()]} onDismiss={() => setUploads(new Map())} /></div>);diff --git a/src/styles/app.css b/src/styles/app.cssindex 775b903..f65113d 100644--- a/src/styles/app.css+++ b/src/styles/app.css@@ -1697,3 +1697,16 @@.contact-birthday-field label:first-child { display: flex; flex-direction: column; gap: 4px; font-size: var(--t-11); color: var(--text-2); }.contact-birthday-field input[type="date"] { padding: 4px 8px; border: 1px solid var(--field-edge); border-radius: 6px; background: var(--field); color: var(--text); font: inherit; font-size: var(--t-13); color-scheme: light dark; }.contact-birthday-noyear { display: flex; align-items: center; gap: 6px; padding-bottom: 6px; font-size: var(--t-13); color: var(--text-2); }++/* File Info: a calm sheet, the mark large, the facts in two aligned columns. */+.info-sheet { width: min(400px, calc(100vw - 32px)); padding: 0 0 8px; }+.info-head { display: flex; align-items: center; justify-content: center; position: relative; padding: 14px 16px; border-bottom: 1px solid var(--separator); }+.info-head h2 { margin: 0; font-size: var(--t-15); font-weight: 600; }+.info-done { position: absolute; right: 10px; font-weight: 600; color: var(--sys-blue); }+.info-mark { display: grid; place-items: center; margin: 18px auto 10px; width: 96px; height: 96px; border-radius: 16px; background: color-mix(in srgb, var(--text) 6%, transparent); }+.info-mark > * { transform: scale(2.6); }+.info-name { margin: 0 20px 14px; text-align: center; font-weight: 600; word-break: break-word; }+.info-rows { margin: 0 20px; }+.info-rows > div { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 12px; padding: 7px 0; border-top: 1px solid var(--separator); font-size: var(--t-13); }+.info-rows dt { color: var(--text-2); }+.info-rows dd { margin: 0; text-align: right; overflow-wrap: anywhere; }