@remit/web-client 0.0.328 → 0.0.330

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. package/dist/src/components/calendar/CalendarEventEditor.d.ts +6 -0
  2. package/dist/src/components/calendar/CalendarEventEditor.js +371 -0
  3. package/dist/src/components/calendar/CalendarEventPopup.d.ts +10 -0
  4. package/dist/src/components/calendar/CalendarEventPopup.js +198 -0
  5. package/dist/src/components/calendar/CalendarLoadFailed.d.ts +8 -0
  6. package/dist/src/components/calendar/CalendarLoadFailed.js +11 -0
  7. package/dist/src/components/calendar/CalendarNavPane.d.ts +11 -0
  8. package/dist/src/components/calendar/CalendarNavPane.js +50 -0
  9. package/dist/src/components/calendar/CalendarQuickCreate.d.ts +22 -0
  10. package/dist/src/components/calendar/CalendarQuickCreate.js +204 -0
  11. package/dist/src/components/calendar/CalendarScreen.d.ts +11 -0
  12. package/dist/src/components/calendar/CalendarScreen.js +184 -0
  13. package/dist/src/components/calendar/CalendarSession.d.ts +24 -0
  14. package/dist/src/components/calendar/CalendarSession.js +12 -0
  15. package/dist/src/components/calendar/CalendarTaskPopup.d.ts +4 -0
  16. package/dist/src/components/calendar/CalendarTaskPopup.js +95 -0
  17. package/dist/src/components/calendar/CalendarWaiting.d.ts +3 -3
  18. package/dist/src/components/calendar/CalendarWaiting.js +5 -10
  19. package/dist/src/components/calendar/ChangeCalendarSuggestion.js +39 -5
  20. package/dist/src/components/calendar/EventMoves.d.ts +17 -0
  21. package/dist/src/components/calendar/EventMoves.js +103 -0
  22. package/dist/src/components/calendar/calendar-story-fixtures.js +8 -2
  23. package/dist/src/components/calendar/calendar-story-server.d.ts +2 -5
  24. package/dist/src/components/calendar/calendar-story-server.js +5 -6
  25. package/dist/src/components/compose/ComposeForm.js +1 -1
  26. package/dist/src/components/layout/AppFrame.d.ts +11 -0
  27. package/dist/src/components/layout/AppFrame.js +16 -0
  28. package/dist/src/components/mail/BulkRunProvider.js +1 -1
  29. package/dist/src/components/mail/MailSidebarAdapter.js +1 -1
  30. package/dist/src/components/mail/MessageActionMenu.js +1 -1
  31. package/dist/src/components/mail/MessageList.js +1 -1
  32. package/dist/src/components/mail/OutboxPane.js +1 -1
  33. package/dist/src/components/mail/ThreadListInteraction.js +1 -1
  34. package/dist/src/components/settings/CalendarDefaultSenderCard.d.ts +2 -0
  35. package/dist/src/components/settings/CalendarDefaultSenderCard.js +16 -0
  36. package/dist/src/components/ui/ErrorBannerProvider.d.ts +0 -23
  37. package/dist/src/components/ui/ErrorBannerProvider.js +3 -39
  38. package/dist/src/components/ui/SignedOutOverlay.d.ts +6 -0
  39. package/dist/src/components/ui/SignedOutOverlay.js +29 -0
  40. package/dist/src/components/ui/error-banner-context.d.ts +23 -0
  41. package/dist/src/components/ui/error-banner-context.js +38 -0
  42. package/dist/src/hooks/calendar/draft-session.d.ts +78 -0
  43. package/dist/src/hooks/calendar/draft-session.js +110 -0
  44. package/dist/src/hooks/calendar/draft.d.ts +8 -2
  45. package/dist/src/hooks/calendar/draft.js +17 -4
  46. package/dist/src/hooks/calendar/index.d.ts +6 -3
  47. package/dist/src/hooks/calendar/index.js +5 -2
  48. package/dist/src/hooks/calendar/instance.d.ts +2 -1
  49. package/dist/src/hooks/calendar/instance.js +14 -1
  50. package/dist/src/hooks/calendar/useCalendarJump.d.ts +0 -2
  51. package/dist/src/hooks/calendar/useCalendarJump.js +3 -5
  52. package/dist/src/hooks/calendar/useCalendarScheduling.d.ts +33 -0
  53. package/dist/src/hooks/calendar/useCalendarScheduling.js +118 -0
  54. package/dist/src/hooks/calendar/useCalendarTasks.d.ts +53 -0
  55. package/dist/src/hooks/calendar/useCalendarTasks.js +105 -0
  56. package/dist/src/hooks/calendar/useCalendarWrites.d.ts +18 -2
  57. package/dist/src/hooks/calendar/useCalendarWrites.js +19 -6
  58. package/dist/src/hooks/calendar/useCalendars.d.ts +3 -0
  59. package/dist/src/hooks/calendar/useCalendars.js +13 -5
  60. package/dist/src/hooks/calendar/useDraftSession.d.ts +32 -0
  61. package/dist/src/hooks/calendar/useDraftSession.js +106 -0
  62. package/dist/src/hooks/calendar/useMoveEvent.d.ts +4 -0
  63. package/dist/src/hooks/calendar/useMoveEvent.js +62 -0
  64. package/dist/src/hooks/use-system-update.js +3 -5
  65. package/dist/src/hooks/useApplyLabel.js +1 -1
  66. package/dist/src/hooks/useCalendarData.d.ts +9 -2
  67. package/dist/src/hooks/useCalendarData.js +22 -5
  68. package/dist/src/hooks/useCalendarSidePane.d.ts +14 -0
  69. package/dist/src/hooks/useCalendarSidePane.js +30 -0
  70. package/dist/src/hooks/useComposeLanguages.js +1 -1
  71. package/dist/src/hooks/useDeleteMessages.js +1 -1
  72. package/dist/src/hooks/useEmptyTrash.js +1 -1
  73. package/dist/src/hooks/useEscalatedActions.js +1 -1
  74. package/dist/src/hooks/useFilters.d.ts +1 -1
  75. package/dist/src/hooks/useLabels.d.ts +1 -1
  76. package/dist/src/hooks/useMarkAsRead.js +1 -1
  77. package/dist/src/hooks/useMoveMessages.js +1 -1
  78. package/dist/src/hooks/useRefreshControl.js +4 -8
  79. package/dist/src/hooks/useReportSpam.js +1 -1
  80. package/dist/src/hooks/useSignature.js +1 -1
  81. package/dist/src/hooks/useStaleAccountSync.js +4 -4
  82. package/dist/src/hooks/useStarredThreads.d.ts +1 -1
  83. package/dist/src/hooks/useToggleStar.js +1 -1
  84. package/dist/src/hooks/useToggleTrusted.js +1 -1
  85. package/dist/src/hooks/useTriggerSync.d.ts +1 -1
  86. package/dist/src/hooks/useUpdateAddressFlags.js +1 -1
  87. package/dist/src/hooks/useWarningsAttention.js +1 -3
  88. package/dist/src/lib/calendar-route.d.ts +6 -0
  89. package/dist/src/lib/calendar-route.js +14 -0
  90. package/dist/src/lib/calendar-side-pane-pref.d.ts +14 -0
  91. package/dist/src/lib/calendar-side-pane-pref.js +27 -0
  92. package/dist/src/lib/error-classifier.d.ts +5 -30
  93. package/dist/src/lib/error-classifier.js +7 -10
  94. package/dist/src/lib/escalate.d.ts +6 -0
  95. package/dist/src/lib/escalate.js +16 -0
  96. package/dist/src/lib/intelligence-pref.js +3 -2
  97. package/dist/src/lib/new-event-range.d.ts +26 -0
  98. package/dist/src/lib/new-event-range.js +69 -0
  99. package/dist/src/lib/query-error-handler.d.ts +2 -6
  100. package/dist/src/lib/query-error-handler.js +5 -14
  101. package/dist/src/lib/signed-out.d.ts +13 -0
  102. package/dist/src/lib/signed-out.js +28 -0
  103. package/dist/src/routeTree.gen.d.ts +98 -19
  104. package/dist/src/routeTree.gen.js +32 -1
  105. package/dist/src/routes/__root.js +8 -2
  106. package/dist/src/routes/calendar/$view.$date/$calendarObjectId/$recurrenceId/edit.d.ts +5 -0
  107. package/dist/src/routes/calendar/$view.$date/$calendarObjectId/$recurrenceId/edit.js +11 -0
  108. package/dist/src/routes/calendar/$view.$date/$calendarObjectId/$recurrenceId/index.d.ts +5 -0
  109. package/dist/src/routes/calendar/$view.$date/$calendarObjectId/$recurrenceId/index.js +12 -0
  110. package/dist/src/routes/calendar/$view.$date/$calendarObjectId/$recurrenceId.d.ts +1 -1
  111. package/dist/src/routes/calendar/$view.$date/$calendarObjectId/$recurrenceId.js +4 -13
  112. package/dist/src/routes/calendar/$view.$date/$calendarObjectId/edit.d.ts +5 -0
  113. package/dist/src/routes/calendar/$view.$date/$calendarObjectId/edit.js +14 -0
  114. package/dist/src/routes/calendar/$view.$date/$calendarObjectId/index.d.ts +1 -1
  115. package/dist/src/routes/calendar/$view.$date/$calendarObjectId/index.js +4 -4
  116. package/dist/src/routes/calendar/$view.$date/$calendarObjectId.d.ts +1 -1
  117. package/dist/src/routes/calendar/$view.$date/index.d.ts +1 -6
  118. package/dist/src/routes/calendar/$view.$date/index.js +3 -10
  119. package/dist/src/routes/calendar/$view.$date/new.d.ts +6 -2
  120. package/dist/src/routes/calendar/$view.$date/new.js +8 -13
  121. package/dist/src/routes/calendar/$view.$date/suggestion.$suggestionId.d.ts +1 -1
  122. package/dist/src/routes/calendar/$view.$date/suggestion.$suggestionId.js +2 -2
  123. package/dist/src/routes/calendar/$view.$date/task.$calendarTaskId.d.ts +5 -0
  124. package/dist/src/routes/calendar/$view.$date/task.$calendarTaskId.js +16 -0
  125. package/dist/src/routes/calendar/$view.$date.d.ts +1 -1
  126. package/dist/src/routes/calendar/$view.$date.js +14 -50
  127. package/dist/src/routes/calendar/index.d.ts +1 -1
  128. package/dist/src/routes/calendar/index.js +2 -1
  129. package/dist/src/routes/calendar.d.ts +4 -9
  130. package/dist/src/routes/calendar.js +10 -35
  131. package/dist/src/routes/mail/index.d.ts +1 -1
  132. package/dist/src/routes/mail/index.js +7 -2
  133. package/dist/src/routes/mail.js +6 -5
  134. package/dist/src/routes/settings/calendars.js +2 -1
  135. package/dist/src/routing/app-switch.d.ts +11 -0
  136. package/dist/src/routing/app-switch.js +35 -0
  137. package/dist/src/routing/calendar.d.ts +45 -4
  138. package/dist/src/routing/calendar.js +135 -13
  139. package/dist/src/routing/fragment.d.ts +1 -1
  140. package/dist/src/routing/fragment.js +6 -1
  141. package/dist/src/routing/index.d.ts +2 -1
  142. package/dist/src/routing/index.js +2 -1
  143. package/package.json +2 -2
  144. package/dist/src/components/calendar/CalendarComposePane.d.ts +0 -49
  145. package/dist/src/components/calendar/CalendarComposePane.js +0 -8
  146. package/dist/src/components/calendar/CalendarComposeSeed.d.ts +0 -7
  147. package/dist/src/components/calendar/CalendarComposeSeed.js +0 -19
  148. package/dist/src/components/calendar/CalendarEventPane.d.ts +0 -48
  149. package/dist/src/components/calendar/CalendarEventPane.js +0 -48
  150. package/dist/src/components/calendar/CalendarShell.d.ts +0 -43
  151. package/dist/src/components/calendar/CalendarShell.js +0 -35
  152. package/dist/src/components/calendar/CalendarViewPlaceholder.d.ts +0 -1
  153. package/dist/src/components/calendar/CalendarViewPlaceholder.js +0 -5
  154. package/dist/src/components/calendar/CalendarWorkspace.d.ts +0 -49
  155. package/dist/src/components/calendar/CalendarWorkspace.js +0 -65
  156. package/dist/src/components/calendar/OpenCalendarEvent.d.ts +0 -20
  157. package/dist/src/components/calendar/OpenCalendarEvent.js +0 -169
  158. package/dist/src/components/calendar/WriteCalendarEvent.d.ts +0 -13
  159. package/dist/src/components/calendar/WriteCalendarEvent.js +0 -59
