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.

Calendar: a reminder for a day sits in Day and Week's all-day row

Yashwanth Kamireddi7e22a81bd37e
diff --git a/.uiverify/calendar-allday-reminders.mjs b/.uiverify/calendar-allday-reminders.mjs
index 5223cd7..d891f73 100644
--- a/.uiverify/calendar-allday-reminders.mjs
+++ b/.uiverify/calendar-allday-reminders.mjs
@@ -52,6 +52,10 @@ async function open(timezoneId, due) {
await page.getByRole("dialog", { name: "Go to Date" }).getByLabel("Date").fill(`${day.getFullYear()}-${pad(day.getMonth() + 1)}-${pad(day.getDate())}`);
await page.keyboard.press("Enter");
await page.waitForTimeout(400);
+ // In the all-day row, not on the hour grid's midnight line out of sight.
+ const inRow = await page.locator(".cx-allday .cx-reminder", { hasText: "Renew the passport" }).count();
+ const onGrid = await page.locator(".cx-columns .cx-reminder", { hasText: "Renew the passport" }).count();
+ ok(inRow === 1 && onGrid === 0, `Day: in the all-day row, not on the hour grid (row ${inRow}, grid ${onGrid})`);
const row = page.locator(".cx-pane-reminder", { hasText: "Renew the passport" });
const when = (await row.count()) ? (await row.locator(".cx-pane-when").innerText()).trim() : "(none)";
ok((await row.count()) === 1 && !/\d/.test(when), `Day: in the day's list, with no time ${JSON.stringify(when)}`);
diff --git a/src/screens/calendar/CalendarView.tsx b/src/screens/calendar/CalendarView.tsx
index 706b579..214bb61 100644
--- a/src/screens/calendar/CalendarView.tsx
+++ b/src/screens/calendar/CalendarView.tsx
@@ -2274,7 +2274,15 @@ const TimeGrid = memo(function TimeGrid({
// eslint-disable-next-line react-hooks/exhaustive-deps
[events, daysKey]
);
- const lanes = Math.max(1, ...spans.map((s) => s.lane + 1));
+ const eventLanes = Math.max(0, ...spans.map((s) => s.lane + 1));
+ // A reminder for a day has no time: it sits in the all-day row under the day's bars, as in
+ // Calendar. On the hour grid it was drawn on the midnight line, scrolled out of sight.
+ const dayReminders = useMemo(
+ () => days.map((d) => reminders.filter((r) => r.allDay && r.dueAt !== null && sameDay(dateOf(r.dueAt), d))),
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ [reminders, daysKey]
+ );
+ const lanes = Math.max(1, eventLanes + Math.max(0, ...dayReminders.map((l) => l.length)));
// Opened, it shows the working day rather than midnight — as Calendar does.
useLayoutEffect(() => {
@@ -2431,7 +2439,7 @@ const TimeGrid = memo(function TimeGrid({
const pendingTo = pending?.endsAt ?? null;
const layouts = useMemo(() => days.map((d) => {
const pending = pendingFrom === null || pendingTo === null ? null : { startsAt: pendingFrom, endsAt: pendingTo };
- const due = stackReminders(reminders.filter((r) => r.dueAt !== null && sameDay(dateOf(r.dueAt), d)));
+ const due = stackReminders(reminders.filter((r) => r.dueAt !== null && !r.allDay && sameDay(dateOf(r.dueAt), d)));
const marks = due.map(({ reminder, top }) => ({
id: reminder.guid,
top: (top / HOUR) * 60,
@@ -2503,6 +2511,23 @@ const TimeGrid = memo(function TimeGrid({
{s.event.title}
</button>
))}
+ {dayReminders.map((list, column) => list.map((r, k) => (
+ <span
+ key={r.guid}
+ {...showReminder(r)}
+ className={`cx-reminder${r.completedAt ? " is-done" : ""}`}
+ style={{
+ ...listColour(r),
+ top: `${4 + (eventLanes + k) * LANE + 2}px`,
+ left: `calc(${(column / days.length) * 100}% + 4px)`,
+ width: `calc(${100 / days.length}% - 8px)`,
+ maxWidth: `calc(${100 / days.length}% - 8px)`,
+ }}
+ >
+ <Ring reminder={r} quiet />
+ <span className="cx-reminder-title">{r.title}</span>
+ </span>
+ )))}
</div>
</div>