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
Photos: the Albums page, as icloud.com's
Yashwanth Kamireddi27ef881facf3
diff --git a/.uiverify/photos-albums.mjs b/.uiverify/photos-albums.mjsindex 055c3e5..1ff6135 100644--- a/.uiverify/photos-albums.mjs+++ b/.uiverify/photos-albums.mjs@@ -17,6 +17,24 @@ let failures = 0;const ok = (p, m) => { console.log(`${p ? "PASS" : "FAIL"} ${m}`); if (!p) failures++; };const albumNames = () => page.locator(".px-albums .px-source").evaluateAll((els) => els.map((e) => e.querySelector(".px-label")?.textContent ?? ""));+// The Albums page: the row opens it — every album a card with its cover, name and count —+// while the chevron only opens the list in the sidebar; a card opens its album.+await page.locator(".px-parent", { hasText: "Albums" }).click();+await page.waitForTimeout(200);+ok((await page.locator(".px-albums-head h1").innerText()) === "Albums" && (await page.locator(".px-albums-head .px-span").innerText()) === "1 Album",+ "Albums opens the Albums page");+ok((await page.locator(".px-card").count()) === 1 && /Trips[\s\S]*2 items/.test(await page.locator(".px-card").innerText()),+ `each album a card with its name and count ${JSON.stringify(await page.locator(".px-card").innerText())}`);+ok((await page.locator(".px-tile").count()) === 0, "and the photos give way to it");+await page.getByRole("button", { name: "Hide Albums" }).click();+ok((await page.locator(".px-albums .px-source").count()) === 0 && (await page.locator(".px-card").count()) === 1, "the chevron only folds the list away");+await page.getByRole("button", { name: "Show Albums" }).click();+await page.locator(".px-card").click();+await page.waitForTimeout(250);+ok((await page.locator(".px-bar h1").innerText()) === "Trips" && (await page.locator(".px-tile").count()) === 2, "a card opens its album");+await page.locator(".px-source", { hasText: "Library" }).first().click();+await page.waitForTimeout(250);+await page.getByRole("button", { name: "New Album" }).click();await page.getByLabel("Album name").fill("Beach");await page.keyboard.press("Enter");diff --git a/src/screens/PhotosView.tsx b/src/screens/PhotosView.tsxindex 663f57b..06f2540 100644--- a/src/screens/PhotosView.tsx+++ b/src/screens/PhotosView.tsx@@ -259,6 +259,8 @@ export function PhotosView() {/** An album open instead of a view. */const [album, setAlbum] = useState<PhotoAlbum | null>(null);const [albums, setAlbums] = useState<[PhotoAlbum, number, (string | null)?][]>([]);+ /** The Albums page open: every album as a card with its cover, as icloud.com's. */+ const [albumsPage, setAlbumsPage] = useState(false);// Which of the sidebar's branches are open — Albums and Media Types — kept on this machine.const [branches, setBranches] = useState<{ albums: boolean; media: boolean }>(() => {try {@@ -1309,10 +1311,11 @@ export function PhotosView() {<buttonkey={v.key}className="px-source"- aria-current={!album && view === v.key}+ aria-current={!album && !albumsPage && view === v.key}onClick={() => {setView(v.key);setAlbum(null);+ setAlbumsPage(false);setOpen(null);}}>@@ -1331,8 +1334,18 @@ export function PhotosView() {hold, then Rated, Hidden and Recently Deleted. */}<p className="px-side-heading px-side-gap">Collections</p><div className="px-parent-row">- <button className="px-source px-parent" aria-expanded={branches.albums} onClick={() => branch("albums")}>+ {/* The chevron opens the list here; the row itself opens the Albums page. */}+ <button className="px-twisty" aria-label={branches.albums ? "Hide Albums" : "Show Albums"} aria-expanded={branches.albums} onClick={() => branch("albums")}><ChevronRight className="px-chevron" size={12} strokeWidth={2.4} aria-hidden="true" />+ </button>+ <button+ className="px-source px-parent"+ aria-current={albumsPage}+ onClick={() => {+ setAlbumsPage(true);+ setOpen(null);+ }}+ ><AlbumGlyph /><span className="px-label">Albums</span></button>@@ -1353,9 +1366,10 @@ export function PhotosView() {<buttonkey={a.id}className="px-source"- aria-current={album?.id === a.id}+ aria-current={!albumsPage && album?.id === a.id}onClick={() => {setAlbum(a);+ setAlbumsPage(false);setOpen(null);}}onDoubleClick={() => setNaming({ id: a.id, then: [], draft: a.name })}@@ -1399,7 +1413,69 @@ export function PhotosView() {{UTILITIES.map(source)}</aside>- <section className="px-main" aria-label={title}>+ <section className="px-main" aria-label={albumsPage ? "Albums" : title} data-page={albumsPage ? "albums" : undefined}>+ {albumsPage && (+ <div className="px-albums-page">+ <header className="px-albums-head">+ <div className="px-heading">+ <h1>Albums</h1>+ <p className="px-span">{albums.length === 1 ? "1 Album" : `${albums.length} Albums`}</p>+ </div>+ <div className="px-capsule">+ <button className="px-cap" aria-label="New Album" title="New Album" onClick={() => {+ if (!branches.albums) branch("albums");+ setNaming({ id: null, then: [], draft: "" });+ }}>+ <Plus size={16} strokeWidth={2} aria-hidden="true" />+ </button>+ </div>+ </header>+ {albums.length === 0 ? (+ <p className="px-empty">No albums yet. Make one with +, then add photos to it from their menu or by dragging them onto it.</p>+ ) : (+ <div className="px-cards" role="list">+ {albums.map(([a, n, cover]) => (+ <button+ key={a.id}+ role="listitem"+ className="px-card"+ onClick={() => {+ setAlbum(a);+ setAlbumsPage(false);+ }}+ {...dropTarget(a)}+ data-drop={dropOn === a.id || undefined}+ onContextMenu={(e) => {+ e.preventDefault();+ if (a.id.startsWith("new:")) return;+ setMenu({+ at: { x: e.clientX, y: e.clientY, alignRight: false },+ entries: [+ { label: "Rename Album", run: () => {+ if (!branches.albums) branch("albums");+ setNaming({ id: a.id, then: [], draft: a.name });+ } },+ null,+ { label: "Delete Album", danger: true, run: () => void deleteAlbum(a) },+ ],+ });+ }}+ >+ <span className="px-card-pic">+ {cover ? (+ <img src={pictureSrc(cover, "thumb")} alt="" loading="lazy" decoding="async" draggable={false} />+ ) : (+ <AlbumGlyph />+ )}+ </span>+ <span className="px-card-name">{a.name}</span>+ <span className="px-card-count">{n === 1 ? "1 item" : `${n} items`}</span>+ </button>+ ))}+ </div>+ )}+ </div>+ )}{/* As in Photos on macOS 26: the title and the controls float over the library, whichscrolls beneath them and fades out at the top edge. */}<header className="px-bar">diff --git a/src/styles/photos.css b/src/styles/photos.cssindex a428ee2..9234bb1 100644--- a/src/styles/photos.css+++ b/src/styles/photos.css@@ -592,3 +592,59 @@animation: px-spin 800ms linear infinite;}@keyframes px-spin { to { transform: rotate(360deg); } }++/* ---- the Albums page: every album as a card with its cover, as icloud.com's ------------------ */+.px-main[data-page="albums"] > :not(.px-albums-page) { display: none; }+.px-albums-page { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 18px 24px; }+.px-albums-head { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 18px; }+.px-albums-head h1 { margin: 0; font-size: var(--t-22, 22px); font-weight: 700; letter-spacing: -0.015em; }+.px-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 22px 18px; }+.px-card {+ display: flex;+ flex-direction: column;+ align-items: flex-start;+ gap: 2px;+ padding: 0;+ border: 0;+ background: none;+ color: var(--text);+ font: inherit;+ text-align: left;+ cursor: default;+}+.px-card-pic {+ display: grid;+ place-items: center;+ width: 100%;+ aspect-ratio: 1;+ margin-bottom: 6px;+ border-radius: 10px;+ overflow: hidden;+ background: color-mix(in srgb, var(--text) 7%, transparent);+ color: var(--text-3);+ transition: transform 180ms var(--spring-quick), box-shadow 180ms ease;+}+.px-card-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }+.px-card-pic .px-glyph { width: 36px; height: 36px; }+.px-card:hover .px-card-pic { transform: scale(1.015); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18); }+.px-card:active .px-card-pic { transform: scale(0.985); }+.px-card:focus-visible { outline: none; }+.px-card:focus-visible .px-card-pic, .px-card[data-drop] .px-card-pic { box-shadow: 0 0 0 3px var(--accent); }+.px-card-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--t-13); font-weight: 600; }+.px-card-count { color: var(--text-2); font-size: var(--t-12, 12px); }+/* The chevron beside Albums: its own small button, apart from the row that opens the page. */+.px-twisty {+ position: absolute;+ left: 0;+ z-index: 1;+ display: grid;+ place-items: center;+ width: 20px;+ height: 30px;+ padding: 0;+ border: 0;+ background: none;+ cursor: default;+}+.px-twisty[aria-expanded="true"] .px-chevron { transform: rotate(90deg); }+.px-parent-row .px-parent { padding-left: 20px; }