@remit/ui 0.0.200 → 0.0.202
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/package.json +1 -1
- package/src/components/brief-sections.stories.tsx +41 -0
- package/src/components/calendar-failure-note.tsx +48 -0
- package/src/components/calendar-invite-card.render.test.ts +68 -0
- package/src/components/calendar-invite-card.tsx +97 -32
- package/src/components/event-suggestion-card.tsx +50 -26
- package/src/components/folder-mutation-dialog.render.test.ts +237 -0
- package/src/components/folder-mutation-dialog.stories.tsx +72 -0
- package/src/components/folder-mutation-dialog.tsx +111 -0
- package/src/components/intelligence-calendar.tsx +150 -19
- package/src/components/intelligence-panel-calendar.stories.tsx +109 -12
- package/src/index.ts +9 -0
|
@@ -54,6 +54,7 @@ function PanelDemo({
|
|
|
54
54
|
hideCloseButton,
|
|
55
55
|
touch,
|
|
56
56
|
className,
|
|
57
|
+
copyFails = false,
|
|
57
58
|
}: {
|
|
58
59
|
sender: IntelligenceData;
|
|
59
60
|
calendar: IntelligenceCalendarData;
|
|
@@ -61,6 +62,8 @@ function PanelDemo({
|
|
|
61
62
|
hideCloseButton?: boolean;
|
|
62
63
|
touch?: boolean;
|
|
63
64
|
className?: string;
|
|
65
|
+
/** The page cannot reach the clipboard, as on plain http. */
|
|
66
|
+
copyFails?: boolean;
|
|
64
67
|
}) {
|
|
65
68
|
const [tab, setTab] = useState<IntelligenceTabId>(initialTab);
|
|
66
69
|
const [rsvp, setRsvp] = useState<RsvpState>(
|
|
@@ -69,18 +72,28 @@ function PanelDemo({
|
|
|
69
72
|
const [removed, setRemoved] = useState(false);
|
|
70
73
|
const [offering, setOffering] = useState(calendar.prose !== undefined);
|
|
71
74
|
const [picked, setPicked] = useState<string[]>([]);
|
|
75
|
+
const [copy, setCopy] = useState<"idle" | "copied" | "failed">(
|
|
76
|
+
calendar.prose?.copy ?? "idle",
|
|
77
|
+
);
|
|
72
78
|
const [dropped, setDropped] = useState<string[]>([]);
|
|
73
79
|
const [selectedEventId, setSelectedEventId] = useState("");
|
|
74
80
|
const [lastAction, setLastAction] = useState("");
|
|
75
81
|
|
|
76
82
|
const prose = offering
|
|
77
|
-
? {
|
|
83
|
+
? {
|
|
84
|
+
...(calendar.prose ?? thursdayProse),
|
|
85
|
+
picked,
|
|
86
|
+
copy,
|
|
87
|
+
copyText: `${(calendar.prose ?? thursdayProse).dayLabel}: ${picked.join(", ")}`,
|
|
88
|
+
}
|
|
78
89
|
: undefined;
|
|
79
90
|
|
|
80
91
|
const data: IntelligenceCalendarData = {
|
|
81
92
|
...calendar,
|
|
82
93
|
invite:
|
|
83
|
-
calendar.invite && !removed
|
|
94
|
+
calendar.invite && !removed
|
|
95
|
+
? { ...calendar.invite, rsvp, sender: sender.sender.name }
|
|
96
|
+
: undefined,
|
|
84
97
|
prose,
|
|
85
98
|
suggestions: calendar.suggestions.filter(
|
|
86
99
|
(entry) => !dropped.includes(entry.suggestion.id),
|
|
@@ -97,19 +110,23 @@ function PanelDemo({
|
|
|
97
110
|
selectedEventId,
|
|
98
111
|
actions: {
|
|
99
112
|
onAddInvite: () => setRsvp("accepted"),
|
|
100
|
-
onTentativeInvite: () => setRsvp("tentative"),
|
|
101
113
|
onDeclineInvite: () => setRsvp("declined"),
|
|
102
|
-
onReopenInvite:
|
|
114
|
+
onReopenInvite:
|
|
115
|
+
calendar.invite?.invite.state === "cancelled"
|
|
116
|
+
? () => setRemoved(true)
|
|
117
|
+
: undefined,
|
|
118
|
+
onMuteInvite: () => setRemoved(true),
|
|
103
119
|
onOfferOtherTimes: () => setOffering(true),
|
|
104
120
|
onRemoveInvite: () => setRemoved(true),
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
onToggleSlot: (slot) =>
|
|
121
|
+
onToggleSlot: (slot) => {
|
|
122
|
+
setCopy("idle");
|
|
108
123
|
setPicked((prev) =>
|
|
109
124
|
prev.includes(slot.startTime)
|
|
110
125
|
? prev.filter((start) => start !== slot.startTime)
|
|
111
126
|
: [...prev, slot.startTime],
|
|
112
|
-
)
|
|
127
|
+
);
|
|
128
|
+
},
|
|
129
|
+
onCopySlots: () => setCopy(copyFails ? "failed" : "copied"),
|
|
113
130
|
onAddSuggestion: (id, timeZone) => {
|
|
114
131
|
setDropped((prev) => [...prev, id]);
|
|
115
132
|
setLastAction(
|
|
@@ -118,11 +135,7 @@ function PanelDemo({
|
|
|
118
135
|
: `added ${id} on ${timeZone}`,
|
|
119
136
|
);
|
|
120
137
|
},
|
|
121
|
-
onReviewSuggestion: (id) =>
|
|
122
|
-
setLastAction(`would open the editor on ${id}`),
|
|
123
138
|
onDismissSuggestion: (id) => setDropped((prev) => [...prev, id]),
|
|
124
|
-
onOpenThread: (threadId) =>
|
|
125
|
-
setLastAction(`would open thread ${threadId}`),
|
|
126
139
|
onSelectEvent: setSelectedEventId,
|
|
127
140
|
},
|
|
128
141
|
}}
|
|
@@ -206,6 +219,8 @@ function DrawerHost({
|
|
|
206
219
|
);
|
|
207
220
|
}
|
|
208
221
|
|
|
222
|
+
const REPORT = "https://github.com/remit-mail/reader/issues/new";
|
|
223
|
+
|
|
209
224
|
const KICKOFF = "Invitation: Billing migration kickoff — Thu 11 Jun, 14:00";
|
|
210
225
|
const THURSDAY = "Can we meet Thursday?";
|
|
211
226
|
const FLIGHT = "Your booking is confirmed — KL1693 Amsterdam to Lisbon";
|
|
@@ -216,6 +231,7 @@ function rail(
|
|
|
216
231
|
sender: IntelligenceData,
|
|
217
232
|
calendar: IntelligenceCalendarData,
|
|
218
233
|
initialTab: IntelligenceTabId = "calendar",
|
|
234
|
+
copyFails = false,
|
|
219
235
|
): Story {
|
|
220
236
|
return {
|
|
221
237
|
render: () => (
|
|
@@ -224,6 +240,7 @@ function rail(
|
|
|
224
240
|
sender={sender}
|
|
225
241
|
calendar={calendar}
|
|
226
242
|
initialTab={initialTab}
|
|
243
|
+
copyFails={copyFails}
|
|
227
244
|
className="h-full"
|
|
228
245
|
/>
|
|
229
246
|
</RailHost>
|
|
@@ -266,6 +283,86 @@ function drawer(
|
|
|
266
283
|
*/
|
|
267
284
|
export const InviteWithAClash = rail(KICKOFF, organiserSender, inviteWithClash);
|
|
268
285
|
|
|
286
|
+
/**
|
|
287
|
+
* An answer the server turned down. The card keeps its buttons and says why in
|
|
288
|
+
* the place the press happened, so a refusal never reads as a dead button.
|
|
289
|
+
*/
|
|
290
|
+
export const AnswerRefused = rail(KICKOFF, organiserSender, {
|
|
291
|
+
...inviteWithClash,
|
|
292
|
+
invite: inviteWithClash.invite && {
|
|
293
|
+
...inviteWithClash.invite,
|
|
294
|
+
failure:
|
|
295
|
+
"Couldn't add this to your calendar: the calendar it was going into is gone. Try again, or answer from your calendar app.",
|
|
296
|
+
reportHref: REPORT,
|
|
297
|
+
},
|
|
298
|
+
});
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* An answer on its way. The buttons wait for it rather than letting a second
|
|
302
|
+
* press send a second request.
|
|
303
|
+
*/
|
|
304
|
+
export const AnswerInFlight = rail(KICKOFF, organiserSender, {
|
|
305
|
+
...inviteWithClash,
|
|
306
|
+
invite: inviteWithClash.invite && { ...inviteWithClash.invite, busy: true },
|
|
307
|
+
});
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* Declined, and said so. Nothing was written to a calendar and nothing was
|
|
311
|
+
* sent to the organiser.
|
|
312
|
+
*/
|
|
313
|
+
export const Declined = rail(KICKOFF, organiserSender, {
|
|
314
|
+
...inviteWithClash,
|
|
315
|
+
invite: inviteWithClash.invite && {
|
|
316
|
+
...inviteWithClash.invite,
|
|
317
|
+
rsvp: "declined",
|
|
318
|
+
},
|
|
319
|
+
});
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* No calendar to write to yet. Adding waits for one, with the way to make it;
|
|
323
|
+
* declining and muting write nothing to a calendar and stay live.
|
|
324
|
+
*/
|
|
325
|
+
export const NoCalendarYet = rail(KICKOFF, organiserSender, {
|
|
326
|
+
...inviteWithClash,
|
|
327
|
+
invite: inviteWithClash.invite && {
|
|
328
|
+
...inviteWithClash.invite,
|
|
329
|
+
addBlocked: (
|
|
330
|
+
<>
|
|
331
|
+
You have no calendar yet, so there is nowhere to add this.{" "}
|
|
332
|
+
<a
|
|
333
|
+
href="#calendars"
|
|
334
|
+
className="font-medium text-accent hover:underline"
|
|
335
|
+
>
|
|
336
|
+
Create a calendar
|
|
337
|
+
</a>
|
|
338
|
+
</>
|
|
339
|
+
),
|
|
340
|
+
},
|
|
341
|
+
});
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* The invitations in this message could not be read. The tab says so, with the
|
|
345
|
+
* way to report it, rather than claiming the message says nothing about time.
|
|
346
|
+
*/
|
|
347
|
+
export const ReadFailure = rail(PLAIN, organiserSender, {
|
|
348
|
+
...nothingAboutTime,
|
|
349
|
+
failure:
|
|
350
|
+
"Couldn't read the invitations in this message. Reopen it to try again.",
|
|
351
|
+
reportHref: REPORT,
|
|
352
|
+
});
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* Picked times on a page that cannot reach the clipboard, as on plain http.
|
|
356
|
+
* The failure is stated and the times are there to select by hand.
|
|
357
|
+
*/
|
|
358
|
+
export const CopyFailed = rail(
|
|
359
|
+
THURSDAY,
|
|
360
|
+
organiserSender,
|
|
361
|
+
proseTimeThread,
|
|
362
|
+
"calendar",
|
|
363
|
+
true,
|
|
364
|
+
);
|
|
365
|
+
|
|
269
366
|
/**
|
|
270
367
|
* The same invitation an hour later. Nothing is booked over it, and the panel
|
|
271
368
|
* says that too — silence there would read as "not checked", which is the same
|
package/src/index.ts
CHANGED
|
@@ -191,6 +191,10 @@ export {
|
|
|
191
191
|
CalendarEventChipContent,
|
|
192
192
|
type CalendarEventChipContentProps,
|
|
193
193
|
} from "./components/calendar-event-chip-content.js";
|
|
194
|
+
export {
|
|
195
|
+
CalendarFailureNote,
|
|
196
|
+
type CalendarFailureNoteProps,
|
|
197
|
+
} from "./components/calendar-failure-note.js";
|
|
194
198
|
export {
|
|
195
199
|
CalendarGrid,
|
|
196
200
|
type CalendarGridProps,
|
|
@@ -456,6 +460,11 @@ export {
|
|
|
456
460
|
type FolderManagerProps,
|
|
457
461
|
type ManagedFolder,
|
|
458
462
|
} from "./components/folder-manager.js";
|
|
463
|
+
export {
|
|
464
|
+
FolderMutationDialog,
|
|
465
|
+
type FolderMutationDialogProps,
|
|
466
|
+
type FolderMutationPhase,
|
|
467
|
+
} from "./components/folder-mutation-dialog.js";
|
|
459
468
|
export {
|
|
460
469
|
FolderRenameDialog,
|
|
461
470
|
type FolderRenameDialogProps,
|