@remit/ui 0.0.173 → 0.0.174
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/message-list-pane.render.test.ts +1 -1
- package/src/components/message-list-pane.stories.tsx +1 -1
- package/src/components/message-list-state.render.test.ts +3 -14
- package/src/components/message-list-state.stories.tsx +3 -28
- package/src/components/message-list-state.tsx +10 -15
package/package.json
CHANGED
|
@@ -20,7 +20,7 @@ function empty(props: MessageListEmptyProps = {}): string {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
const personal: MessageListFilter = {
|
|
23
|
-
label: "Personal
|
|
23
|
+
label: "Personal",
|
|
24
24
|
reach: "whole-folder",
|
|
25
25
|
onClear: () => undefined,
|
|
26
26
|
};
|
|
@@ -88,7 +88,7 @@ describe("MessageListEmpty under a filter", () => {
|
|
|
88
88
|
{ filter: personal, scopeLabel: "Inbox" },
|
|
89
89
|
{ filter: personal, searchQuery: "invoice" },
|
|
90
90
|
{ filter: personal, scopeLabel: "Inbox", searchQuery: "invoice" },
|
|
91
|
-
{ filter: { ...personal, label: "Unclassified
|
|
91
|
+
{ filter: { ...personal, label: "Unclassified" } },
|
|
92
92
|
{ filter: { ...personal, reach: "loaded-pages" } },
|
|
93
93
|
{ filter: { ...personal, reach: "loaded-pages" }, scopeLabel: "Inbox" },
|
|
94
94
|
];
|
|
@@ -130,17 +130,6 @@ describe("MessageListEmpty under a filter", () => {
|
|
|
130
130
|
assert.match(html, new RegExp(COMPLETENESS));
|
|
131
131
|
});
|
|
132
132
|
|
|
133
|
-
it("names a narrowing that is not a category at all (#1126)", () => {
|
|
134
|
-
const html = empty({
|
|
135
|
-
filter: { ...personal, label: "unread mail" },
|
|
136
|
-
scopeLabel: "Starred",
|
|
137
|
-
});
|
|
138
|
-
assert.match(html, /No unread mail in Starred/);
|
|
139
|
-
assert.match(html, new RegExp(COMPLETENESS));
|
|
140
|
-
assert.match(html, /Clear filter/);
|
|
141
|
-
assert.doesNotMatch(html, /No messages in Starred/);
|
|
142
|
-
});
|
|
143
|
-
|
|
144
133
|
it("offers the way out of the filter", () => {
|
|
145
134
|
assert.match(empty({ filter: personal }), /Clear filter/);
|
|
146
135
|
});
|
|
@@ -163,7 +152,7 @@ describe("MessageListEmpty under a filter", () => {
|
|
|
163
152
|
|
|
164
153
|
it("renders unclassified as itself, never as personal (#45)", () => {
|
|
165
154
|
const unclassified = empty({
|
|
166
|
-
filter: { ...personal, label: "Unclassified
|
|
155
|
+
filter: { ...personal, label: "Unclassified" },
|
|
167
156
|
scopeLabel: "Inbox",
|
|
168
157
|
});
|
|
169
158
|
assert.match(unclassified, /No Unclassified mail in Inbox/);
|
|
@@ -44,7 +44,7 @@ const longRow: ThreadRowData = {
|
|
|
44
44
|
};
|
|
45
45
|
|
|
46
46
|
const personalFilter: MessageListFilter = {
|
|
47
|
-
label: "Personal
|
|
47
|
+
label: "Personal",
|
|
48
48
|
reach: "whole-folder",
|
|
49
49
|
onClear: () => undefined,
|
|
50
50
|
};
|
|
@@ -185,31 +185,6 @@ export const FilteredEmpty: Story = {
|
|
|
185
185
|
args: { filter: personalFilter, scopeLabel: "Inbox" },
|
|
186
186
|
};
|
|
187
187
|
|
|
188
|
-
/**
|
|
189
|
-
* The narrowing is an attribute chip, or a token typed in the field, with no
|
|
190
|
-
* category chosen. The list is filtered exactly as much as it is under a
|
|
191
|
-
* category, and used to render as an empty collection instead (#1126).
|
|
192
|
-
*/
|
|
193
|
-
export const FilteredEmptyAttributeOnly: Story = {
|
|
194
|
-
...inFilteredPane,
|
|
195
|
-
args: {
|
|
196
|
-
filter: { ...personalFilter, label: "unread mail" },
|
|
197
|
-
scopeLabel: "Inbox",
|
|
198
|
-
},
|
|
199
|
-
};
|
|
200
|
-
|
|
201
|
-
/** Every dimension at once: category chip, attribute chip and typed token. */
|
|
202
|
-
export const FilteredEmptyEveryNarrowing: Story = {
|
|
203
|
-
...inFilteredPane,
|
|
204
|
-
args: {
|
|
205
|
-
filter: {
|
|
206
|
-
...personalFilter,
|
|
207
|
-
label: "Personal unread mail with an attachment",
|
|
208
|
-
},
|
|
209
|
-
scopeLabel: "Inbox",
|
|
210
|
-
},
|
|
211
|
-
};
|
|
212
|
-
|
|
213
188
|
/** S2 with a search query on top of the filter — same completeness sentence. */
|
|
214
189
|
export const FilteredEmptySearching: Story = {
|
|
215
190
|
...inFilteredPane,
|
|
@@ -241,7 +216,7 @@ export const FilteredEmptyBoundedReach: Story = {
|
|
|
241
216
|
export const FilteredEmptyUnclassified: Story = {
|
|
242
217
|
decorators: [paneFrame],
|
|
243
218
|
args: {
|
|
244
|
-
filter: { ...personalFilter, label: "Unclassified
|
|
219
|
+
filter: { ...personalFilter, label: "Unclassified" },
|
|
245
220
|
scopeLabel: "Inbox",
|
|
246
221
|
},
|
|
247
222
|
render: (args) => (
|
|
@@ -255,7 +230,7 @@ export const FilteredEmptyUnclassified: Story = {
|
|
|
255
230
|
export const FilteredEmptyLongLabels: Story = {
|
|
256
231
|
...inFilteredPane,
|
|
257
232
|
args: {
|
|
258
|
-
filter: { ...personalFilter, label: "Transactional
|
|
233
|
+
filter: { ...personalFilter, label: "Transactional" },
|
|
259
234
|
scopeLabel: "Archive/2024/Suppliers/Netherlands Enterprise Agency",
|
|
260
235
|
},
|
|
261
236
|
};
|
|
@@ -49,25 +49,20 @@ export function MessageListLoading() {
|
|
|
49
49
|
export type FilterReach = "whole-folder" | "loaded-pages";
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
|
-
*
|
|
53
|
-
* together: the label cannot arrive without its escape, and the reach
|
|
54
|
-
* left to a default, because it decides which completeness sentence
|
|
52
|
+
* The active category filter, the way out of it, and how far it reached. All
|
|
53
|
+
* three together: the label cannot arrive without its escape, and the reach
|
|
54
|
+
* cannot be left to a default, because it decides which completeness sentence
|
|
55
|
+
* is true.
|
|
55
56
|
*/
|
|
56
57
|
export interface MessageListFilter {
|
|
57
|
-
/**
|
|
58
|
-
* The narrowing as a noun phrase the headline reads "No " in front of:
|
|
59
|
-
* "Personal mail", "unread mail with an attachment". Whatever narrows the
|
|
60
|
-
* list belongs in it — a category chip, an attribute chip, a typed token —
|
|
61
|
-
* because this object's presence is what tells the reader the collection is
|
|
62
|
-
* filtered rather than empty (#1126).
|
|
63
|
-
*/
|
|
58
|
+
/** Display label of the active category, e.g. "Personal". */
|
|
64
59
|
label: string;
|
|
65
60
|
reach: FilterReach;
|
|
66
61
|
onClear: () => void;
|
|
67
62
|
}
|
|
68
63
|
|
|
69
64
|
export interface MessageListEmptyProps {
|
|
70
|
-
/** Absent when
|
|
65
|
+
/** Absent when no category filter is active. */
|
|
71
66
|
filter?: MessageListFilter;
|
|
72
67
|
/**
|
|
73
68
|
* Name of the collection being listed, e.g. "Inbox". Absent for a plain
|
|
@@ -145,13 +140,13 @@ function unfilteredCopy(
|
|
|
145
140
|
|
|
146
141
|
/** One string, not JSX, so the copy stays a single text node and reads whole. */
|
|
147
142
|
function filteredHeadline(
|
|
148
|
-
|
|
143
|
+
filterLabel: string,
|
|
149
144
|
scopeLabel: string | undefined,
|
|
150
145
|
query: string | undefined,
|
|
151
146
|
): string {
|
|
152
|
-
if (query) return `No results for “${query}” in ${
|
|
153
|
-
if (scopeLabel) return `No ${
|
|
154
|
-
return `No ${
|
|
147
|
+
if (query) return `No results for “${query}” in ${filterLabel}`;
|
|
148
|
+
if (scopeLabel) return `No ${filterLabel} mail in ${scopeLabel}`;
|
|
149
|
+
return `No ${filterLabel} mail`;
|
|
155
150
|
}
|
|
156
151
|
|
|
157
152
|
function EmptyFrame({ children }: { children: ReactNode }) {
|