@remit/web-client 0.0.329 → 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.
- package/dist/src/components/calendar/CalendarEventEditor.js +57 -7
- package/dist/src/components/calendar/CalendarEventPopup.js +74 -9
- package/dist/src/components/calendar/CalendarQuickCreate.js +78 -5
- package/dist/src/components/calendar/CalendarScreen.js +49 -10
- package/dist/src/components/calendar/CalendarSession.d.ts +3 -0
- package/dist/src/components/calendar/CalendarTaskPopup.d.ts +4 -0
- package/dist/src/components/calendar/CalendarTaskPopup.js +95 -0
- package/dist/src/components/calendar/CalendarWaiting.d.ts +3 -3
- package/dist/src/components/calendar/CalendarWaiting.js +5 -10
- package/dist/src/components/compose/ComposeForm.js +1 -1
- package/dist/src/components/mail/BulkRunProvider.js +1 -1
- package/dist/src/components/mail/MessageActionMenu.js +1 -1
- package/dist/src/components/mail/MessageList.js +1 -1
- package/dist/src/components/mail/OutboxPane.js +1 -1
- package/dist/src/components/mail/ThreadListInteraction.js +1 -1
- package/dist/src/components/settings/CalendarDefaultSenderCard.d.ts +2 -0
- package/dist/src/components/settings/CalendarDefaultSenderCard.js +16 -0
- package/dist/src/components/ui/ErrorBannerProvider.d.ts +0 -23
- package/dist/src/components/ui/ErrorBannerProvider.js +3 -39
- package/dist/src/components/ui/error-banner-context.d.ts +23 -0
- package/dist/src/components/ui/error-banner-context.js +38 -0
- package/dist/src/hooks/calendar/draft-session.d.ts +2 -1
- package/dist/src/hooks/calendar/draft-session.js +1 -0
- package/dist/src/hooks/calendar/draft.d.ts +8 -2
- package/dist/src/hooks/calendar/draft.js +17 -4
- package/dist/src/hooks/calendar/index.d.ts +4 -2
- package/dist/src/hooks/calendar/index.js +4 -2
- package/dist/src/hooks/calendar/instance.d.ts +2 -1
- package/dist/src/hooks/calendar/instance.js +14 -1
- package/dist/src/hooks/calendar/useCalendarScheduling.d.ts +33 -0
- package/dist/src/hooks/calendar/useCalendarScheduling.js +118 -0
- package/dist/src/hooks/calendar/useCalendarTasks.d.ts +53 -0
- package/dist/src/hooks/calendar/useCalendarTasks.js +105 -0
- package/dist/src/hooks/calendar/useCalendarWrites.d.ts +7 -1
- package/dist/src/hooks/calendar/useCalendarWrites.js +12 -4
- package/dist/src/hooks/calendar/useCalendars.d.ts +2 -0
- package/dist/src/hooks/calendar/useCalendars.js +8 -3
- package/dist/src/hooks/calendar/useDraftSession.js +1 -1
- package/dist/src/hooks/calendar/useMoveEvent.js +1 -0
- package/dist/src/hooks/useApplyLabel.js +1 -1
- package/dist/src/hooks/useCalendarData.d.ts +7 -2
- package/dist/src/hooks/useCalendarData.js +17 -5
- package/dist/src/hooks/useComposeLanguages.js +1 -1
- package/dist/src/hooks/useDeleteMessages.js +1 -1
- package/dist/src/hooks/useEmptyTrash.js +1 -1
- package/dist/src/hooks/useEscalatedActions.js +1 -1
- package/dist/src/hooks/useFilters.d.ts +1 -1
- package/dist/src/hooks/useLabels.d.ts +1 -1
- package/dist/src/hooks/useMarkAsRead.js +1 -1
- package/dist/src/hooks/useMoveMessages.js +1 -1
- package/dist/src/hooks/useReportSpam.js +1 -1
- package/dist/src/hooks/useSignature.js +1 -1
- package/dist/src/hooks/useStarredThreads.d.ts +1 -1
- package/dist/src/hooks/useToggleStar.js +1 -1
- package/dist/src/hooks/useToggleTrusted.js +1 -1
- package/dist/src/hooks/useTriggerSync.d.ts +1 -1
- package/dist/src/hooks/useUpdateAddressFlags.js +1 -1
- package/dist/src/routeTree.gen.d.ts +20 -3
- package/dist/src/routeTree.gen.js +7 -0
- package/dist/src/routes/calendar/$view.$date/task.$calendarTaskId.d.ts +5 -0
- package/dist/src/routes/calendar/$view.$date/task.$calendarTaskId.js +16 -0
- package/dist/src/routes/settings/calendars.js +2 -1
- package/dist/src/routing/calendar.d.ts +4 -0
- package/dist/src/routing/calendar.js +15 -1
- package/dist/src/routing/index.d.ts +1 -1
- package/dist/src/routing/index.js +1 -1
- package/package.json +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { CalendarEventGone, CalendarEventSidebar, ConfirmDialog, RecurrenceScopePrompt, } from "@remit/ui";
|
|
2
|
+
import { CalendarEventGone, CalendarEventSidebar, ConfirmDialog, RecurrenceScopePrompt, storedGuest, } from "@remit/ui";
|
|
3
3
|
import { useEffect, useId, useRef, useState } from "react";
|
|
4
|
-
import { anchorZoneFor, calendarInstanceId, createInputFromDraft, deviceTimeZone, draftFromEvent, isoOnClock, moveRule, patchFromDrafts, rruleFromIcalData, storedAnchorZone, textFromIcalData, textFromRrule, UNZONED_CALENDAR, useCalendarEvent, useCalendars, useCalendarWrites, } from "../../hooks/calendar";
|
|
4
|
+
import { anchorZoneFor, calendarInstanceId, createInputFromDraft, deviceTimeZone, draftFromEvent, isoOnClock, moveRule, patchFromDrafts, rruleFromIcalData, storedAnchorZone, textFromIcalData, textFromRrule, UNZONED_CALENDAR, useCalendarEvent, useCalendarSenders, useCalendars, useCalendarWrites, useGuestSuggestions, } from "../../hooks/calendar";
|
|
5
5
|
import { useCalendarData } from "../../hooks/useCalendarData";
|
|
6
6
|
import { formatEventWhen } from "../../lib/calendar-format";
|
|
7
7
|
import { calendarEventReportHref } from "../../lib/calendar-report";
|
|
@@ -86,6 +86,11 @@ export function CalendarNewEventSidebar() {
|
|
|
86
86
|
const { calendars: all, defaultCalendarId, timeZoneByCalendarId, } = useCalendars();
|
|
87
87
|
const calendars = all.filter((calendar) => !calendar.readOnly);
|
|
88
88
|
const { createEvent, isWriting } = useCalendarWrites();
|
|
89
|
+
const { senders, defaultSenderId } = useCalendarSenders();
|
|
90
|
+
const [pickedSender, setPickedSender] = useState();
|
|
91
|
+
const [guestQuery, setGuestQuery] = useState("");
|
|
92
|
+
const guestSuggestions = useGuestSuggestions(guestQuery);
|
|
93
|
+
const { trackSends } = useCalendarSession();
|
|
89
94
|
const titleRef = useRef(null);
|
|
90
95
|
const failureRef = useRef(null);
|
|
91
96
|
const clock = deviceTimeZone();
|
|
@@ -135,10 +140,15 @@ export function CalendarNewEventSidebar() {
|
|
|
135
140
|
extras.repeat !== "" ||
|
|
136
141
|
!extras.busy ||
|
|
137
142
|
draft.title !== (initial?.title ?? "") ||
|
|
138
|
-
draft.location !== (initial?.location ?? "")
|
|
143
|
+
draft.location !== (initial?.location ?? "") ||
|
|
144
|
+
draft.guests.length !== (initial?.guests.length ?? 0));
|
|
139
145
|
const { close, confirm, leave } = useSidebarClose(touched);
|
|
140
146
|
if (!draft)
|
|
141
147
|
return null;
|
|
148
|
+
const senderId = pickedSender ??
|
|
149
|
+
defaultSenderId ??
|
|
150
|
+
calendars.find((calendar) => calendar.id === draft.calendarId)?.accountId ??
|
|
151
|
+
"";
|
|
142
152
|
const eventDraft = {
|
|
143
153
|
...eventDraftOf(draft),
|
|
144
154
|
notes: extras.notes,
|
|
@@ -151,7 +161,7 @@ export function CalendarNewEventSidebar() {
|
|
|
151
161
|
anchor: zone !== clock
|
|
152
162
|
? zone
|
|
153
163
|
: anchorZoneFor(timeZoneByCalendarId[draft.calendarId] ?? UNZONED_CALENDAR),
|
|
154
|
-
});
|
|
164
|
+
}, senderId);
|
|
155
165
|
if (!built.ok) {
|
|
156
166
|
setProblem(built.problem);
|
|
157
167
|
return;
|
|
@@ -164,6 +174,7 @@ export function CalendarNewEventSidebar() {
|
|
|
164
174
|
}).then((outcome) => {
|
|
165
175
|
if (outcome.kind === "created") {
|
|
166
176
|
dispatch({ type: "saved" });
|
|
177
|
+
trackSends(outcome.sends);
|
|
167
178
|
focusSaved(outcome.calendarObjectId);
|
|
168
179
|
leave();
|
|
169
180
|
return;
|
|
@@ -186,6 +197,7 @@ export function CalendarNewEventSidebar() {
|
|
|
186
197
|
title: next.title,
|
|
187
198
|
location: next.location,
|
|
188
199
|
calendarId: next.calendarId,
|
|
200
|
+
guests: next.guests,
|
|
189
201
|
},
|
|
190
202
|
});
|
|
191
203
|
setExtras((current) => ({
|
|
@@ -193,7 +205,14 @@ export function CalendarNewEventSidebar() {
|
|
|
193
205
|
notes: next.notes,
|
|
194
206
|
repeat: next.repeat,
|
|
195
207
|
}));
|
|
196
|
-
}, calendars: calendars, calendarEditable: true, repeatEditable: true, timeZone: extras.timeZone, timeZones: TIME_ZONES, onTimeZone: (timeZone) => setExtras((current) => ({ ...current, timeZone })), busy: extras.busy, onBusy: (busy) => setExtras((current) => ({ ...current, busy })),
|
|
208
|
+
}, calendars: calendars, calendarEditable: true, repeatEditable: true, timeZone: extras.timeZone, timeZones: TIME_ZONES, onTimeZone: (timeZone) => setExtras((current) => ({ ...current, timeZone })), busy: extras.busy, onBusy: (busy) => setExtras((current) => ({ ...current, busy })), guests: {
|
|
209
|
+
suggestions: guestSuggestions,
|
|
210
|
+
onQuery: setGuestQuery,
|
|
211
|
+
senders,
|
|
212
|
+
sender: senderId,
|
|
213
|
+
onSender: setPickedSender,
|
|
214
|
+
senderEditable: true,
|
|
215
|
+
}, onSave: save, onCancel: close, saving: isWriting, problem: problem, failure: failure, failureRef: failureRef, titleRef: titleRef }), confirm] }));
|
|
197
216
|
}
|
|
198
217
|
export function CalendarEditEventSidebar({ calendarObjectId, recurrenceId, }) {
|
|
199
218
|
const { session, dispatch, focusSaved } = useCalendarSession();
|
|
@@ -206,6 +225,11 @@ export function CalendarEditEventSidebar({ calendarObjectId, recurrenceId, }) {
|
|
|
206
225
|
const { calendars, timeZoneByCalendarId } = useCalendars();
|
|
207
226
|
const { closeToView } = useCalendarNavigation();
|
|
208
227
|
const { updateEvent, isWriting } = useCalendarWrites();
|
|
228
|
+
const { senders, defaultSenderId } = useCalendarSenders();
|
|
229
|
+
const [pickedSender, setPickedSender] = useState();
|
|
230
|
+
const [guestQuery, setGuestQuery] = useState("");
|
|
231
|
+
const guestSuggestions = useGuestSuggestions(guestQuery);
|
|
232
|
+
const { trackSends } = useCalendarSession();
|
|
209
233
|
const titleRef = useRef(null);
|
|
210
234
|
const failureRef = useRef(null);
|
|
211
235
|
const goneId = useId();
|
|
@@ -233,6 +257,9 @@ export function CalendarEditEventSidebar({ calendarObjectId, recurrenceId, }) {
|
|
|
233
257
|
repeat: rrule === "" ? "" : (textFromRrule(shownRule, startTime) ?? "Repeats"),
|
|
234
258
|
location: stored.location,
|
|
235
259
|
notes: stored.description,
|
|
260
|
+
guests: resource.attendees
|
|
261
|
+
.filter((attendee) => attendee.role === "Guest")
|
|
262
|
+
.map((attendee) => storedGuest(attendee.email, attendee.displayName)),
|
|
236
263
|
});
|
|
237
264
|
const isBusy = !freeIds.has(event.id);
|
|
238
265
|
setBefore({ draft, busy: isBusy, anchor });
|
|
@@ -276,6 +303,16 @@ export function CalendarEditEventSidebar({ calendarObjectId, recurrenceId, }) {
|
|
|
276
303
|
return null;
|
|
277
304
|
const calendar = calendars.find((candidate) => candidate.id === event.calendarId);
|
|
278
305
|
const repeats = event.seriesId !== "" && recurrenceId !== undefined;
|
|
306
|
+
const organizer = resource?.organizer ?? "";
|
|
307
|
+
const guestsEditable = resource !== undefined &&
|
|
308
|
+
(resource.participation === "Organizer" ||
|
|
309
|
+
(resource.participation === "Unscheduled" && organizer === ""));
|
|
310
|
+
const organizerSender = senders.find((sender) => sender.email === organizer)?.accountId;
|
|
311
|
+
const senderId = organizerSender ??
|
|
312
|
+
pickedSender ??
|
|
313
|
+
defaultSenderId ??
|
|
314
|
+
calendar?.accountId ??
|
|
315
|
+
"";
|
|
279
316
|
const save = (scope) => {
|
|
280
317
|
setAsking(false);
|
|
281
318
|
const patch = patchFromDrafts(before.draft, after, {
|
|
@@ -288,9 +325,12 @@ export function CalendarEditEventSidebar({ calendarObjectId, recurrenceId, }) {
|
|
|
288
325
|
}
|
|
289
326
|
setProblem("");
|
|
290
327
|
setFailure(undefined);
|
|
291
|
-
const
|
|
328
|
+
const withBusy = busy !== before.busy
|
|
292
329
|
? { ...patch.patch, transparency: transparencyOf(busy) }
|
|
293
330
|
: patch.patch;
|
|
331
|
+
const body = withBusy.attendees !== undefined && organizer === "" && senderId !== ""
|
|
332
|
+
? { ...withBusy, organizerAccountId: senderId }
|
|
333
|
+
: withBusy;
|
|
294
334
|
void updateEvent({
|
|
295
335
|
calendarObjectId,
|
|
296
336
|
calendarId: event.calendarId,
|
|
@@ -300,6 +340,7 @@ export function CalendarEditEventSidebar({ calendarObjectId, recurrenceId, }) {
|
|
|
300
340
|
}, body).then((outcome) => {
|
|
301
341
|
if (outcome.kind === "written") {
|
|
302
342
|
dispatch({ type: "saved" });
|
|
343
|
+
trackSends(outcome.sends);
|
|
303
344
|
focusSaved(calendarObjectId);
|
|
304
345
|
leave();
|
|
305
346
|
return;
|
|
@@ -317,5 +358,14 @@ export function CalendarEditEventSidebar({ calendarObjectId, recurrenceId, }) {
|
|
|
317
358
|
return (_jsxs(_Fragment, { children: [_jsx(CalendarEventSidebar, { heading: "Edit event", draft: after, onChange: (next) => {
|
|
318
359
|
setAfter(next);
|
|
319
360
|
dispatch({ type: "sidebar-range", range: rangeOfDraft(next) });
|
|
320
|
-
}, calendars: calendar ? [calendar] : [], calendarEditable: false, repeatEditable: !repeats, timeZone: timeZone, timeZones: TIME_ZONES, onTimeZone: setTimeZone, busy: busy, onBusy: setBusy,
|
|
361
|
+
}, calendars: calendar ? [calendar] : [], calendarEditable: false, repeatEditable: !repeats, timeZone: timeZone, timeZones: TIME_ZONES, onTimeZone: setTimeZone, busy: busy, onBusy: setBusy, guests: guestsEditable
|
|
362
|
+
? {
|
|
363
|
+
suggestions: guestSuggestions,
|
|
364
|
+
onQuery: setGuestQuery,
|
|
365
|
+
senders,
|
|
366
|
+
sender: senderId,
|
|
367
|
+
onSender: setPickedSender,
|
|
368
|
+
senderEditable: organizer === "",
|
|
369
|
+
}
|
|
370
|
+
: undefined, onSave: () => (repeats ? setAsking(true) : save(undefined)), onCancel: close, saving: isWriting, problem: problem, failure: failure, failureRef: failureRef, titleRef: titleRef, children: asking && (_jsx(RecurrenceScopePrompt, { title: event.title, ruleText: after.repeat === "" ? "It repeats" : after.repeat, instanceText: formatEventWhen(event), onChoose: save, onCancel: () => setAsking(false) })) }), confirm] }));
|
|
321
371
|
}
|
|
@@ -1,12 +1,30 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { CalendarEventGone, CalendarEventPopupCard, CalendarPopover, RecurrenceScopePrompt, } from "@remit/ui";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { CalendarEventGone, CalendarEventGuests, CalendarEventPopupCard, CalendarPopover, CalendarReplyRow, ConfirmDialog, RecurrenceScopePrompt, } from "@remit/ui";
|
|
3
3
|
import { Navigate } from "@tanstack/react-router";
|
|
4
4
|
import { useEffect, useId, useLayoutEffect, useRef, useState } from "react";
|
|
5
|
-
import { calendarInstanceId, seriesOccurrenceOf, textFromIcalData, useCalendarEvent, useCalendarJump, useCalendars, useCalendarWrites, } from "../../hooks/calendar";
|
|
5
|
+
import { calendarInstanceId, rsvpOfParticipation, seriesOccurrenceOf, textFromIcalData, useCalendarEvent, useCalendarJump, useCalendars, useCalendarWrites, } from "../../hooks/calendar";
|
|
6
6
|
import { useCalendarData } from "../../hooks/useCalendarData";
|
|
7
7
|
import { formatEventWhen } from "../../lib/calendar-format";
|
|
8
8
|
import { calendarEventReportHref } from "../../lib/calendar-report";
|
|
9
9
|
import { useCalendarAddress, useCalendarNavigation } from "../../routing";
|
|
10
|
+
import { useCalendarSession } from "./CalendarSession";
|
|
11
|
+
const ATTENDEE_RSVP = {
|
|
12
|
+
Accepted: "accepted",
|
|
13
|
+
Declined: "declined",
|
|
14
|
+
Tentative: "tentative",
|
|
15
|
+
NeedsAction: "noReply",
|
|
16
|
+
};
|
|
17
|
+
const toAttendee = (attendee) => ({
|
|
18
|
+
name: attendee.displayName,
|
|
19
|
+
email: attendee.email,
|
|
20
|
+
rsvp: ATTENDEE_RSVP[attendee.status],
|
|
21
|
+
role: attendee.role === "Organizer" ? "organizer" : "attendee",
|
|
22
|
+
});
|
|
23
|
+
const ANSWER_OF = {
|
|
24
|
+
accepted: "Accepted",
|
|
25
|
+
declined: "Declined",
|
|
26
|
+
tentative: "Tentative",
|
|
27
|
+
};
|
|
10
28
|
const CONFLICT = "This calendar changed while you were writing.";
|
|
11
29
|
const failureText = (outcome) => outcome.kind === "conflict"
|
|
12
30
|
? `${CONFLICT} Close the popup and open the event again.`
|
|
@@ -26,12 +44,16 @@ export function CalendarEventPopup({ calendarObjectId, recurrenceId, }) {
|
|
|
26
44
|
});
|
|
27
45
|
const { calendars } = useCalendars();
|
|
28
46
|
const { closeToView, openEditor } = useCalendarNavigation();
|
|
29
|
-
const { deleteEvent, isWriting } = useCalendarWrites();
|
|
47
|
+
const { deleteEvent, updateEvent, isWriting } = useCalendarWrites();
|
|
48
|
+
const calendarSession = useCalendarSession();
|
|
49
|
+
const [answering, setAnswering] = useState();
|
|
50
|
+
const [replyFailure, setReplyFailure] = useState();
|
|
30
51
|
const headingId = useId();
|
|
31
52
|
const headingRef = useRef(null);
|
|
32
53
|
const closeRef = useRef(null);
|
|
33
54
|
const failureRef = useRef(null);
|
|
34
55
|
const [asking, setAsking] = useState(false);
|
|
56
|
+
const [confirmingDelete, setConfirmingDelete] = useState(false);
|
|
35
57
|
const [failure, setFailure] = useState(undefined);
|
|
36
58
|
const [anchor, setAnchor] = useState(null);
|
|
37
59
|
const instanceId = calendarInstanceId(calendarObjectId, recurrenceId ?? "");
|
|
@@ -75,10 +97,33 @@ export function CalendarEventPopup({ calendarObjectId, recurrenceId, }) {
|
|
|
75
97
|
scope,
|
|
76
98
|
etag: resource?.etag ?? "",
|
|
77
99
|
});
|
|
100
|
+
const guestNames = (resource?.attendees ?? [])
|
|
101
|
+
.filter((attendee) => attendee.role === "Guest")
|
|
102
|
+
.map((attendee) => attendee.displayName === "" ? attendee.email : attendee.displayName);
|
|
103
|
+
const askDelete = () => {
|
|
104
|
+
if (guestNames.length > 0) {
|
|
105
|
+
setConfirmingDelete(true);
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
if (repeats) {
|
|
109
|
+
setAsking(true);
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
remove(undefined);
|
|
113
|
+
};
|
|
114
|
+
const confirmDelete = () => {
|
|
115
|
+
setConfirmingDelete(false);
|
|
116
|
+
if (repeats) {
|
|
117
|
+
setAsking(true);
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
remove(undefined);
|
|
121
|
+
};
|
|
78
122
|
const remove = (scope) => {
|
|
79
123
|
setAsking(false);
|
|
80
124
|
void deleteEvent(write(scope)).then((outcome) => {
|
|
81
125
|
if (outcome.kind === "written") {
|
|
126
|
+
calendarSession.trackSends(outcome.sends);
|
|
82
127
|
closeToView();
|
|
83
128
|
return;
|
|
84
129
|
}
|
|
@@ -90,6 +135,28 @@ export function CalendarEventPopup({ calendarObjectId, recurrenceId, }) {
|
|
|
90
135
|
});
|
|
91
136
|
});
|
|
92
137
|
};
|
|
138
|
+
const reply = (answer, scope) => {
|
|
139
|
+
setAnswering(undefined);
|
|
140
|
+
setReplyFailure(undefined);
|
|
141
|
+
void updateEvent(write(scope), { answer: ANSWER_OF[answer] }).then((outcome) => {
|
|
142
|
+
if (outcome.kind === "written") {
|
|
143
|
+
calendarSession.trackSends(outcome.sends);
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
const text = outcome.kind === "conflict"
|
|
147
|
+
? `${CONFLICT} Close the popup and open the event again.`
|
|
148
|
+
: `Couldn't send your reply: ${outcome.message}`;
|
|
149
|
+
setReplyFailure({
|
|
150
|
+
text,
|
|
151
|
+
reportHref: calendarEventReportHref(text),
|
|
152
|
+
onRetry: () => reply(answer, scope),
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
};
|
|
156
|
+
const participation = resource?.participation;
|
|
157
|
+
const isGuest = participation !== undefined &&
|
|
158
|
+
participation !== "Organizer" &&
|
|
159
|
+
participation !== "Unscheduled";
|
|
93
160
|
if (occurrence) {
|
|
94
161
|
return (_jsx(Navigate, { to: "/calendar/$view/$date/$calendarObjectId/$recurrenceId", params: {
|
|
95
162
|
view,
|
|
@@ -125,9 +192,7 @@ export function CalendarEventPopup({ calendarObjectId, recurrenceId, }) {
|
|
|
125
192
|
}
|
|
126
193
|
if (!event)
|
|
127
194
|
return null;
|
|
128
|
-
return (_jsx(CalendarPopover, { anchor: anchor, anchorKey: `${instanceId}:${anchor ? "chip" : "none"}`, labelledBy: headingId, children:
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
? () => (repeats ? setAsking(true) : remove(undefined))
|
|
132
|
-
: undefined, deleting: isWriting, onClose: closeToView, failure: failure, failureRef: failureRef, children: asking && (_jsx(RecurrenceScopePrompt, { title: event.title, ruleText: "It repeats", instanceText: formatEventWhen(event), onChoose: remove, onCancel: () => setAsking(false) })) }) }));
|
|
195
|
+
return (_jsxs(_Fragment, { children: [_jsx(CalendarPopover, { anchor: anchor, anchorKey: `${instanceId}:${anchor ? "chip" : "none"}`, labelledBy: headingId, children: _jsxs(CalendarEventPopupCard, { headingId: headingId, headingRef: headingRef, title: event.title, color: calendar?.color ?? "cal-1", when: formatEventWhen(event).replace(", ", " · "), location: stored?.location ?? "", calendarName: calendar?.name ?? "", availability: freeIds.has(event.id) ? "Free" : "Busy", onEdit: writable
|
|
196
|
+
? () => openEditor(calendarObjectId, recurrenceId)
|
|
197
|
+
: undefined, onDelete: writable ? askDelete : undefined, deleting: isWriting, onClose: closeToView, failure: failure, failureRef: failureRef, children: [resource && (_jsx(CalendarEventGuests, { attendees: resource.attendees.map(toAttendee), counts: resource.attendeeCounts })), isGuest && participation && (_jsx(CalendarReplyRow, { current: rsvpOfParticipation(participation), onAnswer: (answer) => repeats ? setAnswering(answer) : reply(answer, undefined), sending: isWriting, failure: replyFailure })), answering && (_jsx(RecurrenceScopePrompt, { title: event.title, ruleText: "It repeats", instanceText: formatEventWhen(event), scopes: ["this", "all"], onChoose: (scope) => reply(answering, scope), onCancel: () => setAnswering(undefined) })), asking && (_jsx(RecurrenceScopePrompt, { title: event.title, ruleText: "It repeats", instanceText: formatEventWhen(event), onChoose: remove, onCancel: () => setAsking(false) }))] }) }), _jsx(ConfirmDialog, { isOpen: confirmingDelete, title: "Delete and tell the guests?", description: `${guestNames.join(", ")} will get a cancellation.`, confirmLabel: "Delete and send", cancelLabel: "Keep event", destructive: true, onConfirm: confirmDelete, onCancel: () => setConfirmingDelete(false) })] }));
|
|
133
198
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { CalendarPopover, CalendarQuickCreateCard, CalendarSheet, } from "@remit/ui";
|
|
3
3
|
import { useEffect, useId, useRef, useState, } from "react";
|
|
4
|
-
import { anchorZoneFor, createInputFromDraft, deviceTimeZone, UNZONED_CALENDAR, useCalendars, useCalendarWrites, } from "../../hooks/calendar";
|
|
4
|
+
import { anchorZoneFor, createInputFromDraft, deviceTimeZone, isoAtInZone, UNZONED_CALENDAR, useCalendarSenders, useCalendars, useCalendarTaskWrites, useCalendarWrites, useGuestSuggestions, } from "../../hooks/calendar";
|
|
5
5
|
import { calendarEventReportHref } from "../../lib/calendar-report";
|
|
6
6
|
import { useBackCloses } from "../../routing";
|
|
7
|
+
import { useCalendarSession } from "./CalendarSession";
|
|
7
8
|
export const SETTINGS_HREF = "/settings/calendars";
|
|
8
9
|
/** The session's draft as the editor and the write read it. */
|
|
9
10
|
export function eventDraftOf(draft) {
|
|
@@ -16,7 +17,7 @@ export function eventDraftOf(draft) {
|
|
|
16
17
|
allDay: draft.range.allDay,
|
|
17
18
|
calendarId: draft.calendarId,
|
|
18
19
|
location: draft.location,
|
|
19
|
-
guests:
|
|
20
|
+
guests: draft.guests,
|
|
20
21
|
notes: "",
|
|
21
22
|
repeat: "",
|
|
22
23
|
};
|
|
@@ -30,13 +31,50 @@ export function CalendarQuickCreate({ session, dispatch, onMoreOptions, onSaved,
|
|
|
30
31
|
const titleRef = useRef(null);
|
|
31
32
|
const failureRef = useRef(null);
|
|
32
33
|
const [problem, setProblem] = useState("");
|
|
33
|
-
const { calendars: all, defaultCalendarId, timeZoneByCalendarId, } = useCalendars();
|
|
34
|
+
const { calendars: all, taskLists, defaultCalendarId, timeZoneByCalendarId, } = useCalendars();
|
|
34
35
|
const calendars = all.filter((calendar) => !calendar.readOnly);
|
|
35
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();
|
|
36
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
|
+
};
|
|
37
72
|
const fallbackCalendar = calendars.find((calendar) => calendar.id === defaultCalendarId)?.id ??
|
|
38
73
|
calendars[0]?.id ??
|
|
39
74
|
"";
|
|
75
|
+
const organizerAccountId = defaultSenderId ??
|
|
76
|
+
calendars.find((calendar) => calendar.id === draft.calendarId)?.accountId ??
|
|
77
|
+
"";
|
|
40
78
|
useEffect(() => {
|
|
41
79
|
titleRef.current?.focus();
|
|
42
80
|
}, []);
|
|
@@ -92,11 +130,45 @@ export function CalendarQuickCreate({ session, dispatch, onMoreOptions, onSaved,
|
|
|
92
130
|
return;
|
|
93
131
|
field.focus();
|
|
94
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
|
+
};
|
|
95
163
|
const save = () => {
|
|
164
|
+
if (mode === "task") {
|
|
165
|
+
saveTask();
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
96
168
|
const built = createInputFromDraft(eventDraftOf(draft), {
|
|
97
169
|
clock: deviceTimeZone(),
|
|
98
170
|
anchor: anchorZoneFor(timeZoneByCalendarId[draft.calendarId] ?? UNZONED_CALENDAR),
|
|
99
|
-
});
|
|
171
|
+
}, organizerAccountId);
|
|
100
172
|
if (!built.ok) {
|
|
101
173
|
setProblem(built.problem);
|
|
102
174
|
titleRef.current?.focus();
|
|
@@ -107,6 +179,7 @@ export function CalendarQuickCreate({ session, dispatch, onMoreOptions, onSaved,
|
|
|
107
179
|
void createEvent(built.input).then((outcome) => {
|
|
108
180
|
if (outcome.kind === "created") {
|
|
109
181
|
dispatch({ type: "saved" });
|
|
182
|
+
calendarSession.trackSends(outcome.sends);
|
|
110
183
|
onSaved(outcome.calendarObjectId);
|
|
111
184
|
return;
|
|
112
185
|
}
|
|
@@ -118,7 +191,7 @@ export function CalendarQuickCreate({ session, dispatch, onMoreOptions, onSaved,
|
|
|
118
191
|
});
|
|
119
192
|
});
|
|
120
193
|
};
|
|
121
|
-
const card = (dragHandle) => (_jsx("div", { ref: cardRef, children: _jsx(CalendarQuickCreateCard, { headingId: headingId, fields: draft, calendars: calendars, 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"
|
|
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"
|
|
122
195
|
? {
|
|
123
196
|
text: session.problem,
|
|
124
197
|
reportHref: calendarEventReportHref(session.problem),
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { CalendarGrid, CalendarScreenToolbar, CalendarTimeGrid, CalendarYear, calendarRangeTitle, clickRange, Dialog, datesFrom, initialFocus, isoWeek, NewEventSquare, Segmented, weekStart, zonedMoment, } from "@remit/ui";
|
|
2
|
+
import { CalendarCancellationsSent, CalendarFailureBlock, CalendarGrid, CalendarInvitationsNotSent, CalendarScreenToolbar, CalendarTimeGrid, CalendarYear, calendarRangeTitle, clickRange, Dialog, datesFrom, initialFocus, isoWeek, NewEventSquare, Segmented, weekStart, zonedMoment, } from "@remit/ui";
|
|
3
3
|
import { Loader2 } from "lucide-react";
|
|
4
4
|
import { useCallback, useMemo, useRef, useState } from "react";
|
|
5
|
-
import { calendarInstanceId, deviceTimeZone } from "../../hooks/calendar";
|
|
5
|
+
import { calendarInstanceId, deviceTimeZone, useCalendarTaskWrites, useSendsFollowUp, } from "../../hooks/calendar";
|
|
6
6
|
import { drawnRange } from "../../hooks/calendar/draft-session";
|
|
7
7
|
import { useDraftSession } from "../../hooks/calendar/useDraftSession";
|
|
8
8
|
import { useCalendarData } from "../../hooks/useCalendarData";
|
|
9
9
|
import { useCalendarSidePane } from "../../hooks/useCalendarSidePane";
|
|
10
10
|
import { readCalendarDensity, writeCalendarDensity, } from "../../lib/calendar-density";
|
|
11
|
+
import { calendarEventReportHref } from "../../lib/calendar-report";
|
|
11
12
|
import { calendarViewMountsAgenda, isoDate, shownCalendarView, stepCalendarDate, } from "../../lib/calendar-route";
|
|
12
13
|
import { searchFromRange } from "../../lib/new-event-range";
|
|
13
|
-
import { useCalendarAddress, useCalendarNavigation, useEditingEvent, useIsWritingEvent, useOpenCalendarEvent, } from "../../routing";
|
|
14
|
+
import { useCalendarAddress, useCalendarNavigation, useEditingEvent, useIsWritingEvent, useOpenCalendarEvent, useOpenCalendarTask, } from "../../routing";
|
|
14
15
|
import { AgendaView } from "./AgendaView";
|
|
15
16
|
import { CalendarLoadFailed } from "./CalendarLoadFailed";
|
|
16
17
|
import { CALENDAR_SIDE_PANE_ID, CalendarNavPane } from "./CalendarNavPane";
|
|
@@ -37,13 +38,38 @@ const FAILED_TITLE = {
|
|
|
37
38
|
export function CalendarScreen({ isPhone, detail }) {
|
|
38
39
|
const { view, date, calendarIds } = useCalendarAddress();
|
|
39
40
|
const drawsGrid = !calendarViewMountsAgenda(view);
|
|
40
|
-
const { events: storedEvents, calendars, timeZoneByCalendarId, colorByCalendarId, isLoading, error, retry, instanceOf, } = useCalendarData({ view, date, calendarIds, enabled: drawsGrid });
|
|
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);
|
|
41
66
|
const moves = useEventMoves(storedEvents, calendars, timeZoneByCalendarId, retry);
|
|
42
67
|
const events = moves.events;
|
|
43
|
-
const { goToView, goToToday, goToDate, openEvent, openNewEvent, closeToView, changeSuggestionFirst, zoomToDay, dayHref, } = useCalendarNavigation();
|
|
68
|
+
const { goToView, goToToday, goToDate, openEvent, openTask, openNewEvent, closeToView, changeSuggestionFirst, zoomToDay, dayHref, } = useCalendarNavigation();
|
|
44
69
|
const editingEvent = useEditingEvent();
|
|
45
70
|
const routedEvent = useOpenCalendarEvent();
|
|
46
71
|
const openedEvent = editingEvent ? undefined : routedEvent;
|
|
72
|
+
const openedTask = useOpenCalendarTask();
|
|
47
73
|
const isWriting = useIsWritingEvent();
|
|
48
74
|
const [density, setDensity] = useState(readCalendarDensity);
|
|
49
75
|
const changeDensity = useCallback((next) => {
|
|
@@ -58,7 +84,7 @@ export function CalendarScreen({ isPhone, detail }) {
|
|
|
58
84
|
const sidePane = useCalendarSidePane(isPhone);
|
|
59
85
|
const { session, dispatch, takeGesture, setOrigin, requestClose, carriedFocus, focusSaved, } = useDraftSession({
|
|
60
86
|
layers: {
|
|
61
|
-
eventPopup: openedEvent !== undefined,
|
|
87
|
+
eventPopup: openedEvent !== undefined || openedTask !== undefined,
|
|
62
88
|
sidebar: isWriting,
|
|
63
89
|
nav: sidePane.navOpen,
|
|
64
90
|
},
|
|
@@ -74,7 +100,14 @@ export function CalendarScreen({ isPhone, detail }) {
|
|
|
74
100
|
dispatch({ type: "expand" });
|
|
75
101
|
openNewEvent(searchFromRange(session.draft.range, deviceTimeZone()));
|
|
76
102
|
}, [session, carriedFocus, dispatch, openNewEvent]);
|
|
77
|
-
const sessionValue = useMemo(() => ({
|
|
103
|
+
const sessionValue = useMemo(() => ({
|
|
104
|
+
session,
|
|
105
|
+
dispatch,
|
|
106
|
+
requestClose,
|
|
107
|
+
carriedFocus,
|
|
108
|
+
focusSaved,
|
|
109
|
+
trackSends,
|
|
110
|
+
}), [session, dispatch, requestClose, carriedFocus, focusSaved, trackSends]);
|
|
78
111
|
const drawn = drawnRange(session);
|
|
79
112
|
const gridDraft = drawn
|
|
80
113
|
? {
|
|
@@ -101,8 +134,14 @@ export function CalendarScreen({ isPhone, detail }) {
|
|
|
101
134
|
: zonedMoment(event.start, zone).date;
|
|
102
135
|
counts[day] = (counts[day] ?? 0) + 1;
|
|
103
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
|
+
}
|
|
104
143
|
return counts;
|
|
105
|
-
}, [events, shown]);
|
|
144
|
+
}, [events, tasks, shown]);
|
|
106
145
|
const timeGridDays = shown === "day"
|
|
107
146
|
? [date]
|
|
108
147
|
: shown === "week"
|
|
@@ -127,7 +166,7 @@ export function CalendarScreen({ isPhone, detail }) {
|
|
|
127
166
|
const weekNumber = shown === "week" || shown === "day"
|
|
128
167
|
? isoWeek(shown === "week" ? weekStart(date) : date)
|
|
129
168
|
: undefined;
|
|
130
|
-
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 })) : (_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 }));
|
|
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 }));
|
|
131
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"
|
|
132
171
|
? new Intl.DateTimeFormat(undefined, {
|
|
133
172
|
weekday: "short",
|
|
@@ -139,7 +178,7 @@ export function CalendarScreen({ isPhone, detail }) {
|
|
|
139
178
|
open: isPhone ? sidePane.navOpen : sidePane.open,
|
|
140
179
|
controls: CALENDAR_SIDE_PANE_ID,
|
|
141
180
|
onToggle: sidePane.toggle,
|
|
142
|
-
}, 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, 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
|
|
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
|
|
143
182
|
? "min-h-0 min-w-0 flex-1"
|
|
144
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" }) }))] }));
|
|
145
184
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { RemitImapCalendarSchedulingSend } from "@remit/api-http-client/types.gen.ts";
|
|
1
2
|
import { type Dispatch, type MutableRefObject } from "react";
|
|
2
3
|
import type { DraftSession, SessionAction } from "../../hooks/calendar/draft-session";
|
|
3
4
|
/**
|
|
@@ -14,6 +15,8 @@ export interface CalendarSessionValue {
|
|
|
14
15
|
carriedFocus: MutableRefObject<string>;
|
|
15
16
|
/** Focus the saved event once the grid draws it. */
|
|
16
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;
|
|
17
20
|
}
|
|
18
21
|
export declare const CalendarSessionContext: import("react").Context<CalendarSessionValue | null>;
|
|
19
22
|
export declare function useCalendarSession(): CalendarSessionValue;
|