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.

A reminder's controls stay beside the reminder, and its circle tells the truth

Yashwanth Kamireddic4468bd3e896
diff --git a/.uiverify/assert.mjs b/.uiverify/assert.mjs
index 71b12c0..4dd2a18 100644
--- a/.uiverify/assert.mjs
+++ b/.uiverify/assert.mjs
@@ -296,6 +296,45 @@ let failures = 0;
await page.close();
}
+// ── What acts on a reminder stays beside it ───────────────────────────────────────────
+// The separators span the whole pane, so the list does not end in mid-air on a wide window.
+// The controls must not span it too: with the text on one stretching column they were pushed
+// to the far edge, about thirteen hundred pixels from the reminder they act on.
+{
+ const page = await ctx.newPage();
+ await page.setViewportSize({ width: 1920, height: 1080 });
+ await page.goto("http://localhost:4173", { waitUntil: "networkidle" });
+ await page.getByRole("button", { name: "Reminders", exact: true }).click();
+ await page.waitForTimeout(400);
+
+ // Measured from the start of the row, not from the text element — that one stretches to
+ // fill its column, so the gap after it is always the grid gap and says nothing at all. The
+ // first version of this check passed against the layout it was written to catch.
+ const reach = await page.evaluate(() => {
+ const row = document.querySelector(".rem-list-items li");
+ const actions = row?.querySelector(".rem-trailing");
+ if (!row || !actions) return null;
+ const left = row.getBoundingClientRect().left;
+ return {
+ reach: +(actions.getBoundingClientRect().left - left).toFixed(0),
+ rowWidth: +row.getBoundingClientRect().width.toFixed(0),
+ };
+ });
+ if (!reach) {
+ console.log("FAIL could not measure a reminder row");
+ failures++;
+ } else {
+ const close = reach.reach < 900;
+ console.log(
+ close
+ ? `PASS what acts on a reminder stays beside it [${reach.reach}px in, row ${reach.rowWidth}px]`
+ : `FAIL the controls sit ${reach.reach}px into a ${reach.rowWidth}px row`
+ );
+ if (!close) failures++;
+ }
+ await page.close();
+}
+
// ── A new event goes where Apple says, not where the list happens to start ────────────
// Apple names the default calendar outright. Taking the first of the list instead is the same
// mistake that put every new reminder in whichever list sorted first — and the first calendar
diff --git a/src/screens/RemindersView.tsx b/src/screens/RemindersView.tsx
index 5820222..7d4d573 100644
--- a/src/screens/RemindersView.tsx
+++ b/src/screens/RemindersView.tsx
@@ -41,7 +41,14 @@ function daysApart(from: Date, to: Date): number {
return Math.round((noon(to) - noon(from)) / 86_400_000);
}
-function dueLabel(seconds: number): { text: string; overdue: boolean } {
+/**
+ * When a reminder is due, said the way Apple says it.
+ *
+ * `dated` means the heading above already names the day — under "Tomorrow", Apple writes
+ * "9:30 PM" and not "Tomorrow 9:30 PM". Saying it twice is the sort of thing that makes a
+ * screen read as almost-right.
+ */
+function dueLabel(seconds: number, dated = false): { text: string; overdue: boolean } {
const due = new Date(seconds * 1000);
const now = new Date();
const days = daysApart(now, due);
@@ -49,6 +56,9 @@ function dueLabel(seconds: number): { text: string; overdue: boolean } {
hour: "numeric",
minute: "2-digit",
});
+ if (dated) {
+ return { text: time, overdue: days < 0 || (days === 0 && due.getTime() < now.getTime()) };
+ }
if (days < 0)
return {
text: due.toLocaleDateString(undefined, {
@@ -106,6 +116,18 @@ function repeatLabel(r: Reminder): string | null {
return every > 1 ? `Every ${every} ${unit}s` : `Every ${unit}`;
}
+/**
+ * The word Apple puts beside the repeat arrow: Daily, Weekly, Monthly, Yearly.
+ *
+ * The arrow alone says something repeats without saying how often, which is the one thing
+ * worth knowing about it at a glance.
+ */
+function repeatWord(r: Reminder): string | null {
+ if (r.recurFrequency === null || r.recurFrequency === undefined) return null;
+ if ((r.recurInterval ?? 1) > 1) return repeatLabel(r);
+ return ["Daily", "Weekly", "Monthly", "Yearly"][r.recurFrequency] ?? "Repeats";
+}
+
/** `YYYY-MM-DDTHH:mm` for a datetime-local input, in local time. */
function toInputValue(seconds: number | null): string {
if (seconds === null) return "";
@@ -416,11 +438,6 @@ export function RemindersView() {
}
return out;
}, [items]);
- const colour = useMemo(
- () => lists.find((l) => l.guid === listGuid)?.colour || "var(--gold)",
- [lists, listGuid],
- );
-
/**
* The rows arranged the way Apple arranges them.
*
@@ -443,7 +460,8 @@ export function RemindersView() {
(selection as { kind: SmartList }).kind !== "flagged";
const sections = useMemo(() => {
- if (inList) return [{ key: "all", heading: null, colour: null, rows: threaded }];
+ if (inList)
+ return [{ key: "all", heading: null, colour: null, dated: false, rows: threaded }];
const kind = (selection as { kind: SmartList }).kind;
const now = new Date();
@@ -470,7 +488,9 @@ export function RemindersView() {
}
return buckets
.filter((b) => b.rows.length > 0 || b.heading !== null)
- .map((b) => ({ ...b, colour: null }));
+ // The buckets are all today, so a row under one needs only its time. The loose rows
+ // above are overdue or undated and still have to say which day they mean.
+ .map((b) => ({ ...b, colour: null, dated: b.heading !== null }));
}
if (kind === "scheduled") {
@@ -488,7 +508,7 @@ export function RemindersView() {
}
}
const out = overdue.length
- ? [{ key: "overdue", heading: "Overdue", colour: null, rows: overdue }]
+ ? [{ key: "overdue", heading: "Overdue", colour: null, dated: false, rows: overdue }]
: [];
for (const days of [...byDay.keys()].sort((a, b) => a - b)) {
const when = new Date(now.getFullYear(), now.getMonth(), now.getDate() + days);
@@ -505,6 +525,7 @@ export function RemindersView() {
month: "short",
}),
colour: null,
+ dated: true,
rows: byDay.get(days) ?? [],
});
}
@@ -528,6 +549,8 @@ export function RemindersView() {
key: guid,
heading: listOf(guid)?.title ?? "Reminders",
colour: listOf(guid)?.colour ?? null,
+ // Grouped by list rather than by day, so a row still has to name its day.
+ dated: false,
rows,
}));
}, [threaded, inList, selection, lists]);
@@ -731,7 +754,7 @@ export function RemindersView() {
<Fragment key={section.key}>
{section.heading && (
<h2
- className="rem-section"
+ className={`rem-section${section.dated ? " quiet" : ""}`}
style={section.colour ? { color: section.colour } : undefined}
>
{section.heading}
@@ -739,8 +762,11 @@ export function RemindersView() {
)}
<ul className="rem-list-items">
{section.rows.map(({ reminder, depth }) => {
+ // The heading already names the day in the views that have one.
const due =
- reminder.dueAt === null ? null : dueLabel(reminder.dueAt);
+ reminder.dueAt === null
+ ? null
+ : dueLabel(reminder.dueAt, section.dated);
const isOpen = openGuid === reminder.guid;
const repeat = repeatLabel(reminder);
const justMoved = moved?.guid === reminder.guid ? moved.text : null;
@@ -758,12 +784,19 @@ export function RemindersView() {
aria-label={reminder.title}
disabled={busyGuid === reminder.guid}
onClick={() => toggle(reminder)}
- style={{ borderColor: colour }}
>
+ {/* Apple's empty circle is neutral wherever it appears; the colour is the
+ reminder's own list, and it only shows once the thing is done. Borrowing
+ the open list's colour painted every circle in a smart view gold, which
+ said something untrue about where each reminder lived. */}
{reminder.completedAt && (
<span
className="tick-fill"
- style={{ background: colour }}
+ style={{
+ background:
+ lists.find((l) => l.guid === reminder.listGuid)?.colour ||
+ "var(--gold)",
+ }}
/>
)}
</button>
@@ -826,8 +859,12 @@ export function RemindersView() {
</span>
)}
{repeat && (
- <span className="rem-repeat" role="img" aria-label={repeat} title={repeat}>
- ↻
+ <span className="rem-repeat" title={repeat}>
+ <span aria-hidden="true">↻</span>
+ <span className="rem-repeat-word">
+ {repeatWord(reminder)}
+ </span>
+ <span className="visually-hidden">{repeat}</span>
</span>
)}
</>
diff --git a/src/styles/app.css b/src/styles/app.css
index d5c437f..4ca1c80 100644
--- a/src/styles/app.css
+++ b/src/styles/app.css
@@ -796,9 +796,21 @@
min-height: 0;
}
+/*
+ * A row runs the width of the pane, but what is in it does not.
+ *
+ * The separators span everything — capping the row itself left the list stranded in the left
+ * third of a wide window with its lines ending in mid-air. But with the text on a single
+ * stretching column, the flag, menu and delete buttons were pushed to the far edge: on a
+ * nineteen-hundred-pixel window they sat about thirteen hundred pixels from the reminder they
+ * act on, which is a long way to travel to tick something off.
+ *
+ * The text is given a reading measure and the buttons follow it, with the spare width taking
+ * up the slack at the end. The line still reaches both edges.
+ */
.rem-list-items li {
display: grid;
- grid-template-columns: 18px 1fr auto;
+ grid-template-columns: 18px minmax(0, 72ch) auto minmax(0, 1fr);
align-items: start;
gap: 10px;
padding: 7px 8px;
@@ -2335,8 +2347,34 @@ button.cal-day-item:hover { background: color-mix(in srgb, var(--sheet) 92%, var
.rem-section:first-child { margin-top: 2px; }
+/*
+ * A time of day is a quieter heading than a date or a list name — which is how Apple weights
+ * them: Morning and Afternoon sit back, Overdue and Tomorrow do not.
+ */
+.rem-section.quiet {
+ font-size: var(--t-13);
+ color: var(--text-2);
+}
+
/* A section with nothing under it still belongs — Apple leaves Tonight showing. */
.rem-section + .rem-list-items:empty { min-height: 8px; }
/* Which list a reminder came from, beside its time. */
.rem-from { color: var(--text-2); }
+
+/* The repeat, said rather than only drawn. */
+.rem-repeat { display: inline-flex; align-items: center; gap: 3px; }
+.rem-repeat-word { font-size: inherit; }
+
+/* Read aloud but not drawn — the full wording of a repeat, where the row shows the short one. */
+.visually-hidden {
+ position: absolute;
+ width: 1px;
+ height: 1px;
+ margin: -1px;
+ padding: 0;
+ overflow: hidden;
+ clip-path: inset(50%);
+ white-space: nowrap;
+ border: 0;
+}