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.

Sidebar icons redrawn with light and graphite finishes, top light and edge; menus move focus only for the keyboard, ending the hover flicker, and open on the compositor

Yashwanth Kamireddica398bb65ac9
diff --git a/.uiverify/look-icons.mjs b/.uiverify/look-icons.mjs
new file mode 100644
index 0000000..3767cb6
--- /dev/null
+++ b/.uiverify/look-icons.mjs
@@ -0,0 +1,14 @@
+// Not a check: renders the sidebar's icons large, in both themes, to look at.
+import { engine } from "./engine.mjs";
+import { SERVICES, installStub } from "./stub.mjs";
+const out = process.argv[2] ?? ".";
+const b = await engine.launch();
+for (const scheme of ["dark", "light"]) {
+ const ctx = await b.newContext({ viewport: { width: 1100, height: 420 }, colorScheme: scheme, deviceScaleFactor: 3 });
+ await ctx.addInitScript(installStub, { screen: "library", services: SERVICES, twoFactor: null });
+ const p = await ctx.newPage();
+ await p.goto("http://localhost:4173", { waitUntil: "networkidle" });
+ await p.waitForTimeout(400);
+ await p.screenshot({ clip: { x: 0, y: 0, width: 230, height: 260 }, path: `${out}/icons-${scheme}.png` });
+}
+await b.close();
diff --git a/src/components/AppIcon.tsx b/src/components/AppIcon.tsx
index 7190e08..99bbca9 100644
--- a/src/components/AppIcon.tsx
+++ b/src/components/AppIcon.tsx
@@ -1,82 +1,129 @@
+import { useId } from "react";
+
/**
* Each screen's mark in the sidebar, drawn after the app it stands in for — Reminders' three
- * coloured dots on white, Notes' yellow pad, Drive's blue folder, Calendar's day-of-the-week
- * tile, Contacts' grey card — as icloud.com's launcher and macOS's sidebar show them, so a
- * row is found by its picture before its name is read. Drawn, not bitmaps: crisp at any
- * scale and on any desktop.
+ * coloured dots, Notes' yellow pad, Drive's blue folder, Calendar's day tile, Contacts' card —
+ * so a row is found by its picture before its name is read.
+ *
+ * Drawn here, not Apple's artwork, which is Apple's to ship. Like icloud.com's launcher they
+ * come in two finishes: a light tile, and in dark mode the deep graphite tile Apple's dark
+ * icons sit on, with a soft top light and a hairline edge so they read as objects, not
+ * flat stickers. Vector, so they are crisp at any scale on any desktop.
*/
export function AppIcon({ app, size = 22 }: { app: string; size?: number }) {
+ const id = useId().replace(/:/g, "");
const today = new Date();
const s = { width: size, height: size, flex: "none" } as const;
+
+ // The tile every icon stands on: light or graphite by the theme, a top light, an edge.
+ const tile = (
+ <>
+ <defs>
+ <linearGradient id={`${id}t`} x1="0" y1="0" x2="0" y2="1">
+ <stop offset="0" className="ai-tile-top" />
+ <stop offset="1" className="ai-tile-bottom" />
+ </linearGradient>
+ <linearGradient id={`${id}g`} x1="0" y1="0" x2="0" y2="1">
+ <stop offset="0" stopColor="#fff" stopOpacity="0.22" />
+ <stop offset="0.5" stopColor="#fff" stopOpacity="0" />
+ </linearGradient>
+ </defs>
+ <rect width="24" height="24" rx="5.4" fill={`url(#${id}t)`} />
+ </>
+ );
+ const shine = (
+ <>
+ <rect width="24" height="24" rx="5.4" fill={`url(#${id}g)`} />
+ <rect x="0.25" y="0.25" width="23.5" height="23.5" rx="5.2" fill="none" className="ai-edge" strokeWidth="0.5" />
+ </>
+ );
+
+ let art: React.ReactNode = null;
switch (app) {
case "reminders":
- return (
- <svg viewBox="0 0 24 24" style={s} aria-hidden="true">
- <rect width="24" height="24" rx="5.5" fill="#fff" />
- {[
- [7, "#0a84ff"],
- [12, "#ff3b30"],
- [17, "#ff9f0a"],
- ].map(([y, c]) => (
- <g key={String(y)}>
- <circle cx="6.5" cy={y as number} r="2.1" fill={c as string} />
- <rect x="10" y={(y as number) - 0.6} width="9" height="1.2" rx="0.6" fill="#c7c7cc" />
- </g>
- ))}
- </svg>
- );
+ art = [
+ [7.2, "#0a84ff"],
+ [12, "#ff453a"],
+ [16.8, "#ff9f0a"],
+ ].map(([y, c]) => (
+ <g key={String(y)}>
+ <circle cx="6.6" cy={y as number} r="2.15" fill={c as string} />
+ <circle cx="6.6" cy={y as number} r="2.15" fill="none" stroke="#000" strokeOpacity="0.12" strokeWidth="0.3" />
+ <rect x="10.2" y={(y as number) - 0.55} width="9.4" height="1.1" rx="0.55" className="ai-rule" />
+ </g>
+ ));
+ break;
case "notes":
- return (
- <svg viewBox="0 0 24 24" style={s} aria-hidden="true">
- <rect width="24" height="24" rx="5.5" fill="#fff" />
- <path d="M0 5.5A5.5 5.5 0 0 1 5.5 0h13A5.5 5.5 0 0 1 24 5.5V8H0z" fill="#ffd60a" />
- {[12, 15.5, 19].map((y) => (
- <rect key={y} x="3.5" y={y} width="17" height="0.9" rx="0.45" fill="#d1d1d6" />
+ art = (
+ <>
+ <defs>
+ <linearGradient id={`${id}n`} x1="0" y1="0" x2="0" y2="1">
+ <stop offset="0" stopColor="#ffe066" />
+ <stop offset="1" stopColor="#ffc800" />
+ </linearGradient>
+ </defs>
+ <path d="M0 5.4A5.4 5.4 0 0 1 5.4 0h13.2A5.4 5.4 0 0 1 24 5.4V7.6H0z" fill={`url(#${id}n)`} />
+ <path d="M0 7.6h24" stroke="#000" strokeOpacity="0.12" strokeWidth="0.4" strokeDasharray="0.5 0.7" />
+ {[11.8, 15.2, 18.6].map((y) => (
+ <rect key={y} x="3.4" y={y} width="17.2" height="0.8" rx="0.4" className="ai-rule" />
))}
- </svg>
+ </>
);
+ break;
case "drivews":
- return (
- <svg viewBox="0 0 24 24" style={s} aria-hidden="true">
+ art = (
+ <>
<defs>
- <linearGradient id="qi-drive" x1="0" y1="0" x2="0" y2="1">
- <stop offset="0" stopColor="#5ac8fa" />
+ <linearGradient id={`${id}d`} x1="0" y1="0" x2="0" y2="1">
+ <stop offset="0" stopColor="#64d2ff" />
<stop offset="1" stopColor="#0a84ff" />
</linearGradient>
+ <linearGradient id={`${id}b`} x1="0" y1="0" x2="0" y2="1">
+ <stop offset="0" stopColor="#0a6ad6" />
+ <stop offset="1" stopColor="#0957b3" />
+ </linearGradient>
</defs>
- <rect width="24" height="24" rx="5.5" fill="#fff" />
- <path d="M4 7.5A1.5 1.5 0 0 1 5.5 6h4l1.6 1.8h7.4A1.5 1.5 0 0 1 20 9.3V17a1.5 1.5 0 0 1-1.5 1.5h-13A1.5 1.5 0 0 1 4 17z" fill="url(#qi-drive)" />
- </svg>
+ <path d="M3.6 7.6a1.6 1.6 0 0 1 1.6-1.6h4.1l1.7 1.8h7.8a1.6 1.6 0 0 1 1.6 1.6V10H3.6z" fill={`url(#${id}b)`} />
+ <path d="M3.6 9.6A1.6 1.6 0 0 1 5.2 8h13.6a1.6 1.6 0 0 1 1.6 1.6v7.6a1.6 1.6 0 0 1-1.6 1.6H5.2a1.6 1.6 0 0 1-1.6-1.6z" fill={`url(#${id}d)`} />
+ <path d="M3.6 10.4h16.8" stroke="#fff" strokeOpacity="0.35" strokeWidth="0.4" />
+ </>
);
+ break;
case "calendar":
- return (
- <svg viewBox="0 0 24 24" style={s} aria-hidden="true">
- <rect width="24" height="24" rx="5.5" fill="#fff" />
- <text x="12" y="8.2" textAnchor="middle" fontSize="5.4" fontWeight="600" fill="#ff3b30"
- fontFamily="-apple-system, system-ui, sans-serif">
- {today.toLocaleDateString(undefined, { weekday: "short" }).toUpperCase().slice(0, 3)}
+ art = (
+ <>
+ <text x="12" y="8" textAnchor="middle" fontSize="5" fontWeight="600" fill="#ff453a"
+ fontFamily="-apple-system, 'SF Pro Text', Inter, system-ui, sans-serif" letterSpacing="0.2">
+ {today.toLocaleDateString(undefined, { weekday: "short" }).slice(0, 3)}
</text>
- <text x="12" y="19.6" textAnchor="middle" fontSize="11.5" fontWeight="300" fill="#1c1c1e"
- fontFamily="-apple-system, system-ui, sans-serif">
+ <text x="12" y="19.4" textAnchor="middle" fontSize="11.6" fontWeight="300" className="ai-ink"
+ fontFamily="-apple-system, 'SF Pro Display', Inter, system-ui, sans-serif" letterSpacing="-0.4">
{today.getDate()}
</text>
- </svg>
+ </>
);
+ break;
case "contacts":
- return (
- <svg viewBox="0 0 24 24" style={s} aria-hidden="true">
- <defs>
- <linearGradient id="qi-contacts" x1="0" y1="0" x2="0" y2="1">
- <stop offset="0" stopColor="#d1d1d6" />
- <stop offset="1" stopColor="#aeaeb2" />
- </linearGradient>
- </defs>
- <rect width="24" height="24" rx="5.5" fill="url(#qi-contacts)" />
- <circle cx="12" cy="9.5" r="3.6" fill="#fff" />
- <path d="M5.5 19.5c.9-3.4 3.4-5 6.5-5s5.6 1.6 6.5 5z" fill="#fff" />
- </svg>
+ art = (
+ <>
+ <rect x="17.6" y="4.2" width="2.2" height="4.4" rx="0.6" fill="#ff9f0a" />
+ <rect x="17.6" y="9.8" width="2.2" height="4.4" rx="0.6" fill="#30d158" />
+ <rect x="17.6" y="15.4" width="2.2" height="4.4" rx="0.6" fill="#0a84ff" />
+ <rect x="3.8" y="3.6" width="13" height="16.8" rx="2" className="ai-card" />
+ <circle cx="10.3" cy="10.2" r="2.9" className="ai-person" />
+ <path d="M5.4 18.4c.7-2.7 2.7-4 4.9-4s4.2 1.3 4.9 4z" className="ai-person" />
+ </>
);
+ break;
default:
return <span style={s} aria-hidden="true" />;
}
+
+ return (
+ <svg viewBox="0 0 24 24" style={s} aria-hidden="true" className={`app-icon ai-${app}`}>
+ {tile}
+ {art}
+ {shine}
+ </svg>
+ );
}
diff --git a/src/components/Picker.tsx b/src/components/Picker.tsx
index ae1ecc4..2a90c25 100644
--- a/src/components/Picker.tsx
+++ b/src/components/Picker.tsx
@@ -64,9 +64,20 @@ export function Picker({
setOpen(true);
};
+ // Focus follows the keyboard, not the pointer. Moving focus on every hover made the
+ // browser re-scroll and repaint the menu under the mouse, which read as flicker.
+ const byKeyboard = useRef(true);
useEffect(() => {
- if (open) items.current[active]?.focus();
+ if (open && byKeyboard.current) items.current[active]?.focus({ preventScroll: false });
}, [open, active]);
+ useEffect(() => {
+ if (open) {
+ byKeyboard.current = true;
+ items.current[active]?.focus({ preventScroll: true });
+ }
+ // Only on opening.
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [open]);
// Clicking anywhere else dismisses the menu, which is what every menu does.
useEffect(() => {
@@ -81,6 +92,7 @@ export function Picker({
const onListKey = (e: React.KeyboardEvent) => {
const move = (to: number) => {
e.preventDefault();
+ byKeyboard.current = true;
setActive(Math.max(0, Math.min(to, options.length - 1)));
};
if (e.key === "ArrowDown") move(active + 1);
@@ -134,7 +146,10 @@ export function Picker({
className={index === active ? "is-active" : undefined}
onKeyDown={onListKey}
onClick={() => choose(index)}
- onMouseEnter={() => setActive(index)}
+ onMouseEnter={() => {
+ byKeyboard.current = false;
+ setActive(index);
+ }}
>
<span className="picker-check" aria-hidden="true">
{option.value === value ? "✓" : ""}
diff --git a/src/styles/app.css b/src/styles/app.css
index f65113d..9d134cf 100644
--- a/src/styles/app.css
+++ b/src/styles/app.css
@@ -407,7 +407,28 @@
}
.nav-item:active { transform: scale(0.98); }
-.nav-item > svg { border-radius: 5.5px; box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.18), 0 1px 2px rgba(0, 0, 0, 0.25); }
+.nav-item > svg { border-radius: 5.4px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.28), 0 0 0 0.5px rgba(0, 0, 0, 0.2); }
+/* The icon tiles: white in light mode; Apple's graphite in dark, as icloud.com draws them. */
+.app-icon .ai-tile-top { stop-color: #ffffff; }
+.app-icon .ai-tile-bottom { stop-color: #ececf0; }
+.app-icon .ai-edge { stroke: rgba(0, 0, 0, 0.1); }
+.app-icon .ai-rule { fill: #c7c7cc; }
+.app-icon .ai-ink { fill: #1c1c1e; }
+.app-icon .ai-card { fill: #8e8e93; }
+.app-icon .ai-person { fill: #fff; }
+.app-icon.ai-contacts .ai-tile-top { stop-color: #d8d8dc; }
+.app-icon.ai-contacts .ai-tile-bottom { stop-color: #b8b8be; }
+@media (prefers-color-scheme: dark) {
+ .app-icon .ai-tile-top { stop-color: #3a3a3e; }
+ .app-icon .ai-tile-bottom { stop-color: #1c1c1f; }
+ .app-icon .ai-edge { stroke: rgba(255, 255, 255, 0.14); }
+ .app-icon .ai-rule { fill: #5a5a60; }
+ .app-icon .ai-ink { fill: #f2f2f7; }
+ .app-icon .ai-card { fill: #636366; }
+ .app-icon .ai-person { fill: #e5e5ea; }
+ .app-icon.ai-contacts .ai-tile-top { stop-color: #3a3a3e; }
+ .app-icon.ai-contacts .ai-tile-bottom { stop-color: #1c1c1f; }
+}
.nav-name { overflow: hidden; text-overflow: ellipsis; transition: opacity 160ms ease; }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; margin: 0 0 6px; min-height: 28px; }
.sidebar-head h2 { margin: 0 8px; }
@@ -1261,13 +1282,17 @@
background: var(--sheet);
border-radius: var(--r-plateau);
box-shadow: var(--shadow-sheet), 0 0 0 0.5px var(--glass-edge);
- animation: picker-in 140ms var(--ease) both;
+ /* Opacity and a 3px drop only, from its top edge, on the compositor. */
+ transform-origin: top center;
+ will-change: opacity, transform;
+ animation: picker-in 120ms cubic-bezier(0.2, 0.9, 0.3, 1) both;
}
@keyframes picker-in {
- from { opacity: 0; transform: translateY(-4px) scale(0.98); }
+ from { opacity: 0; transform: translateY(-3px); }
to { opacity: 1; transform: none; }
}
+@media (prefers-reduced-motion: reduce) { .picker-menu { animation: none; } }
.picker-menu li {
display: flex;