@remit/ui 0.0.200 → 0.0.201
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/intelligence-calendar.tsx +150 -19
- package/src/components/intelligence-panel-calendar.stories.tsx +109 -12
- package/src/index.ts +4 -0
package/package.json
CHANGED
|
@@ -324,6 +324,47 @@ export const Searching: Story = {
|
|
|
324
324
|
),
|
|
325
325
|
};
|
|
326
326
|
|
|
327
|
+
export const SearchingSenderFirst: Story = {
|
|
328
|
+
args: {
|
|
329
|
+
sections: [
|
|
330
|
+
{
|
|
331
|
+
id: "matches",
|
|
332
|
+
threads: [
|
|
333
|
+
{
|
|
334
|
+
id: "s1",
|
|
335
|
+
accountId: "a1",
|
|
336
|
+
fromName: "Penny Lane",
|
|
337
|
+
fromEmail: "penny@example.com",
|
|
338
|
+
subject: "Dinner on Friday?",
|
|
339
|
+
snippet: "I booked the place on the corner.",
|
|
340
|
+
timeLabel: "Mar 2",
|
|
341
|
+
isRead: true,
|
|
342
|
+
category: "personal",
|
|
343
|
+
},
|
|
344
|
+
{
|
|
345
|
+
id: "s2",
|
|
346
|
+
accountId: "a1",
|
|
347
|
+
fromName: "Sam Ortiz",
|
|
348
|
+
fromEmail: "sam@example.com",
|
|
349
|
+
subject: "Weekend plans",
|
|
350
|
+
snippet: "Penny said she can bring the tent.",
|
|
351
|
+
timeLabel: "9:14",
|
|
352
|
+
isRead: false,
|
|
353
|
+
category: "personal",
|
|
354
|
+
},
|
|
355
|
+
],
|
|
356
|
+
},
|
|
357
|
+
],
|
|
358
|
+
briefCategory: "all",
|
|
359
|
+
flat: true,
|
|
360
|
+
},
|
|
361
|
+
render: (args) => (
|
|
362
|
+
<div className="flex h-screen w-96 flex-col border-r border-line">
|
|
363
|
+
<BriefHost {...args} />
|
|
364
|
+
</div>
|
|
365
|
+
),
|
|
366
|
+
};
|
|
367
|
+
|
|
327
368
|
const accountSources: FilterSheetSource[] = [
|
|
328
369
|
{ id: "all", label: "All", active: true },
|
|
329
370
|
{ id: "a1", label: "work", count: 3 },
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { TriangleAlert } from "lucide-react";
|
|
2
|
+
import { cn } from "../lib/cn.js";
|
|
3
|
+
|
|
4
|
+
export interface CalendarFailureNoteProps {
|
|
5
|
+
/** What did not happen, and what to do about it. */
|
|
6
|
+
text: string;
|
|
7
|
+
/** A prefilled issue to file when retrying does not help. */
|
|
8
|
+
reportHref?: string;
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* An answer or a read that did not land, stated where it was asked for, with
|
|
14
|
+
* the way to report it when trying again does not help.
|
|
15
|
+
*/
|
|
16
|
+
export function CalendarFailureNote({
|
|
17
|
+
text,
|
|
18
|
+
reportHref,
|
|
19
|
+
className,
|
|
20
|
+
}: CalendarFailureNoteProps) {
|
|
21
|
+
return (
|
|
22
|
+
<div
|
|
23
|
+
role="alert"
|
|
24
|
+
className={cn(
|
|
25
|
+
"flex items-start gap-1.5 rounded-md border border-danger/40 bg-danger-soft p-2 text-xs text-danger",
|
|
26
|
+
className,
|
|
27
|
+
)}
|
|
28
|
+
>
|
|
29
|
+
<TriangleAlert className="mt-0.5 size-3.5 shrink-0" aria-hidden />
|
|
30
|
+
<p className="min-w-0 flex-1">
|
|
31
|
+
{text}
|
|
32
|
+
{reportHref && (
|
|
33
|
+
<>
|
|
34
|
+
{" "}
|
|
35
|
+
<a
|
|
36
|
+
href={reportHref}
|
|
37
|
+
target="_blank"
|
|
38
|
+
rel="noreferrer"
|
|
39
|
+
className="font-medium text-accent hover:underline"
|
|
40
|
+
>
|
|
41
|
+
Report an issue
|
|
42
|
+
</a>
|
|
43
|
+
</>
|
|
44
|
+
)}
|
|
45
|
+
</p>
|
|
46
|
+
</div>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
@@ -107,4 +107,72 @@ describe("CalendarInviteCard", () => {
|
|
|
107
107
|
assert.match(render({ touch: true }), /min-h-11/);
|
|
108
108
|
assert.doesNotMatch(render(), /min-h-11/);
|
|
109
109
|
});
|
|
110
|
+
|
|
111
|
+
it("leaves off the answers the host cannot store", () => {
|
|
112
|
+
const html = render({ onTentative: undefined, onReopen: undefined });
|
|
113
|
+
assert.doesNotMatch(html, />Maybe</);
|
|
114
|
+
assert.doesNotMatch(
|
|
115
|
+
render({ rsvp: "accepted", onReopen: undefined }),
|
|
116
|
+
/>Change</,
|
|
117
|
+
);
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
it("names the sender the mute rule matches, not the organiser", () => {
|
|
121
|
+
assert.doesNotMatch(render(), /Stop offering invitations/);
|
|
122
|
+
const html = render({
|
|
123
|
+
mute: { sender: "Alex Forwarder", onMute: () => undefined },
|
|
124
|
+
});
|
|
125
|
+
assert.match(html, /Stop offering invitations from Alex Forwarder/);
|
|
126
|
+
assert.doesNotMatch(html, /Stop offering invitations from Priya/);
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
it("states an answer that did not land, with the way to report it", () => {
|
|
130
|
+
const html = render({
|
|
131
|
+
failure: "The calendar refused it.",
|
|
132
|
+
reportHref: "https://example.invalid/issues/new",
|
|
133
|
+
});
|
|
134
|
+
assert.match(html, /role="alert"/);
|
|
135
|
+
assert.match(html, /The calendar refused it\./);
|
|
136
|
+
assert.match(html, /href="https:\/\/example\.invalid\/issues\/new"/);
|
|
137
|
+
assert.match(html, /Report an issue/);
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
it("holds only the answers that write, when there is no calendar to write to", () => {
|
|
141
|
+
const html = render({
|
|
142
|
+
addBlocked: "You have no calendar yet.",
|
|
143
|
+
mute: { sender: "Alex", onMute: () => undefined },
|
|
144
|
+
});
|
|
145
|
+
assert.match(html, /You have no calendar yet\./);
|
|
146
|
+
const before = (label: string) => {
|
|
147
|
+
const upTo = html.slice(0, html.indexOf(label));
|
|
148
|
+
return upTo.slice(upTo.lastIndexOf("<button"));
|
|
149
|
+
};
|
|
150
|
+
assert.match(before("Add to calendar"), /disabled=""/);
|
|
151
|
+
assert.doesNotMatch(before("Decline"), /disabled=""/);
|
|
152
|
+
assert.doesNotMatch(before("Stop offering"), /disabled=""/);
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
it("points at no control that is not there for a superseded one", () => {
|
|
156
|
+
const html = render({
|
|
157
|
+
invite: { ...kickoffInvite, state: "superseded", sequence: 1 },
|
|
158
|
+
});
|
|
159
|
+
assert.doesNotMatch(html, /Open the newer invitation/);
|
|
160
|
+
assert.doesNotMatch(html, /Answer the newer one/);
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
it("holds the answers while one is on its way", () => {
|
|
164
|
+
const html = render({ busy: true });
|
|
165
|
+
const accept = html.slice(0, html.indexOf("Add to calendar"));
|
|
166
|
+
assert.match(accept.slice(accept.lastIndexOf("<button")), /disabled=""/);
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
it("draws no guest tally when the invitation named nobody", () => {
|
|
170
|
+
const html = render({
|
|
171
|
+
invite: {
|
|
172
|
+
...kickoffInvite,
|
|
173
|
+
proposed: { ...kickoffInvite.proposed, attendees: [] },
|
|
174
|
+
},
|
|
175
|
+
});
|
|
176
|
+
assert.doesNotMatch(html, /guests/);
|
|
177
|
+
});
|
|
110
178
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
BellOff,
|
|
2
3
|
Calendar,
|
|
3
4
|
Check,
|
|
4
5
|
Clock,
|
|
@@ -13,6 +14,7 @@ import { cn } from "../lib/cn.js";
|
|
|
13
14
|
import { RsvpBadge } from "./attendee-row.js";
|
|
14
15
|
import { Button } from "./button.js";
|
|
15
16
|
import { CalendarClashStrip } from "./calendar-clash-strip.js";
|
|
17
|
+
import { CalendarFailureNote } from "./calendar-failure-note.js";
|
|
16
18
|
import { CalendarParseBadge } from "./calendar-parse-badge.js";
|
|
17
19
|
import type {
|
|
18
20
|
CalendarClash,
|
|
@@ -43,10 +45,22 @@ export interface CalendarInviteCardProps {
|
|
|
43
45
|
clashes: CalendarClash[];
|
|
44
46
|
rsvp: RsvpState;
|
|
45
47
|
onAdd: () => void;
|
|
46
|
-
|
|
48
|
+
/** Wired only where a tentative answer can be stored. */
|
|
49
|
+
onTentative?: () => void;
|
|
47
50
|
onDecline: () => void;
|
|
48
|
-
|
|
51
|
+
/**
|
|
52
|
+
* Takes an answer back, or keeps a cancelled event. Wired only where the
|
|
53
|
+
* store can undo the answer; an answer it cannot take back offers no Change.
|
|
54
|
+
*/
|
|
55
|
+
onReopen?: () => void;
|
|
49
56
|
onOfferOtherTimes: () => void;
|
|
57
|
+
/**
|
|
58
|
+
* Stops invitations arriving from the mail's sender being offered at all.
|
|
59
|
+
* The rule is written against the message's From, which is not always the
|
|
60
|
+
* organiser — a forwarded invitation names someone else — so the button
|
|
61
|
+
* names whoever the rule will match.
|
|
62
|
+
*/
|
|
63
|
+
mute?: { sender: string; onMute: () => void };
|
|
50
64
|
/** Wired only for a cancellation the reader has not acted on. */
|
|
51
65
|
onRemove?: () => void;
|
|
52
66
|
/** Wired only when a later message carries a higher SEQUENCE. */
|
|
@@ -56,6 +70,17 @@ export interface CalendarInviteCardProps {
|
|
|
56
70
|
* passes it here rather than the card growing a second one.
|
|
57
71
|
*/
|
|
58
72
|
guests?: ReactNode;
|
|
73
|
+
/** An answer is on its way to the server; the buttons wait for it. */
|
|
74
|
+
busy?: boolean;
|
|
75
|
+
/** Why the last answer did not land, in words the reader can act on. */
|
|
76
|
+
failure?: string;
|
|
77
|
+
/** A prefilled issue report for the failure above. */
|
|
78
|
+
reportHref?: string;
|
|
79
|
+
/**
|
|
80
|
+
* Why nothing can be written to a calendar yet, and the way to fix it. Set,
|
|
81
|
+
* it holds Add and Remove; the answers that write nothing stay live.
|
|
82
|
+
*/
|
|
83
|
+
addBlocked?: ReactNode;
|
|
59
84
|
touch?: boolean;
|
|
60
85
|
className?: string;
|
|
61
86
|
}
|
|
@@ -86,9 +111,14 @@ export function CalendarInviteCard({
|
|
|
86
111
|
onDecline,
|
|
87
112
|
onReopen,
|
|
88
113
|
onOfferOtherTimes,
|
|
114
|
+
mute,
|
|
89
115
|
onRemove,
|
|
90
116
|
onOpenNewer,
|
|
91
117
|
guests,
|
|
118
|
+
busy = false,
|
|
119
|
+
failure = "",
|
|
120
|
+
reportHref,
|
|
121
|
+
addBlocked,
|
|
92
122
|
touch,
|
|
93
123
|
className,
|
|
94
124
|
}: CalendarInviteCardProps) {
|
|
@@ -146,8 +176,8 @@ export function CalendarInviteCard({
|
|
|
146
176
|
{invite.organizerName} has sent a newer version of this.
|
|
147
177
|
</p>
|
|
148
178
|
<p className="mt-1 text-xs text-fg">
|
|
149
|
-
This one is revision {invite.sequence} and is out of date.
|
|
150
|
-
the
|
|
179
|
+
This one is revision {invite.sequence} and is out of date. The
|
|
180
|
+
newer message carries the one to answer.
|
|
151
181
|
</p>
|
|
152
182
|
{onOpenNewer && (
|
|
153
183
|
<Button
|
|
@@ -181,18 +211,22 @@ export function CalendarInviteCard({
|
|
|
181
211
|
size={touch ? "md" : "sm"}
|
|
182
212
|
icon={<Trash2 className="size-3.5" />}
|
|
183
213
|
onClick={onRemove}
|
|
214
|
+
disabled={busy || addBlocked !== undefined}
|
|
184
215
|
className={cn(touch && "min-h-11 flex-1")}
|
|
185
216
|
>
|
|
186
217
|
Remove from calendar
|
|
187
218
|
</Button>
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
219
|
+
{onReopen && (
|
|
220
|
+
<Button
|
|
221
|
+
variant="secondary"
|
|
222
|
+
size={touch ? "md" : "sm"}
|
|
223
|
+
onClick={onReopen}
|
|
224
|
+
disabled={busy}
|
|
225
|
+
className={cn(touch && "min-h-11 flex-1")}
|
|
226
|
+
>
|
|
227
|
+
Keep it
|
|
228
|
+
</Button>
|
|
229
|
+
)}
|
|
196
230
|
</div>
|
|
197
231
|
)}
|
|
198
232
|
</div>
|
|
@@ -201,10 +235,21 @@ export function CalendarInviteCard({
|
|
|
201
235
|
|
|
202
236
|
{!stale && <CalendarClashStrip clashes={clashes} />}
|
|
203
237
|
|
|
204
|
-
{guests ??
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
238
|
+
{guests ??
|
|
239
|
+
(attendees.length > 0 && (
|
|
240
|
+
<p className="text-2xs uppercase tracking-wider text-fg-subtle">
|
|
241
|
+
{attendees.length} guests{tally === "" ? "" : ` · ${tally}`}
|
|
242
|
+
</p>
|
|
243
|
+
))}
|
|
244
|
+
|
|
245
|
+
{failure !== "" && (
|
|
246
|
+
<CalendarFailureNote text={failure} reportHref={reportHref} />
|
|
247
|
+
)}
|
|
248
|
+
|
|
249
|
+
{addBlocked !== undefined && (
|
|
250
|
+
<div className="rounded-md border border-warning/40 bg-warning-soft p-2 text-xs text-fg">
|
|
251
|
+
{addBlocked}
|
|
252
|
+
</div>
|
|
208
253
|
)}
|
|
209
254
|
|
|
210
255
|
{!stale &&
|
|
@@ -216,23 +261,28 @@ export function CalendarInviteCard({
|
|
|
216
261
|
size={touch ? "md" : "sm"}
|
|
217
262
|
icon={<Calendar className="size-3.5" />}
|
|
218
263
|
onClick={onAdd}
|
|
264
|
+
disabled={busy || addBlocked !== undefined}
|
|
219
265
|
className={cn(touch && "min-h-11 flex-1")}
|
|
220
266
|
>
|
|
221
267
|
Add to calendar
|
|
222
268
|
</Button>
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
269
|
+
{onTentative && (
|
|
270
|
+
<Button
|
|
271
|
+
variant="secondary"
|
|
272
|
+
size={touch ? "md" : "sm"}
|
|
273
|
+
onClick={onTentative}
|
|
274
|
+
disabled={busy}
|
|
275
|
+
className={cn(touch && "min-h-11 flex-1")}
|
|
276
|
+
>
|
|
277
|
+
Maybe
|
|
278
|
+
</Button>
|
|
279
|
+
)}
|
|
231
280
|
<Button
|
|
232
281
|
variant="secondary"
|
|
233
282
|
size={touch ? "md" : "sm"}
|
|
234
283
|
icon={<X className="size-3.5" />}
|
|
235
284
|
onClick={onDecline}
|
|
285
|
+
disabled={busy}
|
|
236
286
|
className={cn(touch && "min-h-11 flex-1")}
|
|
237
287
|
>
|
|
238
288
|
Decline
|
|
@@ -246,6 +296,18 @@ export function CalendarInviteCard({
|
|
|
246
296
|
>
|
|
247
297
|
Offer other times
|
|
248
298
|
</Button>
|
|
299
|
+
{mute && (
|
|
300
|
+
<Button
|
|
301
|
+
variant="ghost"
|
|
302
|
+
size={touch ? "md" : "sm"}
|
|
303
|
+
icon={<BellOff className="size-3.5" />}
|
|
304
|
+
onClick={mute.onMute}
|
|
305
|
+
disabled={busy}
|
|
306
|
+
className={cn("self-start", touch && "min-h-11 w-full")}
|
|
307
|
+
>
|
|
308
|
+
{`Stop offering invitations from ${mute.sender}`}
|
|
309
|
+
</Button>
|
|
310
|
+
)}
|
|
249
311
|
<p className="text-2xs text-fg-subtle">
|
|
250
312
|
{invite.organizerName} is not notified. Reader writes this to your
|
|
251
313
|
calendar and sends no reply — tell them in the thread.
|
|
@@ -258,14 +320,17 @@ export function CalendarInviteCard({
|
|
|
258
320
|
{rsvp === "declined" ? "You declined" : "On your calendar"}
|
|
259
321
|
<RsvpBadge rsvp={rsvp} />
|
|
260
322
|
</span>
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
323
|
+
{onReopen && (
|
|
324
|
+
<Button
|
|
325
|
+
variant="ghost"
|
|
326
|
+
size={touch ? "md" : "sm"}
|
|
327
|
+
onClick={onReopen}
|
|
328
|
+
disabled={busy}
|
|
329
|
+
className={touch ? "min-h-11" : ""}
|
|
330
|
+
>
|
|
331
|
+
Change
|
|
332
|
+
</Button>
|
|
333
|
+
)}
|
|
269
334
|
{rsvp === "declined" && (
|
|
270
335
|
<Button
|
|
271
336
|
variant="secondary"
|
|
@@ -54,11 +54,17 @@ export interface EventSuggestionCardProps {
|
|
|
54
54
|
* Correcting the reading first. It is handed the same settled zone Add is,
|
|
55
55
|
* and is refused on the same terms — an editor opened on an hour nobody has
|
|
56
56
|
* placed on a clock seeds the draft with the wrong time, which is the
|
|
57
|
-
* mistake Add is dimmed to prevent.
|
|
57
|
+
* mistake Add is dimmed to prevent. Wired only where an editor can take the
|
|
58
|
+
* reading; without it the card offers Add and Dismiss alone.
|
|
58
59
|
*/
|
|
59
|
-
onReview
|
|
60
|
+
onReview?: (timeZone: string) => void;
|
|
60
61
|
onDismiss: () => void;
|
|
61
|
-
|
|
62
|
+
/** Wired only where the mail is somewhere else; beside it, it is plain text. */
|
|
63
|
+
onOpenThread?: () => void;
|
|
64
|
+
/** An answer is on its way to the server; the buttons wait for it. */
|
|
65
|
+
busy?: boolean;
|
|
66
|
+
/** Nothing can be added yet; the host says why beside the card. */
|
|
67
|
+
addBlocked?: boolean;
|
|
62
68
|
/** The clock picked so far. Omit to let the card hold the choice itself. */
|
|
63
69
|
zoneChoice?: string;
|
|
64
70
|
onZoneChoice?: (timeZone: string) => void;
|
|
@@ -72,6 +78,12 @@ export interface EventSuggestionCardProps {
|
|
|
72
78
|
className?: string;
|
|
73
79
|
}
|
|
74
80
|
|
|
81
|
+
function mailLine(suggestion: EventSuggestion): string {
|
|
82
|
+
return suggestion.threadSubject === ""
|
|
83
|
+
? suggestion.sender
|
|
84
|
+
: `${suggestion.sender} — ${suggestion.threadSubject}`;
|
|
85
|
+
}
|
|
86
|
+
|
|
75
87
|
/** Words for a number, so the card never shows a false 87%. */
|
|
76
88
|
function confidenceText(confidence: number): string {
|
|
77
89
|
if (confidence >= 0.85) return "Read cleanly";
|
|
@@ -97,6 +109,8 @@ export function EventSuggestionCard({
|
|
|
97
109
|
onReview,
|
|
98
110
|
onDismiss,
|
|
99
111
|
onOpenThread,
|
|
112
|
+
busy = false,
|
|
113
|
+
addBlocked = false,
|
|
100
114
|
zoneChoice,
|
|
101
115
|
onZoneChoice,
|
|
102
116
|
addLabel = "Add",
|
|
@@ -148,6 +162,7 @@ export function EventSuggestionCard({
|
|
|
148
162
|
type="button"
|
|
149
163
|
aria-label="Dismiss suggestion"
|
|
150
164
|
onClick={onDismiss}
|
|
165
|
+
disabled={busy}
|
|
151
166
|
className={cn(
|
|
152
167
|
"flex shrink-0 items-center justify-center rounded-md text-fg-subtle outline-none hover:bg-surface hover:text-fg focus-visible:ring-2 focus-visible:ring-ring",
|
|
153
168
|
touch ? "size-11" : "size-7",
|
|
@@ -164,16 +179,21 @@ export function EventSuggestionCard({
|
|
|
164
179
|
</p>
|
|
165
180
|
)}
|
|
166
181
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
</
|
|
176
|
-
|
|
182
|
+
{onOpenThread ? (
|
|
183
|
+
<button
|
|
184
|
+
type="button"
|
|
185
|
+
onClick={onOpenThread}
|
|
186
|
+
className="flex w-full min-w-0 items-center gap-1.5 rounded-sm text-left text-2xs text-accent-2 outline-none hover:underline focus-visible:ring-2 focus-visible:ring-ring"
|
|
187
|
+
>
|
|
188
|
+
<Mail className="size-3 shrink-0" />
|
|
189
|
+
<span className="truncate">{mailLine(suggestion)}</span>
|
|
190
|
+
</button>
|
|
191
|
+
) : (
|
|
192
|
+
<p className="flex w-full min-w-0 items-center gap-1.5 text-2xs text-fg-subtle">
|
|
193
|
+
<Mail className="size-3 shrink-0" />
|
|
194
|
+
<span className="truncate">{mailLine(suggestion)}</span>
|
|
195
|
+
</p>
|
|
196
|
+
)}
|
|
177
197
|
|
|
178
198
|
{suggestion.zoneOptions && (
|
|
179
199
|
<div className="flex flex-col gap-1.5 rounded-md border border-warning/40 p-2">
|
|
@@ -221,6 +241,7 @@ export function EventSuggestionCard({
|
|
|
221
241
|
size={touch ? "md" : "sm"}
|
|
222
242
|
icon={<Plus className="size-3.5" />}
|
|
223
243
|
onClick={carryingTheZone(onAdd)}
|
|
244
|
+
disabled={busy || addBlocked}
|
|
224
245
|
aria-describedby={settlement.settled ? undefined : reasonId}
|
|
225
246
|
className={cn(
|
|
226
247
|
touch && "min-h-11 flex-1",
|
|
@@ -229,19 +250,22 @@ export function EventSuggestionCard({
|
|
|
229
250
|
>
|
|
230
251
|
{addLabel}
|
|
231
252
|
</Button>
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
253
|
+
{onReview && (
|
|
254
|
+
<Button
|
|
255
|
+
variant="secondary"
|
|
256
|
+
size={touch ? "md" : "sm"}
|
|
257
|
+
icon={<SlidersHorizontal className="size-3.5" />}
|
|
258
|
+
onClick={carryingTheZone(onReview)}
|
|
259
|
+
disabled={busy}
|
|
260
|
+
aria-describedby={settlement.settled ? undefined : reasonId}
|
|
261
|
+
className={cn(
|
|
262
|
+
touch && "min-h-11",
|
|
263
|
+
!settlement.settled && "opacity-55",
|
|
264
|
+
)}
|
|
265
|
+
>
|
|
266
|
+
Change first
|
|
267
|
+
</Button>
|
|
268
|
+
)}
|
|
245
269
|
</div>
|
|
246
270
|
</article>
|
|
247
271
|
);
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { CalendarDays } from "lucide-react";
|
|
2
|
-
import { useState } from "react";
|
|
1
|
+
import { CalendarDays, Copy } from "lucide-react";
|
|
2
|
+
import { type ReactNode, useState } from "react";
|
|
3
3
|
import { cn } from "../lib/cn.js";
|
|
4
|
+
import { Button } from "./button.js";
|
|
4
5
|
import { CalendarEventChip } from "./calendar-event-chip.js";
|
|
6
|
+
import { CalendarFailureNote } from "./calendar-failure-note.js";
|
|
5
7
|
import { CalendarInviteCard } from "./calendar-invite-card.js";
|
|
6
8
|
import { CalendarSlotOffers } from "./calendar-slot-offers.js";
|
|
7
9
|
import { CalendarSuggestionDeck } from "./calendar-suggestion-deck.js";
|
|
@@ -43,6 +45,18 @@ export interface CalendarInviteIntel {
|
|
|
43
45
|
color: CalendarColorId;
|
|
44
46
|
clashes: CalendarClash[];
|
|
45
47
|
rsvp: RsvpState;
|
|
48
|
+
/** An answer is on its way to the server. */
|
|
49
|
+
busy?: boolean;
|
|
50
|
+
/** Why the last answer did not land. Empty when it did. */
|
|
51
|
+
failure?: string;
|
|
52
|
+
reportHref?: string;
|
|
53
|
+
/** Why nothing can be written to a calendar yet; holds Add and Remove. */
|
|
54
|
+
addBlocked?: ReactNode;
|
|
55
|
+
/**
|
|
56
|
+
* Who the mail came from, which is who muting stops — not always the
|
|
57
|
+
* organiser. Without it the card offers no mute.
|
|
58
|
+
*/
|
|
59
|
+
sender?: string;
|
|
46
60
|
}
|
|
47
61
|
|
|
48
62
|
/** One reading off this thread that is not the invitation. */
|
|
@@ -68,6 +82,10 @@ export interface CalendarProseIntel {
|
|
|
68
82
|
slots: CalendarSlotPick[];
|
|
69
83
|
/** Start clocks already ticked into the reply. */
|
|
70
84
|
picked: readonly string[];
|
|
85
|
+
/** What became of the last copy of the picked times. */
|
|
86
|
+
copy?: "idle" | "copied" | "failed";
|
|
87
|
+
/** The picked times as text, offered to select by hand when copying failed. */
|
|
88
|
+
copyText?: string;
|
|
71
89
|
}
|
|
72
90
|
|
|
73
91
|
export interface IntelligenceCalendarData {
|
|
@@ -79,21 +97,37 @@ export interface IntelligenceCalendarData {
|
|
|
79
97
|
day: CalendarDayEntry[];
|
|
80
98
|
/** The day those entries sit on, in words. */
|
|
81
99
|
dayLabel: string;
|
|
100
|
+
/** An answer to the top reading is on its way to the server. */
|
|
101
|
+
suggestionsBusy?: boolean;
|
|
102
|
+
/** What the tab could not read. Empty when it read everything. */
|
|
103
|
+
failure?: string;
|
|
104
|
+
/** Why the last answer to a reading did not land, stated beside the deck. */
|
|
105
|
+
suggestionsFailure?: string;
|
|
106
|
+
/** A prefilled issue report for either failure above. */
|
|
107
|
+
reportHref?: string;
|
|
108
|
+
/** Why no reading can be added yet; holds the deck's Add. */
|
|
109
|
+
addBlocked?: ReactNode;
|
|
82
110
|
}
|
|
83
111
|
|
|
112
|
+
/**
|
|
113
|
+
* What the tab can do. An optional action is one a host may have no way to
|
|
114
|
+
* carry out, and the control behind it is left off rather than drawn dead.
|
|
115
|
+
*/
|
|
84
116
|
export interface IntelligenceCalendarActions {
|
|
85
117
|
onAddInvite: () => void;
|
|
86
|
-
onTentativeInvite
|
|
118
|
+
onTentativeInvite?: () => void;
|
|
87
119
|
onDeclineInvite: () => void;
|
|
88
|
-
onReopenInvite
|
|
120
|
+
onReopenInvite?: () => void;
|
|
121
|
+
onMuteInvite?: () => void;
|
|
89
122
|
onOfferOtherTimes: () => void;
|
|
90
|
-
onRemoveInvite
|
|
91
|
-
onOpenNewerInvite
|
|
123
|
+
onRemoveInvite?: () => void;
|
|
124
|
+
onOpenNewerInvite?: () => void;
|
|
92
125
|
onToggleSlot: (slot: CalendarSlotPick) => void;
|
|
126
|
+
onCopySlots?: () => void;
|
|
93
127
|
onAddSuggestion: (suggestionId: string, timeZone: string) => void;
|
|
94
|
-
onReviewSuggestion
|
|
128
|
+
onReviewSuggestion?: (suggestionId: string, timeZone: string) => void;
|
|
95
129
|
onDismissSuggestion: (suggestionId: string) => void;
|
|
96
|
-
onOpenThread
|
|
130
|
+
onOpenThread?: (threadId: string) => void;
|
|
97
131
|
onSelectEvent: (eventId: string) => void;
|
|
98
132
|
}
|
|
99
133
|
|
|
@@ -113,7 +147,19 @@ export function IntelligenceCalendar({
|
|
|
113
147
|
touch,
|
|
114
148
|
className,
|
|
115
149
|
}: IntelligenceCalendarProps) {
|
|
116
|
-
const {
|
|
150
|
+
const {
|
|
151
|
+
invite,
|
|
152
|
+
prose,
|
|
153
|
+
suggestions,
|
|
154
|
+
day,
|
|
155
|
+
dayLabel,
|
|
156
|
+
suggestionsBusy = false,
|
|
157
|
+
failure = "",
|
|
158
|
+
suggestionsFailure = "",
|
|
159
|
+
reportHref,
|
|
160
|
+
addBlocked,
|
|
161
|
+
} = data;
|
|
162
|
+
const { onReviewSuggestion, onOpenThread } = actions;
|
|
117
163
|
const [zoneChoices, setZoneChoices] = useState<Record<string, string>>({});
|
|
118
164
|
const top = suggestions[0];
|
|
119
165
|
const topChoice =
|
|
@@ -122,6 +168,7 @@ export function IntelligenceCalendar({
|
|
|
122
168
|
top === undefined ? undefined : settleZone(top.suggestion, topChoice);
|
|
123
169
|
const picked = new Set(prose?.picked ?? []);
|
|
124
170
|
const nothingToSay =
|
|
171
|
+
failure === "" &&
|
|
125
172
|
invite === undefined &&
|
|
126
173
|
prose === undefined &&
|
|
127
174
|
suggestions.length === 0 &&
|
|
@@ -148,6 +195,14 @@ export function IntelligenceCalendar({
|
|
|
148
195
|
|
|
149
196
|
return (
|
|
150
197
|
<div className={cn("flex flex-col", className)}>
|
|
198
|
+
{failure !== "" && (
|
|
199
|
+
<CalendarFailureNote
|
|
200
|
+
text={failure}
|
|
201
|
+
reportHref={reportHref}
|
|
202
|
+
className="mx-row-inset mt-3"
|
|
203
|
+
/>
|
|
204
|
+
)}
|
|
205
|
+
|
|
151
206
|
{invite && (
|
|
152
207
|
<IntelligenceSection label="Invitation">
|
|
153
208
|
<CalendarInviteCard
|
|
@@ -157,6 +212,15 @@ export function IntelligenceCalendar({
|
|
|
157
212
|
color={invite.color}
|
|
158
213
|
clashes={invite.clashes}
|
|
159
214
|
rsvp={invite.rsvp}
|
|
215
|
+
busy={invite.busy}
|
|
216
|
+
failure={invite.failure}
|
|
217
|
+
reportHref={invite.reportHref}
|
|
218
|
+
addBlocked={invite.addBlocked}
|
|
219
|
+
mute={
|
|
220
|
+
actions.onMuteInvite && invite.sender
|
|
221
|
+
? { sender: invite.sender, onMute: actions.onMuteInvite }
|
|
222
|
+
: undefined
|
|
223
|
+
}
|
|
160
224
|
onAdd={actions.onAddInvite}
|
|
161
225
|
onTentative={actions.onTentativeInvite}
|
|
162
226
|
onDecline={actions.onDeclineInvite}
|
|
@@ -170,8 +234,19 @@ export function IntelligenceCalendar({
|
|
|
170
234
|
)}
|
|
171
235
|
|
|
172
236
|
{prose && (
|
|
173
|
-
<IntelligenceSection
|
|
174
|
-
|
|
237
|
+
<IntelligenceSection
|
|
238
|
+
label={
|
|
239
|
+
prose.proposals.length > 0
|
|
240
|
+
? `Times named · ${prose.dayLabel}`
|
|
241
|
+
: `Other times · ${prose.dayLabel}`
|
|
242
|
+
}
|
|
243
|
+
>
|
|
244
|
+
<ul
|
|
245
|
+
className={cn(
|
|
246
|
+
"flex flex-col gap-1",
|
|
247
|
+
prose.proposals.length === 0 && "hidden",
|
|
248
|
+
)}
|
|
249
|
+
>
|
|
175
250
|
{prose.proposals.map((proposal) => (
|
|
176
251
|
<li
|
|
177
252
|
key={proposal.id}
|
|
@@ -202,9 +277,48 @@ export function IntelligenceCalendar({
|
|
|
202
277
|
touch={touch}
|
|
203
278
|
scroll
|
|
204
279
|
/>
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
280
|
+
{actions.onCopySlots ? (
|
|
281
|
+
<div className="mt-2 flex flex-col gap-1.5">
|
|
282
|
+
<Button
|
|
283
|
+
variant="secondary"
|
|
284
|
+
size={touch ? "md" : "sm"}
|
|
285
|
+
icon={<Copy className="size-3.5" />}
|
|
286
|
+
onClick={actions.onCopySlots}
|
|
287
|
+
disabled={picked.size === 0}
|
|
288
|
+
className={cn("self-start", touch && "min-h-11")}
|
|
289
|
+
>
|
|
290
|
+
Copy picked times
|
|
291
|
+
</Button>
|
|
292
|
+
{prose.copy === "copied" && (
|
|
293
|
+
<p role="status" className="text-2xs text-positive">
|
|
294
|
+
Copied. Paste them into your reply.
|
|
295
|
+
</p>
|
|
296
|
+
)}
|
|
297
|
+
{prose.copy === "failed" && (
|
|
298
|
+
<div role="alert" className="flex flex-col gap-1">
|
|
299
|
+
<p className="text-2xs text-danger">
|
|
300
|
+
This page can't copy for you. Select the times below and
|
|
301
|
+
copy them yourself.
|
|
302
|
+
</p>
|
|
303
|
+
<textarea
|
|
304
|
+
readOnly
|
|
305
|
+
aria-label="Picked times"
|
|
306
|
+
value={prose.copyText ?? ""}
|
|
307
|
+
onFocus={(event) => event.currentTarget.select()}
|
|
308
|
+
rows={2}
|
|
309
|
+
className="w-full resize-none rounded-md border border-line bg-surface p-1.5 text-xs text-fg"
|
|
310
|
+
/>
|
|
311
|
+
</div>
|
|
312
|
+
)}
|
|
313
|
+
<p className="text-2xs text-fg-subtle">
|
|
314
|
+
Picked slots are copied as plain text. Nothing is booked.
|
|
315
|
+
</p>
|
|
316
|
+
</div>
|
|
317
|
+
) : (
|
|
318
|
+
<p className="mt-1.5 text-2xs text-fg-subtle">
|
|
319
|
+
Picked slots go into the reply as plain text. Nothing is booked.
|
|
320
|
+
</p>
|
|
321
|
+
)}
|
|
208
322
|
</IntelligenceSection>
|
|
209
323
|
)}
|
|
210
324
|
|
|
@@ -216,7 +330,7 @@ export function IntelligenceCalendar({
|
|
|
216
330
|
blocked={topSettlement !== undefined && !topSettlement.settled}
|
|
217
331
|
blockedReason={ZONE_UNSETTLED_REASON}
|
|
218
332
|
onConfirm={() => {
|
|
219
|
-
if (top && topSettlement?.settled)
|
|
333
|
+
if (top && topSettlement?.settled && addBlocked === undefined)
|
|
220
334
|
actions.onAddSuggestion(
|
|
221
335
|
top.suggestion.id,
|
|
222
336
|
topSettlement.timeZone,
|
|
@@ -241,17 +355,34 @@ export function IntelligenceCalendar({
|
|
|
241
355
|
onAdd={(timeZone) =>
|
|
242
356
|
actions.onAddSuggestion(top.suggestion.id, timeZone)
|
|
243
357
|
}
|
|
244
|
-
onReview={
|
|
245
|
-
|
|
358
|
+
onReview={
|
|
359
|
+
onReviewSuggestion &&
|
|
360
|
+
((timeZone) =>
|
|
361
|
+
onReviewSuggestion(top.suggestion.id, timeZone))
|
|
246
362
|
}
|
|
247
363
|
onDismiss={() => actions.onDismissSuggestion(top.suggestion.id)}
|
|
248
|
-
onOpenThread={
|
|
249
|
-
|
|
364
|
+
onOpenThread={
|
|
365
|
+
onOpenThread && (() => onOpenThread(top.suggestion.threadId))
|
|
250
366
|
}
|
|
367
|
+
busy={suggestionsBusy}
|
|
368
|
+
addBlocked={addBlocked !== undefined}
|
|
251
369
|
touch={touch}
|
|
252
370
|
/>
|
|
253
371
|
)}
|
|
254
372
|
</CalendarSuggestionDeck>
|
|
373
|
+
{addBlocked !== undefined && (
|
|
374
|
+
<div className="mt-2 rounded-md border border-warning/40 bg-warning-soft p-2 text-xs text-fg">
|
|
375
|
+
{addBlocked}
|
|
376
|
+
</div>
|
|
377
|
+
)}
|
|
378
|
+
{suggestionsFailure !== "" && (
|
|
379
|
+
<CalendarFailureNote
|
|
380
|
+
text={suggestionsFailure}
|
|
381
|
+
reportHref={reportHref}
|
|
382
|
+
className="mt-2"
|
|
383
|
+
/>
|
|
384
|
+
)}
|
|
385
|
+
|
|
255
386
|
<p className="mt-2 text-2xs text-fg-subtle">
|
|
256
387
|
None of this is on your calendar, and none of it will be until you
|
|
257
388
|
say so.
|
|
@@ -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,
|