@@ -0,0 +1,50 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { CalendarList, CalendarSidePane, datesFrom, MiniMonth, weekStart, } from "@remit/ui";
3
+ import { useState } from "react";
4
+ import { selectCalendarIds, useCalendars } from "../../hooks/calendar";
5
+ import { isoDate } from "../../lib/calendar-route";
6
+ import { useCalendarAddress, useCalendarNavigation } from "../../routing";
7
+ import { CalendarLoadFailed } from "./CalendarLoadFailed";
8
+ export const CALENDAR_SIDE_PANE_ID = "calendar-side-pane";
9
+ /** The days the grid draws, inclusive, for the mini month's shading. */
10
+ function rangeOnGrid(view, date) {
11
+ if (view === "day")
12
+ return [date, date];
13
+ if (view === "week") {
14
+ const days = datesFrom(weekStart(date), 7);
15
+ return [days[0], days[6]];
16
+ }
17
+ return ["", ""];
18
+ }
19
+ /** New event, the mini month and My calendars, bound to the address. */
20
+ export function CalendarNavPane({ onNewEvent, newEventRef, onPicked, className, }) {
21
+ const { view, date, calendarIds } = useCalendarAddress();
22
+ const { goToDate, setCalendarIds } = useCalendarNavigation();
23
+ const { calendars, error, retry } = useCalendars();
24
+ const [shown, setShown] = useState({ for: date, month: date });
25
+ const month = shown.for === date ? shown.month : date;
26
+ const [rangeStart, rangeEnd] = rangeOnGrid(view, date);
27
+ const visible = new Set(selectCalendarIds(calendars, calendarIds));
28
+ const toggle = (calendarId) => {
29
+ const next = new Set(visible);
30
+ if (next.has(calendarId))
31
+ next.delete(calendarId);
32
+ else
33
+ next.add(calendarId);
34
+ setCalendarIds(next.size === calendars.length
35
+ ? []
36
+ : calendars.map((calendar) => calendar.id).filter((id) => next.has(id)));
37
+ };
38
+ return (_jsx(CalendarSidePane, { id: CALENDAR_SIDE_PANE_ID, className: className, onNewEvent: onNewEvent, newEventRef: newEventRef, month: _jsx(MiniMonth, { month: month, today: isoDate(new Date()), rangeStart: rangeStart, rangeEnd: rangeEnd, onPickDay: (day) => {
39
+ goToDate(day);
40
+ onPicked?.();
41
+ }, onShowMonth: (next) => setShown({ for: date, month: next }) }), calendars: error !== null && calendars.length === 0 ? (_jsx(CalendarLoadFailed, { title: "Couldn't load your calendars", error: error, onRetry: retry, compact: true })) : (_jsx(CalendarList, { calendars: calendars, visible: visible, onToggle: toggle, onToggleAccount: (accountId, nextVisible) => {
42
+ const inAccount = new Set(calendars
43
+ .filter((calendar) => calendar.accountId === accountId)
44
+ .map((calendar) => calendar.id));
45
+ const next = calendars
46
+ .map((calendar) => calendar.id)
47
+ .filter((id) => inAccount.has(id) ? nextVisible : visible.has(id));
48
+ setCalendarIds(next.length === calendars.length ? [] : next);
49
+ } })) }));
50
+ }
@@ -0,0 +1,22 @@
1
+ import { type EventDraft } from "@remit/ui";
2
+ import { type Dispatch } from "react";
3
+ import type { DraftSession, SessionAction, SessionDraft } from "../../hooks/calendar/draft-session";
4
+ export declare const SETTINGS_HREF = "/settings/calendars";
5
+ /** The session's draft as the editor and the write read it. */
6
+ export declare function eventDraftOf(draft: SessionDraft): EventDraft;
7
+ export interface CalendarQuickCreateProps {
8
+ session: Extract<DraftSession, {
9
+ mode: "quick";
10
+ }>;
11
+ dispatch: Dispatch<SessionAction>;
12
+ /** Carries the label of the field that had focus, so the sidebar can keep it. */
13
+ onMoreOptions: (focusedLabel: string) => void;
14
+ onSaved: (calendarObjectId: string) => void;
15
+ /** On a phone the card sits in a sheet along the bottom. */
16
+ touch?: boolean;
17
+ }
18
+ /**
19
+ * The small popup on a new range. It sends nothing until Save, and a failure
20
+ * keeps every field and says why.
21
+ */
22
+ export declare function CalendarQuickCreate({ session, dispatch, onMoreOptions, onSaved, touch, }: CalendarQuickCreateProps): import("react").JSX.Element;
@@ -0,0 +1,204 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { CalendarPopover, CalendarQuickCreateCard, CalendarSheet, } from "@remit/ui";
3
+ import { useEffect, useId, useRef, useState, } from "react";
4
+ import { anchorZoneFor, createInputFromDraft, deviceTimeZone, isoAtInZone, UNZONED_CALENDAR, useCalendarSenders, useCalendars, useCalendarTaskWrites, useCalendarWrites, useGuestSuggestions, } from "../../hooks/calendar";
5
+ import { calendarEventReportHref } from "../../lib/calendar-report";
6
+ import { useBackCloses } from "../../routing";
7
+ import { useCalendarSession } from "./CalendarSession";
8
+ export const SETTINGS_HREF = "/settings/calendars";
9
+ /** The session's draft as the editor and the write read it. */
10
+ export function eventDraftOf(draft) {
11
+ return {
12
+ title: draft.title,
13
+ date: draft.range.date,
14
+ startTime: draft.range.startTime,
15
+ endDate: draft.range.endDate,
16
+ endTime: draft.range.endTime,
17
+ allDay: draft.range.allDay,
18
+ calendarId: draft.calendarId,
19
+ location: draft.location,
20
+ guests: draft.guests,
21
+ notes: "",
22
+ repeat: "",
23
+ };
24
+ }
25
+ /**
26
+ * The small popup on a new range. It sends nothing until Save, and a failure
27
+ * keeps every field and says why.
28
+ */
29
+ export function CalendarQuickCreate({ session, dispatch, onMoreOptions, onSaved, touch = false, }) {
30
+ const headingId = useId();
31
+ const titleRef = useRef(null);
32
+ const failureRef = useRef(null);
33
+ const [problem, setProblem] = useState("");
34
+ const { calendars: all, taskLists, defaultCalendarId, timeZoneByCalendarId, } = useCalendars();
35
+ const calendars = all.filter((calendar) => !calendar.readOnly);
36
+ const { createEvent } = useCalendarWrites();
37
+ const { createTask } = useCalendarTaskWrites();
38
+ const { defaultSenderId } = useCalendarSenders();
39
+ const [guestQuery, setGuestQuery] = useState("");
40
+ const guestSuggestions = useGuestSuggestions(guestQuery);
41
+ const calendarSession = useCalendarSession();
42
+ const { draft } = session;
43
+ const [mode, setMode] = useState("event");
44
+ const [taskFields, setTaskFields] = useState({
45
+ title: "",
46
+ dueDate: "",
47
+ dueTime: "",
48
+ description: "",
49
+ calendarId: "",
50
+ });
51
+ const switchMode = (next) => {
52
+ if (next === mode)
53
+ return;
54
+ setMode(next);
55
+ if (next === "event") {
56
+ dispatch({
57
+ type: "change",
58
+ draft: { ...draft, title: taskFields.title },
59
+ });
60
+ return;
61
+ }
62
+ setTaskFields((current) => ({
63
+ ...current,
64
+ title: draft.title,
65
+ dueDate: draft.range.date,
66
+ dueTime: draft.range.allDay ? "" : draft.range.startTime,
67
+ calendarId: current.calendarId === ""
68
+ ? (taskLists[0]?.id ?? "")
69
+ : current.calendarId,
70
+ }));
71
+ };
72
+ const fallbackCalendar = calendars.find((calendar) => calendar.id === defaultCalendarId)?.id ??
73
+ calendars[0]?.id ??
74
+ "";
75
+ const organizerAccountId = defaultSenderId ??
76
+ calendars.find((calendar) => calendar.id === draft.calendarId)?.accountId ??
77
+ "";
78
+ useEffect(() => {
79
+ titleRef.current?.focus();
80
+ }, []);
81
+ useEffect(() => {
82
+ if (draft.calendarId !== "" || fallbackCalendar === "")
83
+ return;
84
+ dispatch({
85
+ type: "change",
86
+ draft: { ...draft, calendarId: fallbackCalendar },
87
+ });
88
+ }, [draft, fallbackCalendar, dispatch]);
89
+ useEffect(() => {
90
+ if (session.status === "failed")
91
+ failureRef.current?.focus();
92
+ }, [session.status]);
93
+ const lastFocused = useRef(null);
94
+ const sheetRef = useRef(null);
95
+ useBackCloses(touch, () => {
96
+ dispatch({ type: "outside" });
97
+ return true;
98
+ });
99
+ const rangeKey = `${draft.range.date}T${draft.range.startTime}/${draft.range.endDate}T${draft.range.endTime}`;
100
+ useEffect(() => {
101
+ const sheet = sheetRef.current;
102
+ if (rangeKey === "")
103
+ return;
104
+ const block = document.querySelector("[data-draft-block]");
105
+ const grid = document.querySelector("[role='grid'][aria-label='Time grid']");
106
+ if (!sheet || !block || !grid)
107
+ return;
108
+ const overlap = block.getBoundingClientRect().bottom -
109
+ sheet.getBoundingClientRect().top +
110
+ 16;
111
+ if (overlap > 0)
112
+ grid.scrollTop += overlap;
113
+ }, [rangeKey]);
114
+ const cardRef = useRef(null);
115
+ useEffect(() => {
116
+ const card = cardRef.current;
117
+ if (!card)
118
+ return;
119
+ const remember = (event) => {
120
+ if (event.target instanceof HTMLInputElement ||
121
+ event.target instanceof HTMLSelectElement)
122
+ lastFocused.current = event.target;
123
+ };
124
+ card.addEventListener("focusin", remember);
125
+ return () => card.removeEventListener("focusin", remember);
126
+ }, []);
127
+ useEffect(() => {
128
+ const field = lastFocused.current;
129
+ if (rangeKey === "" || !field || document.activeElement === field)
130
+ return;
131
+ field.focus();
132
+ }, [rangeKey]);
133
+ const saveTask = () => {
134
+ if (taskFields.title.trim() === "") {
135
+ setProblem("Give the task a title before saving it.");
136
+ titleRef.current?.focus();
137
+ return;
138
+ }
139
+ setProblem("");
140
+ dispatch({ type: "save" });
141
+ const clock = deviceTimeZone();
142
+ const allDay = taskFields.dueTime === "";
143
+ void createTask({
144
+ calendarId: taskFields.calendarId,
145
+ summary: taskFields.title.trim(),
146
+ description: taskFields.description,
147
+ allDay,
148
+ due: allDay
149
+ ? taskFields.dueDate
150
+ : isoAtInZone(taskFields.dueDate, taskFields.dueTime, clock),
151
+ ...(allDay ? {} : { timeZone: anchorZoneFor(UNZONED_CALENDAR) }),
152
+ }).then((outcome) => {
153
+ if (outcome.kind === "written") {
154
+ dispatch({ type: "saved" });
155
+ return;
156
+ }
157
+ dispatch({
158
+ type: "save-failed",
159
+ problem: `Couldn't save the task: ${outcome.message}`,
160
+ });
161
+ });
162
+ };
163
+ const save = () => {
164
+ if (mode === "task") {
165
+ saveTask();
166
+ return;
167
+ }
168
+ const built = createInputFromDraft(eventDraftOf(draft), {
169
+ clock: deviceTimeZone(),
170
+ anchor: anchorZoneFor(timeZoneByCalendarId[draft.calendarId] ?? UNZONED_CALENDAR),
171
+ }, organizerAccountId);
172
+ if (!built.ok) {
173
+ setProblem(built.problem);
174
+ titleRef.current?.focus();
175
+ return;
176
+ }
177
+ setProblem("");
178
+ dispatch({ type: "save" });
179
+ void createEvent(built.input).then((outcome) => {
180
+ if (outcome.kind === "created") {
181
+ dispatch({ type: "saved" });
182
+ calendarSession.trackSends(outcome.sends);
183
+ onSaved(outcome.calendarObjectId);
184
+ return;
185
+ }
186
+ dispatch({
187
+ type: "save-failed",
188
+ problem: outcome.kind === "conflict"
189
+ ? "This calendar changed while you were writing. Close the form and try again."
190
+ : `Couldn't save this event: ${outcome.message}`,
191
+ });
192
+ });
193
+ };
194
+ const card = (dragHandle) => (_jsx("div", { ref: cardRef, children: _jsx(CalendarQuickCreateCard, { headingId: headingId, mode: mode, onMode: switchMode, fields: draft, taskFields: taskFields, onTaskChange: setTaskFields, calendars: calendars, taskLists: taskLists, guestSuggestions: guestSuggestions, onGuestQuery: setGuestQuery, onChange: (fields) => dispatch({ type: "change", draft: fields }), onSave: save, onMoreOptions: () => onMoreOptions(lastFocused.current?.getAttribute("aria-label") ?? ""), onClose: () => dispatch({ type: "outside" }), saving: session.status === "saving", problem: problem, failure: session.status === "failed"
195
+ ? {
196
+ text: session.problem,
197
+ reportHref: calendarEventReportHref(session.problem),
198
+ onRetry: save,
199
+ }
200
+ : undefined, failureRef: failureRef, titleRef: titleRef, settingsHref: SETTINGS_HREF, dragHandle: dragHandle, touch: touch }) }));
201
+ if (touch)
202
+ return (_jsx(CalendarSheet, { labelledBy: headingId, onDismiss: () => dispatch({ type: "outside" }), sheetRef: sheetRef, children: card() }));
203
+ return (_jsx(CalendarPopover, { anchor: "[data-draft-block]", anchorKey: rangeKey, labelledBy: headingId, wrapTab: true, header: (handle) => card(handle), children: null }));
204
+ }
@@ -0,0 +1,11 @@
1
+ import { type ReactNode } from "react";
2
+ export interface CalendarScreenProps {
3
+ isPhone: boolean;
4
+ /** What the route below the view has open: an event, the editor. */
5
+ detail: ReactNode;
6
+ }
7
+ /**
8
+ * The calendar's own screen: the toolbar across the top and the view under it,
9
+ * with the grid taking the whole width the panes leave.
10
+ */
11
+ export declare function CalendarScreen({ isPhone, detail }: CalendarScreenProps): import("react").JSX.Element;
@@ -0,0 +1,184 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { CalendarCancellationsSent, CalendarFailureBlock, CalendarGrid, CalendarInvitationsNotSent, CalendarScreenToolbar, CalendarTimeGrid, CalendarYear, calendarRangeTitle, clickRange, Dialog, datesFrom, initialFocus, isoWeek, NewEventSquare, Segmented, weekStart, zonedMoment, } from "@remit/ui";
3
+ import { Loader2 } from "lucide-react";
4
+ import { useCallback, useMemo, useRef, useState } from "react";
5
+ import { calendarInstanceId, deviceTimeZone, useCalendarTaskWrites, useSendsFollowUp, } from "../../hooks/calendar";
6
+ import { drawnRange } from "../../hooks/calendar/draft-session";
7
+ import { useDraftSession } from "../../hooks/calendar/useDraftSession";
8
+ import { useCalendarData } from "../../hooks/useCalendarData";
9
+ import { useCalendarSidePane } from "../../hooks/useCalendarSidePane";
10
+ import { readCalendarDensity, writeCalendarDensity, } from "../../lib/calendar-density";
11
+ import { calendarEventReportHref } from "../../lib/calendar-report";
12
+ import { calendarViewMountsAgenda, isoDate, shownCalendarView, stepCalendarDate, } from "../../lib/calendar-route";
13
+ import { searchFromRange } from "../../lib/new-event-range";
14
+ import { useCalendarAddress, useCalendarNavigation, useEditingEvent, useIsWritingEvent, useOpenCalendarEvent, useOpenCalendarTask, } from "../../routing";
15
+ import { AgendaView } from "./AgendaView";
16
+ import { CalendarLoadFailed } from "./CalendarLoadFailed";
17
+ import { CALENDAR_SIDE_PANE_ID, CalendarNavPane } from "./CalendarNavPane";
18
+ import { CalendarQuickCreate } from "./CalendarQuickCreate";
19
+ import { CalendarSessionContext } from "./CalendarSession";
20
+ import { useEventMoves } from "./EventMoves";
21
+ import { PendingSuggestions } from "./PendingSuggestions";
22
+ const PHONE_VIEWS = ["day", "month", "agenda"];
23
+ const DENSITY_OPTIONS = [
24
+ { value: "comfortable", label: "Detail", shortLabel: "Detail" },
25
+ { value: "compact", label: "Glance", shortLabel: "Glance" },
26
+ ];
27
+ const FAILED_TITLE = {
28
+ year: "Couldn't load this year",
29
+ month: "Couldn't load this month",
30
+ week: "Couldn't load this week",
31
+ day: "Couldn't load this day",
32
+ agenda: "Couldn't load these days",
33
+ };
34
+ /**
35
+ * The calendar's own screen: the toolbar across the top and the view under it,
36
+ * with the grid taking the whole width the panes leave.
37
+ */
38
+ export function CalendarScreen({ isPhone, detail }) {
39
+ const { view, date, calendarIds } = useCalendarAddress();
40
+ const drawsGrid = !calendarViewMountsAgenda(view);
41
+ const { events: storedEvents, calendars, timeZoneByCalendarId, colorByCalendarId, isLoading, error, retry, instanceOf, tasks, storedTasks, } = useCalendarData({ view, date, calendarIds, enabled: drawsGrid });
42
+ const { updateTask } = useCalendarTaskWrites();
43
+ const [taskFailure, setTaskFailure] = useState();
44
+ const toggleTask = useCallback(function toggle(calendarTaskId) {
45
+ const task = storedTasks.find((candidate) => candidate.calendarTaskId === calendarTaskId);
46
+ if (!task)
47
+ throw new Error(`task ${calendarTaskId} is drawn but was not read`);
48
+ setTaskFailure(undefined);
49
+ void updateTask(task, { completed: !task.completed }).then((outcome) => {
50
+ if (outcome.kind === "written")
51
+ return;
52
+ const text = `Couldn't save "${task.summary}": ${outcome.message}`;
53
+ setTaskFailure({
54
+ text,
55
+ reportHref: calendarEventReportHref(text),
56
+ onRetry: () => toggle(calendarTaskId),
57
+ });
58
+ });
59
+ }, [storedTasks, updateTask]);
60
+ const [sends, setSends] = useState([]);
61
+ const trackSends = useCallback((next) => setSends([...next]), []);
62
+ const followUp = useSendsFollowUp(sends);
63
+ const cancelled = sends
64
+ .filter((send) => send.method === "Cancel")
65
+ .map((send) => send.email);
66
+ const moves = useEventMoves(storedEvents, calendars, timeZoneByCalendarId, retry);
67
+ const events = moves.events;
68
+ const { goToView, goToToday, goToDate, openEvent, openTask, openNewEvent, closeToView, changeSuggestionFirst, zoomToDay, dayHref, } = useCalendarNavigation();
69
+ const editingEvent = useEditingEvent();
70
+ const routedEvent = useOpenCalendarEvent();
71
+ const openedEvent = editingEvent ? undefined : routedEvent;
72
+ const openedTask = useOpenCalendarTask();
73
+ const isWriting = useIsWritingEvent();
74
+ const [density, setDensity] = useState(readCalendarDensity);
75
+ const changeDensity = useCallback((next) => {
76
+ writeCalendarDensity(next);
77
+ setDensity(next);
78
+ }, []);
79
+ const selectEvent = useCallback((eventId) => {
80
+ const instance = instanceOf(eventId);
81
+ openEvent(instance.calendarObjectId, instance.recurrenceId);
82
+ }, [instanceOf, openEvent]);
83
+ const hasDetail = isWriting;
84
+ const sidePane = useCalendarSidePane(isPhone);
85
+ const { session, dispatch, takeGesture, setOrigin, requestClose, carriedFocus, focusSaved, } = useDraftSession({
86
+ layers: {
87
+ eventPopup: openedEvent !== undefined || openedTask !== undefined,
88
+ sidebar: isWriting,
89
+ nav: sidePane.navOpen,
90
+ },
91
+ isPhone,
92
+ closeToView,
93
+ closeNav: () => sidePane.setNavOpen(false),
94
+ drawnEvents: events,
95
+ });
96
+ const moreOptions = useCallback((focusedLabel) => {
97
+ if (session.mode !== "quick")
98
+ return;
99
+ carriedFocus.current = focusedLabel;
100
+ dispatch({ type: "expand" });
101
+ openNewEvent(searchFromRange(session.draft.range, deviceTimeZone()));
102
+ }, [session, carriedFocus, dispatch, openNewEvent]);
103
+ const sessionValue = useMemo(() => ({
104
+ session,
105
+ dispatch,
106
+ requestClose,
107
+ carriedFocus,
108
+ focusSaved,
109
+ trackSends,
110
+ }), [session, dispatch, requestClose, carriedFocus, focusSaved, trackSends]);
111
+ const drawn = drawnRange(session);
112
+ const gridDraft = drawn
113
+ ? {
114
+ range: drawn,
115
+ title: session.mode === "idle" ? "" : session.draft.title,
116
+ tone: session.mode === "sidebar" && !session.dragging
117
+ ? "draft"
118
+ : "selection",
119
+ warning: session.mode === "quick" && session.status === "failed",
120
+ handles: session.mode === "sidebar",
121
+ }
122
+ : undefined;
123
+ const now = new Date().toISOString();
124
+ const shown = shownCalendarView(view, isPhone);
125
+ const pickSlot = (slot) => dispatch({ type: "new-event", range: slot });
126
+ const yearCounts = useMemo(() => {
127
+ const counts = {};
128
+ if (shown !== "year")
129
+ return counts;
130
+ const zone = deviceTimeZone();
131
+ for (const event of events) {
132
+ const day = event.allDay
133
+ ? event.start.slice(0, 10)
134
+ : zonedMoment(event.start, zone).date;
135
+ counts[day] = (counts[day] ?? 0) + 1;
136
+ }
137
+ for (const task of tasks) {
138
+ const day = task.allDay
139
+ ? task.due.slice(0, 10)
140
+ : zonedMoment(task.due, zone).date;
141
+ counts[day] = (counts[day] ?? 0) + 1;
142
+ }
143
+ return counts;
144
+ }, [events, tasks, shown]);
145
+ const timeGridDays = shown === "day"
146
+ ? [date]
147
+ : shown === "week"
148
+ ? datesFrom(weekStart(date), 7)
149
+ : undefined;
150
+ const selectedEventId = openedEvent
151
+ ? calendarInstanceId(openedEvent.calendarObjectId, openedEvent.recurrenceId ?? "")
152
+ : "";
153
+ const newEventRef = useRef(null);
154
+ const newEvent = useCallback(() => {
155
+ const today = isoDate(new Date());
156
+ const minutes = new Date().getHours() * 60;
157
+ const days = timeGridDays ?? [date];
158
+ const slot = initialFocus(days, today, minutes);
159
+ setOrigin(document.activeElement instanceof HTMLElement
160
+ ? document.activeElement
161
+ : newEventRef.current);
162
+ if (openedEvent)
163
+ closeToView();
164
+ dispatch({ type: "new-event", range: clickRange(slot.date, slot.minute) });
165
+ }, [timeGridDays, date, openedEvent, closeToView, setOrigin, dispatch]);
166
+ const weekNumber = shown === "week" || shown === "day"
167
+ ? isoWeek(shown === "week" ? weekStart(date) : date)
168
+ : undefined;
169
+ const body = calendarViewMountsAgenda(view) ? (_jsx(AgendaView, { density: density, onPickSlot: pickSlot })) : error !== undefined && error !== null ? (_jsx(CalendarLoadFailed, { title: FAILED_TITLE[view], error: error, onRetry: retry })) : isLoading ? (_jsx("div", { role: "status", "aria-label": "Loading the calendar", className: "flex h-full items-center justify-center bg-surface", children: _jsx(Loader2, { className: "size-6 animate-spin text-fg-subtle" }) })) : shown === "year" ? (_jsx(CalendarYear, { date: date, today: isoDate(new Date()), counts: yearCounts, onPickDay: zoomToDay })) : timeGridDays ? (_jsx(CalendarTimeGrid, { days: timeGridDays, events: events, colorByCalendarId: colorByCalendarId, density: density, timeZone: deviceTimeZone(), now: now, selectedEventId: selectedEventId, draft: gridDraft, onGesture: takeGesture, onSelectEvent: selectEvent, onOpenDay: zoomToDay, touch: isPhone, canMove: moves.canMove, onMoveEvent: moves.onMoveEvent, tasks: tasks, selectedTaskId: openedTask ?? "", onSelectTask: openTask, onToggleTask: toggleTask })) : (_jsx(CalendarGrid, { date: date, events: events, colorByCalendarId: colorByCalendarId, density: density, selectedEventId: selectedEventId, timeZone: deviceTimeZone(), now: now, onSelectEvent: selectEvent, onPickSlot: pickSlot, dayHref: dayHref, onZoomDay: zoomToDay, canMove: moves.canMove, onMoveEvent: moves.onMoveEvent, tasks: tasks, onSelectTask: openTask }));
170
+ return (_jsxs(CalendarSessionContext.Provider, { value: sessionValue, children: [_jsxs("div", { className: "flex h-full min-h-0 flex-col bg-surface text-fg", children: [_jsx(CalendarScreenToolbar, { view: shown, views: isPhone ? PHONE_VIEWS : undefined, title: isPhone && shown === "day"
171
+ ? new Intl.DateTimeFormat(undefined, {
172
+ weekday: "short",
173
+ day: "numeric",
174
+ month: "short",
175
+ timeZone: "UTC",
176
+ }).format(new Date(`${date}T00:00:00Z`))
177
+ : calendarRangeTitle(shown, date), weekNumber: weekNumber, onChangeView: goToView, onPrev: () => goToDate(stepCalendarDate(date, shown, -1)), onNext: () => goToDate(stepCalendarDate(date, shown, 1)), onToday: goToToday, touch: isPhone, sidePane: {
178
+ open: isPhone ? sidePane.navOpen : sidePane.open,
179
+ controls: CALENDAR_SIDE_PANE_ID,
180
+ onToggle: sidePane.toggle,
181
+ }, trailing: shown === "week" || shown === "day" ? (_jsx(Segmented, { ariaLabel: "Calendar density", options: DENSITY_OPTIONS, value: density, onChange: changeDensity, touch: isPhone, className: "shrink-0" })) : undefined }), _jsxs("div", { className: "relative flex min-h-0 flex-1", children: [sidePane.open && (_jsx(CalendarNavPane, { onNewEvent: newEvent, newEventRef: newEventRef })), !(isPhone && hasDetail) && (_jsxs(_Fragment, { children: [isPhone && session.mode === "idle" && (_jsx(NewEventSquare, { onNewEvent: newEvent, newEventRef: newEventRef, className: "fixed right-4 bottom-[calc(var(--app-tab-bar,0px)+1rem)] z-30 size-14 rounded-full" })), !sidePane.open && !isPhone && (_jsx(NewEventSquare, { onNewEvent: newEvent, newEventRef: newEventRef, className: "absolute top-2 left-2 z-20" })), !isWriting && (_jsx(PendingSuggestions, { onChangeFirst: changeSuggestionFirst })), _jsxs("div", { "data-calendar-body": "", className: "flex min-h-0 min-w-0 flex-1 flex-col", children: [moves.banner, cancelled.length > 0 && (_jsx("div", { className: "p-2", children: _jsx(CalendarCancellationsSent, { guests: cancelled, onDismiss: () => setSends([]) }) })), taskFailure && (_jsx("div", { className: "p-2", children: _jsx(CalendarFailureBlock, { failure: taskFailure }) })), followUp.checkError !== null && (_jsx("div", { className: "p-2", children: _jsx(CalendarLoadFailed, { title: `Couldn't check whether the messages to ${followUp.unchecked.join(", ")} went out`, error: followUp.checkError, onRetry: followUp.recheck, compact: true }) })), followUp.missed.length > 0 && (_jsx("div", { className: "p-2", children: _jsx(CalendarInvitationsNotSent, { missed: followUp.missed, onRetry: () => void followUp.retry(), reportHref: calendarEventReportHref(`Invitations not sent to ${followUp.missed.join(", ")}`), onDismiss: () => setSends([]) }) })), body] })] })), !hasDetail && detail, session.mode === "quick" && (_jsx(CalendarQuickCreate, { session: session, dispatch: dispatch, onMoreOptions: moreOptions, onSaved: focusSaved, touch: isPhone })), hasDetail && (_jsx("aside", { "aria-label": "Event", className: isPhone
182
+ ? "min-h-0 min-w-0 flex-1"
183
+ : "w-[26rem] shrink-0 border-l border-line", children: detail }))] })] }), moves.prompt, isPhone && (_jsx(Dialog, { open: sidePane.navOpen, onClose: () => sidePane.setNavOpen(false), title: "Calendars", anchor: "left", children: _jsx(CalendarNavPane, { onNewEvent: newEvent, onPicked: () => sidePane.setNavOpen(false), className: "w-full" }) }))] }));
184
+ }
@@ -0,0 +1,24 @@
1
+ import type { RemitImapCalendarSchedulingSend } from "@remit/api-http-client/types.gen.ts";
2
+ import { type Dispatch, type MutableRefObject } from "react";
3
+ import type { DraftSession, SessionAction } from "../../hooks/calendar/draft-session";
4
+ /**
5
+ * The calendar screen's one draft, handed to the sidebar the route mounts
6
+ * below it. A context outside the route files, for the reason
7
+ * `CalendarShell` gave: the generated tree imports routes relatively.
8
+ */
9
+ export interface CalendarSessionValue {
10
+ session: DraftSession;
11
+ dispatch: Dispatch<SessionAction>;
12
+ /** The sidebar's own close, asked by Esc; it confirms a touched draft. */
13
+ requestClose: MutableRefObject<(() => void) | null>;
14
+ /** The field quick-create had focus in when it expanded, by its label. */
15
+ carriedFocus: MutableRefObject<string>;
16
+ /** Focus the saved event once the grid draws it. */
17
+ focusSaved: (calendarObjectId: string) => void;
18
+ /** Follow the scheduling messages a save queued, and say which guests they missed. */
19
+ trackSends: (sends: readonly RemitImapCalendarSchedulingSend[]) => void;
20
+ }
21
+ export declare const CalendarSessionContext: import("react").Context<CalendarSessionValue | null>;
22
+ export declare function useCalendarSession(): CalendarSessionValue;
23
+ /** The session where a calendar screen holds one; a surface mounted alone has none. */
24
+ export declare function useOptionalCalendarSession(): CalendarSessionValue | null;
@@ -0,0 +1,12 @@
1
+ import { createContext, useContext, } from "react";
2
+ export const CalendarSessionContext = createContext(null);
3
+ export function useCalendarSession() {
4
+ const value = useContext(CalendarSessionContext);
5
+ if (!value)
6
+ throw new Error("the calendar session is not mounted");
7
+ return value;
8
+ }
9
+ /** The session where a calendar screen holds one; a surface mounted alone has none. */
10
+ export function useOptionalCalendarSession() {
11
+ return useContext(CalendarSessionContext);
12
+ }
@@ -0,0 +1,4 @@
1
+ /** The task the address names, in a popup beside its chip. */
2
+ export declare function CalendarTaskPopup({ calendarTaskId, }: {
3
+ calendarTaskId: string;
4
+ }): import("react").JSX.Element | null;
@@ -0,0 +1,95 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { CalendarPopover, CalendarTaskPopupCard, } from "@remit/ui";
3
+ import { useEffect, useId, useLayoutEffect, useRef, useState } from "react";
4
+ import { deviceTimeZone, isoAtInZone, isoOnClock, useCalendars, useCalendarTask, useCalendarTaskWrites, } from "../../hooks/calendar";
5
+ import { calendarEventReportHref } from "../../lib/calendar-report";
6
+ import { useCalendarNavigation } from "../../routing";
7
+ import { CalendarLoadFailed } from "./CalendarLoadFailed";
8
+ const dueText = (due, allDay) => {
9
+ const date = new Date(`${due.slice(0, 10)}T00:00:00Z`);
10
+ const day = new Intl.DateTimeFormat(undefined, {
11
+ weekday: "long",
12
+ day: "numeric",
13
+ month: "long",
14
+ timeZone: "UTC",
15
+ }).format(date);
16
+ return allDay ? `Due ${day}` : `Due ${day} · ${due.slice(11, 16)}`;
17
+ };
18
+ /** The task the address names, in a popup beside its chip. */
19
+ export function CalendarTaskPopup({ calendarTaskId, }) {
20
+ const read = useCalendarTask(calendarTaskId);
21
+ const { closeToView } = useCalendarNavigation();
22
+ const headingId = useId();
23
+ const closeRef = useRef(null);
24
+ const gone = read.kind === "gone";
25
+ useEffect(() => {
26
+ if (gone)
27
+ closeRef.current?.focus();
28
+ }, [gone]);
29
+ if (read.kind === "loading")
30
+ return null;
31
+ if (read.kind === "found")
32
+ return _jsx(OpenTask, { task: read.task });
33
+ if (read.kind === "failed")
34
+ return (_jsx(CalendarPopover, { anchor: null, anchorKey: "failed", labelledBy: headingId, children: _jsx("div", { id: headingId, className: "p-4", children: _jsx(CalendarLoadFailed, { title: "Couldn't open this task", error: read.error, onRetry: read.retry, compact: true }) }) }));
35
+ return (_jsx(CalendarPopover, { anchor: null, anchorKey: "gone", labelledBy: headingId, children: _jsxs("div", { className: "flex flex-col gap-3 p-4", children: [_jsx("h2", { id: headingId, className: "text-base font-medium text-fg", children: "This task was deleted or moved" }), _jsx("button", { ref: closeRef, type: "button", onClick: closeToView, className: "self-end rounded-md border border-line px-3 py-1.5 text-sm font-medium hover:bg-surface-sunken focus-visible:ring-2 focus-visible:ring-ring", children: "Close" })] }) }));
36
+ }
37
+ function OpenTask({ task }) {
38
+ const { taskLists } = useCalendars();
39
+ const { closeToView } = useCalendarNavigation();
40
+ const { updateTask, deleteTask, isWriting } = useCalendarTaskWrites();
41
+ const headingId = useId();
42
+ const headingRef = useRef(null);
43
+ const [failure, setFailure] = useState();
44
+ const [anchor, setAnchor] = useState(null);
45
+ const { calendarTaskId } = task;
46
+ useLayoutEffect(() => {
47
+ setAnchor(document.querySelector(`[data-task-id="${CSS.escape(calendarTaskId)}"]`));
48
+ }, [calendarTaskId]);
49
+ useEffect(() => {
50
+ headingRef.current?.focus();
51
+ }, []);
52
+ const clock = deviceTimeZone();
53
+ const shownDue = task.allDay ? task.due : isoOnClock(task.due, clock);
54
+ const fields = {
55
+ title: task.summary,
56
+ dueDate: shownDue.slice(0, 10),
57
+ dueTime: task.allDay ? "" : shownDue.slice(11, 16),
58
+ description: task.description,
59
+ };
60
+ const settle = (retry) => (outcome) => {
61
+ if (outcome.kind === "written") {
62
+ setFailure(undefined);
63
+ return;
64
+ }
65
+ const text = `Couldn't save the task: ${outcome.message}`;
66
+ setFailure({
67
+ text,
68
+ reportHref: calendarEventReportHref(text),
69
+ onRetry: retry,
70
+ });
71
+ };
72
+ const toggle = () => {
73
+ void updateTask(task, { completed: !task.completed }).then(settle(toggle));
74
+ };
75
+ const save = (next) => {
76
+ void updateTask(task, {
77
+ summary: next.title,
78
+ description: next.description,
79
+ allDay: next.dueTime === "",
80
+ due: next.dueTime === ""
81
+ ? next.dueDate
82
+ : isoAtInZone(next.dueDate, next.dueTime, clock),
83
+ }).then(settle(() => save(next)));
84
+ };
85
+ const remove = () => {
86
+ void deleteTask(task).then((outcome) => {
87
+ if (outcome.kind === "written") {
88
+ closeToView();
89
+ return;
90
+ }
91
+ settle(remove)(outcome);
92
+ });
93
+ };
94
+ return (_jsx(CalendarPopover, { anchor: anchor, anchorKey: `${calendarTaskId}:${anchor ? "chip" : "none"}`, labelledBy: headingId, children: _jsx(CalendarTaskPopupCard, { headingId: headingId, headingRef: headingRef, fields: fields, dueText: dueText(shownDue, task.allDay), listName: taskLists.find((list) => list.id === task.calendarId)?.name ?? "Tasks", completed: task.completed, onToggle: toggle, onSave: save, onDelete: remove, onClose: closeToView, busy: isWriting, failure: failure }) }));
95
+ }
@@ -2,15 +2,15 @@ import { type CalendarSuggestionIntel } from "@remit/ui";
2
2
  import type { ReactNode } from "react";
3
3
  /**
4
4
  * What the mail is still asking about time, beside the calendar it would land
5
- * on. One reading at a time, as a deck: each is a decision, and the reader
6
- * makes it with the week in view rather than from a list of them.
5
+ * on. Every reading at once, one under the other, each with its own Add and
6
+ * Dismiss, beside the week it would land on.
7
7
  *
8
8
  * Presentational. The readings, the answer on its way and the refusal all come
9
9
  * in from the host, which reads them off the server.
10
10
  */
11
11
  export interface CalendarWaitingProps {
12
12
  suggestions: CalendarSuggestionIntel[];
13
- /** An answer to the top reading is on its way. */
13
+ /** An answer to one of the readings is on its way. */
14
14
  busy: boolean;
15
15
  /** Why the last answer did not land. Empty when it did. */
16
16
  failure: string;