@remit/ui 0.0.209 → 0.0.210
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
CHANGED
|
@@ -109,3 +109,24 @@ describe("CalendarList with a paused calendar", () => {
|
|
|
109
109
|
assert.match(renderPaused(["c1"]), /checked=""/);
|
|
110
110
|
});
|
|
111
111
|
});
|
|
112
|
+
|
|
113
|
+
describe("CalendarList with a subscription that could not be refreshed", () => {
|
|
114
|
+
it("states the reason under the row", () => {
|
|
115
|
+
const html = renderToString(
|
|
116
|
+
createElement(CalendarList, {
|
|
117
|
+
calendars: calendars.map((calendar) =>
|
|
118
|
+
calendar.id === "c3"
|
|
119
|
+
? { ...calendar, syncError: "the feed answered HTTP 404" }
|
|
120
|
+
: calendar,
|
|
121
|
+
),
|
|
122
|
+
visible: new Set(["c3"]),
|
|
123
|
+
onToggle: () => undefined,
|
|
124
|
+
}),
|
|
125
|
+
);
|
|
126
|
+
assert.match(html, /Not refreshed: the feed answered HTTP 404/);
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
it("says nothing for a calendar whose last refresh landed", () => {
|
|
130
|
+
assert.doesNotMatch(render(["c1"]), /Not refreshed/);
|
|
131
|
+
});
|
|
132
|
+
});
|
|
@@ -239,3 +239,40 @@ export const AsAStrip: Story = {
|
|
|
239
239
|
).toBeChecked();
|
|
240
240
|
},
|
|
241
241
|
};
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* A subscribed calendar whose feed stopped answering. Its stored events stay
|
|
245
|
+
* on the grid, and the reason sits under the row in words, because an icon
|
|
246
|
+
* alone reads as decoration.
|
|
247
|
+
*/
|
|
248
|
+
export const SubscriptionFailed: Story = {
|
|
249
|
+
render: () => {
|
|
250
|
+
const failing = calendars.map((calendar) =>
|
|
251
|
+
calendar.id === "c5"
|
|
252
|
+
? {
|
|
253
|
+
...calendar,
|
|
254
|
+
name: "Harbour rota",
|
|
255
|
+
readOnly: true,
|
|
256
|
+
syncError: "the feed answered HTTP 404",
|
|
257
|
+
}
|
|
258
|
+
: calendar,
|
|
259
|
+
);
|
|
260
|
+
return (
|
|
261
|
+
<CalendarList
|
|
262
|
+
calendars={failing}
|
|
263
|
+
visible={new Set(calendars.map((c) => c.id))}
|
|
264
|
+
onToggle={() => {}}
|
|
265
|
+
onToggleAccount={() => {}}
|
|
266
|
+
/>
|
|
267
|
+
);
|
|
268
|
+
},
|
|
269
|
+
play: async ({ canvasElement }) => {
|
|
270
|
+
const canvas = within(canvasElement);
|
|
271
|
+
await expect(
|
|
272
|
+
canvas.getByRole("checkbox", { name: "Harbour rota" }),
|
|
273
|
+
).toBeChecked();
|
|
274
|
+
await expect(
|
|
275
|
+
canvas.getByText("Not refreshed: the feed answered HTTP 404"),
|
|
276
|
+
).toBeVisible();
|
|
277
|
+
},
|
|
278
|
+
};
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
AlertTriangle,
|
|
3
|
+
Check,
|
|
4
|
+
ChevronDown,
|
|
5
|
+
ChevronRight,
|
|
6
|
+
PauseCircle,
|
|
7
|
+
} from "lucide-react";
|
|
2
8
|
import { useState } from "react";
|
|
3
9
|
import { calendarColorClasses } from "../lib/calendar-color.js";
|
|
4
10
|
import { cn } from "../lib/cn.js";
|
|
@@ -189,6 +195,7 @@ function CalendarListRow({
|
|
|
189
195
|
}) {
|
|
190
196
|
const hue = calendarColorClasses(calendar.color);
|
|
191
197
|
const paused = calendar.sync === "paused";
|
|
198
|
+
const syncError = calendar.syncError ?? "";
|
|
192
199
|
return (
|
|
193
200
|
<div className="flex flex-col">
|
|
194
201
|
<label
|
|
@@ -229,10 +236,21 @@ function CalendarListRow({
|
|
|
229
236
|
aria-hidden
|
|
230
237
|
/>
|
|
231
238
|
)}
|
|
239
|
+
{syncError !== "" && (
|
|
240
|
+
<AlertTriangle
|
|
241
|
+
className="size-3.5 shrink-0 text-danger"
|
|
242
|
+
aria-hidden
|
|
243
|
+
/>
|
|
244
|
+
)}
|
|
232
245
|
</label>
|
|
233
246
|
{paused && (
|
|
234
247
|
<span className="sr-only">{`${calendar.name}: ${ACCOUNT_SERVICE_OFF_LABEL.Calendar}`}</span>
|
|
235
248
|
)}
|
|
249
|
+
{syncError !== "" && (
|
|
250
|
+
<p className="px-row-inset pb-1 text-xs text-danger">
|
|
251
|
+
<span className="block pl-6.5">{`Not refreshed: ${syncError}`}</span>
|
|
252
|
+
</p>
|
|
253
|
+
)}
|
|
236
254
|
</div>
|
|
237
255
|
);
|
|
238
256
|
}
|
|
@@ -46,6 +46,10 @@ export interface CalendarDescriptor {
|
|
|
46
46
|
* Defaults to `live`.
|
|
47
47
|
*/
|
|
48
48
|
sync?: "live" | "paused";
|
|
49
|
+
/** A calendar filled from a subscribed feed, so nothing in it is edited here. */
|
|
50
|
+
readOnly?: boolean;
|
|
51
|
+
/** Why the calendar's feed could not be refreshed. Absent or `""` when it could. */
|
|
52
|
+
syncError?: string;
|
|
49
53
|
}
|
|
50
54
|
|
|
51
55
|
/**
|