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.

Drive: View as Grid or List, remembered

Yashwanth Kamireddie27ff4985788
diff --git a/.uiverify/drive-sort.mjs b/.uiverify/drive-sort.mjs
index f4983bc..0362624 100644
--- a/.uiverify/drive-sort.mjs
+++ b/.uiverify/drive-sort.mjs
@@ -50,5 +50,15 @@ await page.reload({ waitUntil: "networkidle" });
await openScreen(page, "iCloud Drive");
await page.waitForTimeout(400);
ok(JSON.stringify(await files()) === JSON.stringify(byDate), "the order chosen is remembered");
+// View as Grid: tiles side by side, remembered.
+await page.getByRole("button", { name: /View as/ }).click();
+await page.getByRole("option", { name: "Grid" }).click();
+await page.waitForTimeout(200);
+const tops = async () => page.evaluate(() => [...document.querySelectorAll(".drive-rows .drive-row")].map((r) => Math.round(r.getBoundingClientRect().top)));
+ok(new Set((await tops()).slice(0, 3)).size === 1, "Grid sets items side by side");
+await page.reload({ waitUntil: "networkidle" });
+await openScreen(page, "iCloud Drive");
+await page.waitForTimeout(400);
+ok(new Set((await tops()).slice(0, 3)).size === 1, "and Grid is remembered");
await b.close();
process.exitCode = failures ? 1 : 0;
diff --git a/src/screens/DriveView.tsx b/src/screens/DriveView.tsx
index 1b85a95..226f9c1 100644
--- a/src/screens/DriveView.tsx
+++ b/src/screens/DriveView.tsx
@@ -161,6 +161,22 @@ export function DriveView() {
const [trail, setTrail] = useState<Crumb[]>([{ id: DRIVE_ROOT, name: "iCloud Drive" }]);
const [items, setItems] = useState<DriveItem[]>([]);
const [inTrash, setInTrash] = useState(false);
+ /** icloud.com's "View as": Grid or List, remembered. */
+ const [grid, setGrid] = useState(() => {
+ try {
+ return window.localStorage.getItem("quince.drive.view") === "grid";
+ } catch {
+ return false;
+ }
+ });
+ const chooseView = (asGrid: boolean) => {
+ setGrid(asGrid);
+ try {
+ window.localStorage.setItem("quince.drive.view", asGrid ? "grid" : "list");
+ } catch {
+ // Shown so for now; forgotten on restart.
+ }
+ };
const [sortBy, setSortBy] = useState<SortKey>(() => {
try {
const saved = window.localStorage.getItem(SORT_KEY);
@@ -545,6 +561,13 @@ export function DriveView() {
<ActionGlyph name="delete" />
Recently Deleted
</button>
+ <Picker
+ className="drive-view"
+ label="View as"
+ value={grid ? "grid" : "list"}
+ onChange={(v) => chooseView(v === "grid")}
+ options={[{ value: "grid", label: "Grid" }, { value: "list", label: "List" }]}
+ />
<Picker
className="drive-sort"
label="Sort by"
@@ -604,7 +627,7 @@ export function DriveView() {
</p>
)}
- <ul className="drive-rows">
+ <ul className={`drive-rows${grid ? " is-grid" : ""}`}>
{pending
.filter((p) => p.folder === here.id && !items.some((i) => driveName(i) === p.name))
.map((p) => (
diff --git a/src/styles/app.css b/src/styles/app.css
index 9e01e4c..775b903 100644
--- a/src/styles/app.css
+++ b/src/styles/app.css
@@ -935,6 +935,30 @@
.crumb-sep { color: var(--text-3); padding: 0 1px; }
.drive-rows { list-style: none; margin: 8px 0 0; padding: 0; overflow-y: auto; min-height: 0; }
+/* Grid, as icloud.com and Finder's icon view lay it out: a large mark, the name under it in
+ two lines at most, the size and date left to List. Actions stay on hover, over the tile. */
+.drive-rows.is-grid {
+ display: grid;
+ grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
+ gap: 8px;
+ align-content: start;
+}
+.drive-rows.is-grid .drive-row { position: relative; flex-direction: column; border-bottom: 0; height: 100%; }
+.drive-rows.is-grid .drive-row:hover { background: color-mix(in srgb, var(--text) 6%, transparent); }
+.drive-rows.is-grid .drive-row-hit {
+ display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
+ gap: 8px; padding: 14px 8px 10px; text-align: center; height: 100%;
+}
+.drive-rows.is-grid .drive-badge { height: 52px; transform: scale(2.1); transform-origin: center; }
+.drive-rows.is-grid .drive-name {
+ display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
+ overflow: hidden; white-space: normal; word-break: break-word; font-size: var(--t-12, 12px); line-height: 1.3;
+}
+.drive-rows.is-grid .drive-meta { display: none; }
+.drive-rows.is-grid .drive-row-actions {
+ position: absolute; top: 4px; right: 4px; padding: 2px; border-radius: 8px;
+ background: var(--sheet, var(--bg));
+}
/* A row is the clickable hit area plus a strip of actions that only earn their space on
hover — the same shape reminders and lists already use, so Drive reads as one app rather