@remit/ui 0.0.157 → 0.0.158

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remit/ui",
3
- "version": "0.0.157",
3
+ "version": "0.0.158",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src"
@@ -124,3 +124,34 @@ describe("EventDetail", () => {
124
124
  assert.match(html, /Recent mail · Priya Natarajan/);
125
125
  });
126
126
  });
127
+
128
+ /**
129
+ * A host that cannot write yet — the calendar before its API lands — passes
130
+ * neither action. A button that leads nowhere is worse than no button, so the
131
+ * header has to come back without them rather than with two that do nothing.
132
+ */
133
+ describe("EventDetail with nowhere to write", () => {
134
+ const readOnly = renderToString(
135
+ createElement(EventDetail, {
136
+ event,
137
+ calendar,
138
+ whenText: "Wednesday 10 June · 10:00 – 11:30",
139
+ onClose: () => undefined,
140
+ }),
141
+ );
142
+
143
+ it("offers neither Edit nor Delete", () => {
144
+ assert.doesNotMatch(readOnly, />Edit</);
145
+ assert.doesNotMatch(readOnly, />Delete</);
146
+ });
147
+
148
+ it("still names the event, its calendar and when it is", () => {
149
+ assert.match(readOnly, /Q3 roadmap review/);
150
+ assert.match(readOnly, /Northwind/);
151
+ assert.match(readOnly, /10:00 – 11:30/);
152
+ });
153
+
154
+ it("keeps the way out of the pane", () => {
155
+ assert.match(readOnly, /aria-label="Close event"/);
156
+ });
157
+ });
@@ -176,3 +176,20 @@ export const AmbiguousZone: Story = {
176
176
  />
177
177
  ),
178
178
  };
179
+
180
+ /**
181
+ * The state the app itself renders while the calendar has no API to write
182
+ * through: the facts, the way back to the thread, and no control that would
183
+ * lead nowhere.
184
+ */
185
+ export const NoActions: Story = {
186
+ render: () => (
187
+ <EventDetail
188
+ event={base}
189
+ calendar={calendar}
190
+ whenText="Wednesday 10 June · 10:00 – 11:30"
191
+ onClose={() => {}}
192
+ onOpenThread={() => {}}
193
+ />
194
+ ),
195
+ };
@@ -23,8 +23,13 @@ export interface EventDetailProps {
23
23
  calendar: CalendarDescriptor;
24
24
  /** Already formatted by the caller — the component owns no clock. */
25
25
  whenText: string;
26
- onEdit: () => void;
27
- onDelete: () => void;
26
+ /**
27
+ * Absent where the surface cannot write yet. A control that leads nowhere is
28
+ * worse than no control, so the header renders each one only when it has
29
+ * somewhere to go.
30
+ */
31
+ onEdit?: () => void;
32
+ onDelete?: () => void;
28
33
  /** Absent when the event was never born from a mail. */
29
34
  onOpenThread?: () => void;
30
35
  /** Puts the pane back to whatever it shows with nothing selected. */
@@ -171,23 +176,27 @@ export function EventDetail({
171
176
  <span className="min-w-0 flex-1 truncate text-xs text-fg-muted">
172
177
  {calendar.name} · {calendar.accountLabel}
173
178
  </span>
174
- <Button
175
- variant="ghost"
176
- size="sm"
177
- icon={<Pencil className="size-3.5" />}
178
- onClick={onEdit}
179
- >
180
- Edit
181
- </Button>
182
- <Button
183
- variant="ghost"
184
- size="sm"
185
- icon={<Trash2 className="size-3.5" />}
186
- onClick={onDelete}
187
- className="text-danger"
188
- >
189
- Delete
190
- </Button>
179
+ {onEdit && (
180
+ <Button
181
+ variant="ghost"
182
+ size="sm"
183
+ icon={<Pencil className="size-3.5" />}
184
+ onClick={onEdit}
185
+ >
186
+ Edit
187
+ </Button>
188
+ )}
189
+ {onDelete && (
190
+ <Button
191
+ variant="ghost"
192
+ size="sm"
193
+ icon={<Trash2 className="size-3.5" />}
194
+ onClick={onDelete}
195
+ className="text-danger"
196
+ >
197
+ Delete
198
+ </Button>
199
+ )}
191
200
  {onClose && (
192
201
  <button
193
202
  type="button"
@@ -560,9 +560,9 @@ export interface NavSidebarProps
560
560
  */
561
561
  linkComponent?: NavLinkComponent;
562
562
  /**
563
- * Whether the calendar destination sits under the daily brief. It is
564
- * "hidden" until the app has a route behind it the prototype turns it on,
565
- * the shipping nav does not offer an entry that leads nowhere.
563
+ * Whether the calendar destination sits under the daily brief. Hidden by
564
+ * default so a host with no calendar route behind it does not offer an entry
565
+ * that leads nowhere.
566
566
  */
567
567
  calendarNav?: "hidden" | "shown";
568
568
  /** Every saved query, most recently saved first. See `SavedSearchesGroup`. */