@remit/ui 0.0.217 → 0.0.218
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/calendar-invite-card.render.test.ts +19 -0
- package/src/components/calendar-invite-card.stories.tsx +28 -2
- package/src/components/calendar-invite-card.tsx +11 -3
- package/src/components/calendar-types.ts +3 -1
- package/src/components/intelligence-panel-calendar.stories.tsx +27 -3
package/package.json
CHANGED
|
@@ -103,6 +103,25 @@ describe("CalendarInviteCard", () => {
|
|
|
103
103
|
assert.match(html, /Offer other times/);
|
|
104
104
|
});
|
|
105
105
|
|
|
106
|
+
it("offers Change on every answered card, dismissed included", () => {
|
|
107
|
+
for (const html of [
|
|
108
|
+
render({ rsvp: "accepted" }),
|
|
109
|
+
render({ rsvp: "tentative" }),
|
|
110
|
+
render({ rsvp: "declined" }),
|
|
111
|
+
render({ invite: { ...kickoffInvite, state: "dismissed" } }),
|
|
112
|
+
]) {
|
|
113
|
+
assert.match(html, />Change</);
|
|
114
|
+
assert.doesNotMatch(html, />Add to calendar</);
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
it("says a dismissed card was dismissed, and names no reply", () => {
|
|
119
|
+
const html = render({ invite: { ...kickoffInvite, state: "dismissed" } });
|
|
120
|
+
assert.match(html, /You dismissed this/);
|
|
121
|
+
assert.doesNotMatch(html, /On your calendar/);
|
|
122
|
+
assert.doesNotMatch(html, /No reply/);
|
|
123
|
+
});
|
|
124
|
+
|
|
106
125
|
it("gives a thumb targets it can hit", () => {
|
|
107
126
|
assert.match(render({ touch: true }), /min-h-11/);
|
|
108
127
|
assert.doesNotMatch(render(), /min-h-11/);
|
|
@@ -85,6 +85,20 @@ export const Declined: Story = {
|
|
|
85
85
|
args: { ...base, rsvp: "declined", clashes: [] },
|
|
86
86
|
};
|
|
87
87
|
|
|
88
|
+
/** Answered, then the organiser's cancellation was answered into the same event, so this one offers no Change. */
|
|
89
|
+
export const AnsweredThenCancelled: Story = {
|
|
90
|
+
args: { ...base, rsvp: "accepted", clashes: [], onReopen: undefined },
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
/** Dismissed without an answer. Change brings the answers back. */
|
|
94
|
+
export const Dismissed: Story = {
|
|
95
|
+
args: {
|
|
96
|
+
...base,
|
|
97
|
+
invite: { ...kickoffInvite, state: "dismissed" },
|
|
98
|
+
clashes: [],
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
|
|
88
102
|
/** A later message carried a higher SEQUENCE, so this one is not the question. */
|
|
89
103
|
export const OvertakenByANewerRevision: Story = {
|
|
90
104
|
args: { ...base, invite: superseded, onOpenNewer: () => undefined },
|
|
@@ -119,18 +133,30 @@ export const Touch: Story = {
|
|
|
119
133
|
args: { ...base, touch: true },
|
|
120
134
|
};
|
|
121
135
|
|
|
122
|
-
/**
|
|
136
|
+
/**
|
|
137
|
+
* The card answering for real, so the review is a click-through. Every answer,
|
|
138
|
+
* dismissing included, offers Change, which asks again.
|
|
139
|
+
*/
|
|
123
140
|
export const Answering: Story = {
|
|
124
141
|
render: () => {
|
|
125
142
|
const [rsvp, setRsvp] = useState<RsvpState>("noReply");
|
|
143
|
+
const [dismissed, setDismissed] = useState(false);
|
|
126
144
|
return (
|
|
127
145
|
<CalendarInviteCard
|
|
128
146
|
{...base}
|
|
147
|
+
invite={{
|
|
148
|
+
...kickoffInvite,
|
|
149
|
+
state: dismissed ? "dismissed" : "pending",
|
|
150
|
+
}}
|
|
129
151
|
rsvp={rsvp}
|
|
130
152
|
onAdd={() => setRsvp("accepted")}
|
|
131
153
|
onTentative={() => setRsvp("tentative")}
|
|
132
154
|
onDecline={() => setRsvp("declined")}
|
|
133
|
-
|
|
155
|
+
mute={{ sender: "Priya Natarajan", onMute: () => setDismissed(true) }}
|
|
156
|
+
onReopen={() => {
|
|
157
|
+
setRsvp("noReply");
|
|
158
|
+
setDismissed(false);
|
|
159
|
+
}}
|
|
134
160
|
/>
|
|
135
161
|
);
|
|
136
162
|
},
|
|
@@ -99,6 +99,14 @@ const tallyWord: Record<RsvpState, string> = {
|
|
|
99
99
|
noReply: "no reply",
|
|
100
100
|
};
|
|
101
101
|
|
|
102
|
+
const answeredText = (
|
|
103
|
+
state: CalendarInvite["state"],
|
|
104
|
+
rsvp: RsvpState,
|
|
105
|
+
): string => {
|
|
106
|
+
if (state === "dismissed") return "You dismissed this";
|
|
107
|
+
return rsvp === "declined" ? "You declined" : "On your calendar";
|
|
108
|
+
};
|
|
109
|
+
|
|
102
110
|
export function CalendarInviteCard({
|
|
103
111
|
invite,
|
|
104
112
|
whenText,
|
|
@@ -253,7 +261,7 @@ export function CalendarInviteCard({
|
|
|
253
261
|
)}
|
|
254
262
|
|
|
255
263
|
{!stale &&
|
|
256
|
-
(rsvp === "noReply" ? (
|
|
264
|
+
(rsvp === "noReply" && invite.state !== "dismissed" ? (
|
|
257
265
|
<div className="flex flex-col gap-2 border-t border-line pt-3">
|
|
258
266
|
<div className={cn("flex gap-2", touch && "flex-wrap")}>
|
|
259
267
|
<Button
|
|
@@ -317,8 +325,8 @@ export function CalendarInviteCard({
|
|
|
317
325
|
<div className="flex flex-col gap-2 border-t border-line pt-3">
|
|
318
326
|
<div className="flex flex-wrap items-center gap-3">
|
|
319
327
|
<span className="flex items-center gap-1.5 text-sm text-fg">
|
|
320
|
-
{rsvp
|
|
321
|
-
<RsvpBadge rsvp={rsvp} />
|
|
328
|
+
{answeredText(invite.state, rsvp)}
|
|
329
|
+
{invite.state !== "dismissed" && <RsvpBadge rsvp={rsvp} />}
|
|
322
330
|
</span>
|
|
323
331
|
{onReopen && (
|
|
324
332
|
<Button
|
|
@@ -194,11 +194,13 @@ export type CalendarParseMethod = "ics" | "markup" | "pattern";
|
|
|
194
194
|
* Where an invitation stands. `superseded` is a later message carrying a higher
|
|
195
195
|
* SEQUENCE for the same UID. `cancelled` is a METHOD:CANCEL that still needs
|
|
196
196
|
* the reader to act, because nothing leaves the calendar without a person
|
|
197
|
-
* saying so either.
|
|
197
|
+
* saying so either. `dismissed` was waved away without an answer, and can
|
|
198
|
+
* still be taken back.
|
|
198
199
|
*/
|
|
199
200
|
export type CalendarInviteState =
|
|
200
201
|
| "pending"
|
|
201
202
|
| "answered"
|
|
203
|
+
| "dismissed"
|
|
202
204
|
| "superseded"
|
|
203
205
|
| "cancelled";
|
|
204
206
|
|
|
@@ -68,6 +68,7 @@ function PanelDemo({
|
|
|
68
68
|
calendar.invite?.rsvp ?? "noReply",
|
|
69
69
|
);
|
|
70
70
|
const [removed, setRemoved] = useState(false);
|
|
71
|
+
const [dismissed, setDismissed] = useState(false);
|
|
71
72
|
const [offering, setOffering] = useState(calendar.prose !== undefined);
|
|
72
73
|
const [picked, setPicked] = useState<string[]>([]);
|
|
73
74
|
const [dropped, setDropped] = useState<string[]>([]);
|
|
@@ -85,7 +86,14 @@ function PanelDemo({
|
|
|
85
86
|
...calendar,
|
|
86
87
|
invite:
|
|
87
88
|
calendar.invite && !removed
|
|
88
|
-
? {
|
|
89
|
+
? {
|
|
90
|
+
...calendar.invite,
|
|
91
|
+
invite: dismissed
|
|
92
|
+
? { ...calendar.invite.invite, state: "dismissed" }
|
|
93
|
+
: calendar.invite.invite,
|
|
94
|
+
rsvp,
|
|
95
|
+
sender: sender.sender.name,
|
|
96
|
+
}
|
|
89
97
|
: undefined,
|
|
90
98
|
prose,
|
|
91
99
|
suggestions: calendar.suggestions.filter(
|
|
@@ -111,8 +119,11 @@ function PanelDemo({
|
|
|
111
119
|
onReopenInvite:
|
|
112
120
|
calendar.invite?.invite.state === "cancelled"
|
|
113
121
|
? () => setRemoved(true)
|
|
114
|
-
:
|
|
115
|
-
|
|
122
|
+
: () => {
|
|
123
|
+
setRsvp("noReply");
|
|
124
|
+
setDismissed(false);
|
|
125
|
+
},
|
|
126
|
+
onMuteInvite: () => setDismissed(true),
|
|
116
127
|
onOfferOtherTimes: () => setOffering(true),
|
|
117
128
|
onRemoveInvite: () => setRemoved(true),
|
|
118
129
|
onOpenNewerInvite:
|
|
@@ -320,6 +331,19 @@ export const Declined = rail(KICKOFF, organiserSender, {
|
|
|
320
331
|
},
|
|
321
332
|
});
|
|
322
333
|
|
|
334
|
+
/**
|
|
335
|
+
* Dismissed, or muted, without an answer. The card stays beside the message,
|
|
336
|
+
* and Change brings the answers back.
|
|
337
|
+
*/
|
|
338
|
+
export const Dismissed = rail(KICKOFF, organiserSender, {
|
|
339
|
+
...inviteWithClash,
|
|
340
|
+
invite: inviteWithClash.invite && {
|
|
341
|
+
...inviteWithClash.invite,
|
|
342
|
+
invite: { ...inviteWithClash.invite.invite, state: "dismissed" },
|
|
343
|
+
clashes: [],
|
|
344
|
+
},
|
|
345
|
+
});
|
|
346
|
+
|
|
323
347
|
/**
|
|
324
348
|
* Answered maybe. The event is on the calendar as tentative, and the organiser
|
|
325
349
|
* was not told.
|