@openpeepshq/rn-components 0.14.0 → 0.15.0
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 +4 -3
- package/src/components/buttonOverflow.test.tsx +463 -0
- package/src/components/conversations/ConversationParticipantsModal.tsx +1 -6
- package/src/components/groups/GroupCard.tsx +26 -23
- package/src/components/groups/JoinGroupButton.tsx +7 -2
- package/src/components/jams/JamCapacityGate.tsx +9 -1
- package/src/components/jams/JamChatDrawer.test.tsx +263 -0
- package/src/components/jams/JamChatDrawer.tsx +117 -52
- package/src/components/jams/JamConference.tsx +5 -0
- package/src/components/jams/JamFooter.tsx +26 -22
- package/src/components/jams/JamParticipantConference.tsx +7 -4
- package/src/components/jams/JamPeopleDrawer.test.tsx +216 -0
- package/src/components/jams/JamPeopleDrawer.tsx +51 -5
- package/src/components/jams/JamRequestJoin.tsx +30 -3
- package/src/components/jams/JamRoomIndicators.test.tsx +190 -38
- package/src/components/jams/JamRoomIndicators.tsx +62 -20
- package/src/components/jams/LeaveCloseButton.tsx +5 -1
- package/src/components/jams/useTrackSubscriptionBump.test.ts +294 -0
- package/src/components/jams/useTrackSubscriptionBump.ts +44 -0
- package/src/components/post/feed/events/EventsCalendar.test.tsx +33 -18
- package/src/components/post/pieces/ShareMenu.test.tsx +217 -0
- package/src/components/post/pieces/ShareMenu.tsx +107 -61
- package/src/components/post/post-form/VisibilitySheet.test.tsx +153 -0
- package/src/components/post/post-form/VisibilitySheet.tsx +6 -5
- package/src/components/post/types/Event.tsx +6 -2
- package/src/components/profile/Avatar.test.tsx +147 -0
- package/src/components/profile/Avatar.tsx +30 -1
- package/src/components/profile/ProfileCard.test.tsx +165 -8
- package/src/components/profile/ProfileCard.tsx +63 -10
- package/src/components/profile/ProfileSelector.test.tsx +147 -5
- package/src/components/profile/ProfileSelector.tsx +64 -18
- package/src/components/profile/ProfileWithActionCard.tsx +14 -6
- package/src/lib/post.ts +0 -128
- package/src/pages/conversations/New.test.tsx +340 -0
- package/src/pages/conversations/New.tsx +35 -30
- package/src/pages/events/Index.tsx +4 -1
- package/src/pages/events/My.tsx +1 -1
- package/src/pages/groups/Show.tsx +1 -1
- package/src/pages/posts/New.carryover.test.tsx +245 -0
- package/src/pages/posts/New.tsx +18 -2
- package/src/pages/posts/Reply.tsx +17 -2
- package/src/stores/useLocalPostStore.ts +7 -4
- package/src/theme/useThemeOpacity.test.ts +70 -0
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Regression tests for the NewConversation candidate rows
|
|
3
|
+
* (issue #1666 review S3, round-10 review S1).
|
|
4
|
+
*
|
|
5
|
+
* The row list is refiltered on every search keystroke, so keying rows by
|
|
6
|
+
* array index remounts them across filter boundaries (state loss, wasted
|
|
7
|
+
* work). The sibling selected-chips block keys by `profile.id`; the rows
|
|
8
|
+
* must do the same.
|
|
9
|
+
*
|
|
10
|
+
* The candidate rows are also the one picker surface rendered as *bare*
|
|
11
|
+
* `ProfileCard` rows — no accessible wrapper. They must carry their own
|
|
12
|
+
* screen-reader identity (role/label/state), or the whole DM picker is
|
|
13
|
+
* invisible to screen readers (round-10 review S1).
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
const React = require('react');
|
|
17
|
+
const ReactTestRenderer = require('react-test-renderer');
|
|
18
|
+
|
|
19
|
+
const MESSAGES: Record<string, string> = {
|
|
20
|
+
// Mirrors ProfileSelector.test — deliberately not the raw key, so a
|
|
21
|
+
// regression that skips the t() lookup (or the interpolation) fails.
|
|
22
|
+
'profile.selector.rowSelected': '{{name}} (selected)',
|
|
23
|
+
// Pluralized selection-count caption (plan step 4). Distinct per plural so a
|
|
24
|
+
// regression that drops the count or the plural form fails (round-11 S3).
|
|
25
|
+
'conversations.createNew.selectedCount_one': '{{count}} selected',
|
|
26
|
+
'conversations.createNew.selectedCount_other': '{{count}} selected',
|
|
27
|
+
// Plan step 4 page-header title and search placeholder (round-12 S1/S2).
|
|
28
|
+
// Pinned to the en.json values so a regression to a different key or a
|
|
29
|
+
// hard-coded string fails.
|
|
30
|
+
'conversations.createNew.title': 'New Conversation',
|
|
31
|
+
'conversations.createNew.searchPlaceholder': 'Search for people',
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const mockT = (key: string, opts?: { name?: string; count?: number }) => {
|
|
35
|
+
// Emulate i18next pluralization: a `count` option resolves `key` to
|
|
36
|
+
// `key_one` / `key_other` (used by the selection-count caption).
|
|
37
|
+
const count = opts?.count;
|
|
38
|
+
const pluralKey =
|
|
39
|
+
typeof count === 'number' ? `${key}_${count === 1 ? 'one' : 'other'}` : key;
|
|
40
|
+
return (MESSAGES[pluralKey] ?? key)
|
|
41
|
+
.replace('{{name}}', opts?.name ?? '')
|
|
42
|
+
.replace('{{count}}', String(count ?? ''));
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const ada = { id: 'p1', handle: 'ada', displayName: 'Ada' };
|
|
46
|
+
const alan = { id: 'p2', handle: 'alan', displayName: 'Alan' };
|
|
47
|
+
const PROFILES = [ada, alan];
|
|
48
|
+
|
|
49
|
+
// The store mock returns this array by reference, so the a11y test mutates
|
|
50
|
+
// it in place (reassigning the outer variable would not propagate — the
|
|
51
|
+
// factory captured the array once at first import).
|
|
52
|
+
const memberStore: unknown[] = [];
|
|
53
|
+
|
|
54
|
+
jest.mock('react-native', () => ({
|
|
55
|
+
View: (props: { children?: unknown }) =>
|
|
56
|
+
React.createElement('View', null, props.children),
|
|
57
|
+
ActivityIndicator: () => null,
|
|
58
|
+
}));
|
|
59
|
+
|
|
60
|
+
jest.mock('react-i18next', () => ({
|
|
61
|
+
useTranslation: () => ({ t: mockT }),
|
|
62
|
+
}));
|
|
63
|
+
|
|
64
|
+
jest.mock('react-native-keyboard-aware-scroll-view', () => ({
|
|
65
|
+
KeyboardAwareScrollView: (props: { children?: unknown }) =>
|
|
66
|
+
React.createElement('KeyboardAwareScrollView', null, props.children),
|
|
67
|
+
}));
|
|
68
|
+
|
|
69
|
+
jest.mock('@openpeepshq/react', () => ({
|
|
70
|
+
useOpenpeeps: () => ({
|
|
71
|
+
openpeepsApi: {
|
|
72
|
+
useProfiles: () => ({ data: PROFILES, isLoading: false }),
|
|
73
|
+
},
|
|
74
|
+
currentProfile: null,
|
|
75
|
+
}),
|
|
76
|
+
}));
|
|
77
|
+
|
|
78
|
+
jest.mock('@openpeepshq/common/lib', () => ({
|
|
79
|
+
blockedPairIds: () => [],
|
|
80
|
+
}));
|
|
81
|
+
|
|
82
|
+
jest.mock('../../lib/utils', () => ({
|
|
83
|
+
profileMatchesQuery: () => true,
|
|
84
|
+
}));
|
|
85
|
+
|
|
86
|
+
jest.mock('../../components/ui/themed-view', () => ({
|
|
87
|
+
ThemedView: (props: { children?: unknown }) =>
|
|
88
|
+
React.createElement('ThemedView', null, props.children),
|
|
89
|
+
}));
|
|
90
|
+
|
|
91
|
+
jest.mock('../../components/ui/themed-text', () => ({
|
|
92
|
+
ThemedText: (props: { children?: unknown }) =>
|
|
93
|
+
React.createElement('ThemedText', null, props.children),
|
|
94
|
+
}));
|
|
95
|
+
|
|
96
|
+
jest.mock('../../components/ui/input', () => ({
|
|
97
|
+
// Passes props through (like the other stubs) so the search Input's
|
|
98
|
+
// placeholder is assertable (round-12 S2).
|
|
99
|
+
Input: (props: Record<string, unknown>) =>
|
|
100
|
+
React.createElement('Input', props),
|
|
101
|
+
}));
|
|
102
|
+
|
|
103
|
+
jest.mock('../../components/icons/index', () => ({
|
|
104
|
+
CheckIcon: () => React.createElement('CheckIcon'),
|
|
105
|
+
}));
|
|
106
|
+
|
|
107
|
+
// Shared jest.fn (not a fresh one per call) so the page-header assertion can
|
|
108
|
+
// read the captured title (round-12 S1).
|
|
109
|
+
const setPageHeaderSpy = jest.fn();
|
|
110
|
+
|
|
111
|
+
jest.mock('../../components/layout', () => ({
|
|
112
|
+
HeaderActionButton: () => null,
|
|
113
|
+
useSetPageHeader: (...args: unknown[]) => setPageHeaderSpy(...args),
|
|
114
|
+
}));
|
|
115
|
+
|
|
116
|
+
jest.mock('../../components/custom/common/index', () => ({
|
|
117
|
+
EmptyStateContainer: () => null,
|
|
118
|
+
}));
|
|
119
|
+
|
|
120
|
+
jest.mock('../../stores/useNewConversationStore', () => ({
|
|
121
|
+
useNewConversationStore: () => ({
|
|
122
|
+
members: memberStore,
|
|
123
|
+
setMember: jest.fn(),
|
|
124
|
+
removeMember: jest.fn(),
|
|
125
|
+
}),
|
|
126
|
+
}));
|
|
127
|
+
|
|
128
|
+
jest.mock('../../components/profile/index', () => ({
|
|
129
|
+
ProfileCard: (props: Record<string, unknown>) =>
|
|
130
|
+
React.createElement('ProfileCard', props),
|
|
131
|
+
MiniProfileCard: (props: Record<string, unknown>) =>
|
|
132
|
+
React.createElement('MiniProfileCard', props),
|
|
133
|
+
}));
|
|
134
|
+
|
|
135
|
+
import { NewConversation } from './New';
|
|
136
|
+
|
|
137
|
+
const renderPage = () => {
|
|
138
|
+
let tree: ReturnType<typeof ReactTestRenderer.create>;
|
|
139
|
+
ReactTestRenderer.act(() => {
|
|
140
|
+
tree = ReactTestRenderer.create(
|
|
141
|
+
React.createElement(NewConversation, {
|
|
142
|
+
navigation: { navigate: jest.fn() },
|
|
143
|
+
} as never)
|
|
144
|
+
);
|
|
145
|
+
});
|
|
146
|
+
return tree;
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
const rowsOf = (tree: ReturnType<typeof ReactTestRenderer.create>) =>
|
|
150
|
+
tree.root.findAll(
|
|
151
|
+
(node: { type?: { name?: string } }) =>
|
|
152
|
+
typeof node.type === 'function' && node.type.name === 'ProfileCard'
|
|
153
|
+
);
|
|
154
|
+
|
|
155
|
+
describe('NewConversation row keying (issue #1666 review S3)', () => {
|
|
156
|
+
it('keys the profile rows by profile.id, not array index', () => {
|
|
157
|
+
let tree: ReturnType<typeof ReactTestRenderer.create>;
|
|
158
|
+
ReactTestRenderer.act(() => {
|
|
159
|
+
tree = ReactTestRenderer.create(
|
|
160
|
+
React.createElement(NewConversation, {
|
|
161
|
+
navigation: { navigate: jest.fn() },
|
|
162
|
+
} as never)
|
|
163
|
+
);
|
|
164
|
+
});
|
|
165
|
+
// React strips keys from the public TestInstance / toJSON output; the
|
|
166
|
+
// key only lives on the fiber, so read it from there. Match the mock
|
|
167
|
+
// component itself (the object-literal shorthand names it
|
|
168
|
+
// `ProfileCard`), not the string-typed element it returns. With the
|
|
169
|
+
// fixed `key={profile.id}` this is the profile id; the old
|
|
170
|
+
// `key={index}` would yield "0"/"1" and fail.
|
|
171
|
+
const rowKeys = tree.root
|
|
172
|
+
.findAll(
|
|
173
|
+
(node: { type?: { name?: string } }) =>
|
|
174
|
+
typeof node.type === 'function' && node.type.name === 'ProfileCard'
|
|
175
|
+
)
|
|
176
|
+
.map(
|
|
177
|
+
(node: { _currentFiber: () => { key: string } }) =>
|
|
178
|
+
node._currentFiber().key
|
|
179
|
+
);
|
|
180
|
+
expect(rowKeys).toEqual(['p1', 'p2']);
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
it('gives the bare candidate rows their own screen-reader identity (issue #1666 round-10 S1)', () => {
|
|
184
|
+
// The rows are not wrapped in an accessible element, so the a11y must
|
|
185
|
+
// reach the ProfileCard itself. Mark one profile selected (in place —
|
|
186
|
+
// the store mock holds the array by reference) and assert each row
|
|
187
|
+
// carries a button role, a non-empty localized label, and a selected
|
|
188
|
+
// state that matches its membership.
|
|
189
|
+
memberStore.push(ada);
|
|
190
|
+
try {
|
|
191
|
+
let tree: ReturnType<typeof ReactTestRenderer.create>;
|
|
192
|
+
ReactTestRenderer.act(() => {
|
|
193
|
+
tree = ReactTestRenderer.create(
|
|
194
|
+
React.createElement(NewConversation, {
|
|
195
|
+
navigation: { navigate: jest.fn() },
|
|
196
|
+
} as never)
|
|
197
|
+
);
|
|
198
|
+
});
|
|
199
|
+
const rows = tree.root.findAll(
|
|
200
|
+
(node: { type?: { name?: string } }) =>
|
|
201
|
+
typeof node.type === 'function' && node.type.name === 'ProfileCard'
|
|
202
|
+
);
|
|
203
|
+
expect(rows).toHaveLength(2);
|
|
204
|
+
for (const row of rows) {
|
|
205
|
+
expect(row.props.accessibilityRole).toBe('button');
|
|
206
|
+
expect(typeof row.props.accessibilityLabel).toBe('string');
|
|
207
|
+
expect(row.props.accessibilityLabel.length).toBeGreaterThan(0);
|
|
208
|
+
expect(typeof row.props.accessibilityState?.selected).toBe('boolean');
|
|
209
|
+
}
|
|
210
|
+
// The selected row composes its label through the locale key with the
|
|
211
|
+
// profile name interpolated; the unselected row uses the plain name.
|
|
212
|
+
const selected = rows.find(
|
|
213
|
+
(node: { props: { accessibilityState?: { selected?: boolean } } }) =>
|
|
214
|
+
node.props.accessibilityState?.selected === true
|
|
215
|
+
);
|
|
216
|
+
const unselected = rows.find(
|
|
217
|
+
(node: { props: { accessibilityState?: { selected?: boolean } } }) =>
|
|
218
|
+
node.props.accessibilityState?.selected === false
|
|
219
|
+
);
|
|
220
|
+
expect(selected?.props.accessibilityLabel).toBe('Ada (selected)');
|
|
221
|
+
expect(unselected?.props.accessibilityLabel).toBe('Alan');
|
|
222
|
+
} finally {
|
|
223
|
+
memberStore.length = 0;
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
// The caption is the page's only `ThemedText` (every other string goes
|
|
229
|
+
// through a mocked component), so the first ThemedText is the selection-count
|
|
230
|
+
// caption when it renders at all.
|
|
231
|
+
const caption = (tree: ReturnType<typeof ReactTestRenderer.create>) =>
|
|
232
|
+
tree.root.findAllByType('ThemedText')[0]?.props.children;
|
|
233
|
+
|
|
234
|
+
describe('NewConversation selection-count caption (issue #1666 round-11 S3)', () => {
|
|
235
|
+
it('renders the localized selectedCount caption with the count interpolated', () => {
|
|
236
|
+
// The mock t() resolves the plural key and interpolates {{count}}, so a
|
|
237
|
+
// regression that drops the count (or skips the t() lookup and renders
|
|
238
|
+
// the raw key) fails here.
|
|
239
|
+
memberStore.push(ada, alan);
|
|
240
|
+
try {
|
|
241
|
+
expect(caption(renderPage())).toBe('2 selected');
|
|
242
|
+
} finally {
|
|
243
|
+
memberStore.length = 0;
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
it('resolves the singular plural form for exactly one selection', () => {
|
|
248
|
+
memberStore.push(ada);
|
|
249
|
+
try {
|
|
250
|
+
expect(caption(renderPage())).toBe('1 selected');
|
|
251
|
+
} finally {
|
|
252
|
+
memberStore.length = 0;
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
it('renders no caption when nothing is selected', () => {
|
|
257
|
+
const tree = renderPage();
|
|
258
|
+
expect(caption(tree)).toBeUndefined();
|
|
259
|
+
expect(tree.root.findAllByType('ThemedText')).toHaveLength(0);
|
|
260
|
+
});
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
describe('NewConversation candidate-row label strings (issue #1666 round-11 S4)', () => {
|
|
264
|
+
const labelOf = (
|
|
265
|
+
rows: Array<{
|
|
266
|
+
props: {
|
|
267
|
+
accessibilityState?: { selected?: boolean };
|
|
268
|
+
accessibilityLabel?: string;
|
|
269
|
+
};
|
|
270
|
+
}>,
|
|
271
|
+
selected: boolean
|
|
272
|
+
) =>
|
|
273
|
+
rows.find((row) => row.props.accessibilityState?.selected === selected)
|
|
274
|
+
?.props.accessibilityLabel;
|
|
275
|
+
|
|
276
|
+
it('composes the exact localized screen-reader string, selected and unselected', () => {
|
|
277
|
+
// Pinned via the key-resolution mock (mirrors ProfileSelector.test): the
|
|
278
|
+
// selected label is the resolved profile.selector.rowSelected string with
|
|
279
|
+
// the name interpolated, the unselected label is the plain name — so a
|
|
280
|
+
// regression to a hard-coded English fragment or a missing t() lookup fails.
|
|
281
|
+
memberStore.push(ada);
|
|
282
|
+
try {
|
|
283
|
+
const rows = rowsOf(renderPage());
|
|
284
|
+
expect(labelOf(rows, true)).toBe('Ada (selected)');
|
|
285
|
+
expect(labelOf(rows, false)).toBe('Alan');
|
|
286
|
+
} finally {
|
|
287
|
+
memberStore.length = 0;
|
|
288
|
+
}
|
|
289
|
+
});
|
|
290
|
+
|
|
291
|
+
it('falls back to the handle when a profile has no display name', () => {
|
|
292
|
+
// New.tsx composes `displayName || \`@${handle}\`` for both the plain and
|
|
293
|
+
// the selected label; a profile with no displayName must yield the handle
|
|
294
|
+
// in both states.
|
|
295
|
+
const carl = { id: 'p3', handle: 'carl' };
|
|
296
|
+
PROFILES.push(carl);
|
|
297
|
+
memberStore.push(carl);
|
|
298
|
+
try {
|
|
299
|
+
const findRow = (tree: ReturnType<typeof ReactTestRenderer.create>) =>
|
|
300
|
+
rowsOf(tree).find(
|
|
301
|
+
(row) =>
|
|
302
|
+
(row.props as { profile: { handle: string } }).profile.handle ===
|
|
303
|
+
'carl'
|
|
304
|
+
);
|
|
305
|
+
// Selected: label is the localized key with the handle interpolated.
|
|
306
|
+
expect(findRow(renderPage())?.props.accessibilityLabel).toBe(
|
|
307
|
+
'@carl (selected)'
|
|
308
|
+
);
|
|
309
|
+
// Unselected (no one selected): the row falls back to the plain handle.
|
|
310
|
+
memberStore.length = 0;
|
|
311
|
+
const plainRow = findRow(renderPage());
|
|
312
|
+
expect(plainRow?.props.accessibilityState?.selected).toBe(false);
|
|
313
|
+
expect(plainRow?.props.accessibilityLabel).toBe('@carl');
|
|
314
|
+
} finally {
|
|
315
|
+
memberStore.length = 0;
|
|
316
|
+
PROFILES.pop();
|
|
317
|
+
}
|
|
318
|
+
});
|
|
319
|
+
});
|
|
320
|
+
|
|
321
|
+
describe('NewConversation page chrome (issue #1666 round-12 S1/S2)', () => {
|
|
322
|
+
it('sets the page header title via conversations.createNew.title (plan step 4)', () => {
|
|
323
|
+
// The captured title is the resolved locale value; the old header used
|
|
324
|
+
// the nonexistent conversations.selectMembers key, which silently fell
|
|
325
|
+
// back to its defaultValue — a regression to that key (or any other)
|
|
326
|
+
// fails on the resolved string.
|
|
327
|
+
renderPage();
|
|
328
|
+
expect(setPageHeaderSpy).toHaveBeenCalled();
|
|
329
|
+
expect(setPageHeaderSpy.mock.calls.at(-1)?.[0]).toBe('New Conversation');
|
|
330
|
+
});
|
|
331
|
+
|
|
332
|
+
it('passes the localized search placeholder to the search Input (plan step 4)', () => {
|
|
333
|
+
// The Input stub passes props through, so the rendered Input carries the
|
|
334
|
+
// resolved placeholder; a regression to the old hard-coded
|
|
335
|
+
// "Enter name or handle" fails.
|
|
336
|
+
const tree = renderPage();
|
|
337
|
+
const input = tree.root.findAllByType('Input')[0];
|
|
338
|
+
expect(input?.props.placeholder).toBe('Search for people');
|
|
339
|
+
});
|
|
340
|
+
});
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import React, { useEffect } from 'react';
|
|
2
2
|
import { ThemedView } from '../../components/ui/themed-view';
|
|
3
|
-
import { ProfileCard } from '../../components/profile/index';
|
|
3
|
+
import { MiniProfileCard, ProfileCard } from '../../components/profile/index';
|
|
4
4
|
import { HeaderActionButton, useSetPageHeader } from '../../components/layout';
|
|
5
5
|
import { EmptyStateContainer } from '../../components/custom/common/index';
|
|
6
6
|
import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view';
|
|
7
7
|
import { useOpenpeeps } from '@openpeepshq/react';
|
|
8
|
-
import { CheckIcon
|
|
8
|
+
import { CheckIcon } from '../../components/icons/index';
|
|
9
9
|
import { ThemedText } from '../../components/ui/themed-text';
|
|
10
|
-
import { ActivityIndicator,
|
|
10
|
+
import { ActivityIndicator, View } from 'react-native';
|
|
11
11
|
import { MainScreenProps } from '../../components/navigation/types/index';
|
|
12
12
|
import { useNewConversationStore } from '../../stores/useNewConversationStore';
|
|
13
13
|
import { Input } from '../../components/ui/input';
|
|
14
14
|
import { profileMatchesQuery } from '../../lib/utils';
|
|
15
15
|
import { blockedPairIds } from '@openpeepshq/common/lib';
|
|
16
|
+
import type { Profile, PublicProfile } from '@openpeepshq/common';
|
|
16
17
|
import { useTranslation } from 'react-i18next';
|
|
17
18
|
|
|
18
19
|
type SelectPrivateMessageMembersProps =
|
|
@@ -46,7 +47,7 @@ export const NewConversation = ({
|
|
|
46
47
|
}, [currentProfile, allProfiles, searchQuery]);
|
|
47
48
|
|
|
48
49
|
useSetPageHeader(
|
|
49
|
-
t('conversations.
|
|
50
|
+
t('conversations.createNew.title'),
|
|
50
51
|
<HeaderActionButton
|
|
51
52
|
title={t('common.next', { defaultValue: 'Next' })}
|
|
52
53
|
onPress={() => navigation.navigate('DraftMessage')}
|
|
@@ -59,7 +60,7 @@ export const NewConversation = ({
|
|
|
59
60
|
<View className="w-full flex flex-row justify-between items-center p-4">
|
|
60
61
|
<Input
|
|
61
62
|
className="flex-1"
|
|
62
|
-
placeholder=
|
|
63
|
+
placeholder={t('conversations.createNew.searchPlaceholder')}
|
|
63
64
|
value={searchQuery}
|
|
64
65
|
onChangeText={setSearchQuery}
|
|
65
66
|
/>
|
|
@@ -68,46 +69,50 @@ export const NewConversation = ({
|
|
|
68
69
|
{isLoading && <ActivityIndicator size={'small'} />}
|
|
69
70
|
|
|
70
71
|
{members.length > 0 && (
|
|
71
|
-
<ThemedView className="
|
|
72
|
-
{members.map((
|
|
73
|
-
<
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
handleSelectProfile={() => removeMember(profile)}
|
|
79
|
-
rightComponent={
|
|
80
|
-
<Pressable onPress={() => removeMember(profile)}>
|
|
81
|
-
<XIcon className="text-foreground" />
|
|
82
|
-
</Pressable>
|
|
83
|
-
}
|
|
84
|
-
/>
|
|
85
|
-
</ThemedView>
|
|
72
|
+
<ThemedView className="my-4 w-full flex-row flex-wrap gap-2">
|
|
73
|
+
{members.map((member) => (
|
|
74
|
+
<MiniProfileCard
|
|
75
|
+
key={member.id}
|
|
76
|
+
profile={member as PublicProfile}
|
|
77
|
+
onPress={() => removeMember(member as Profile)}
|
|
78
|
+
/>
|
|
86
79
|
))}
|
|
87
80
|
</ThemedView>
|
|
88
81
|
)}
|
|
89
82
|
{members.length > 0 && (
|
|
90
83
|
<ThemedText className="text-center">
|
|
91
|
-
{
|
|
84
|
+
{t('conversations.createNew.selectedCount', {
|
|
85
|
+
count: members.length,
|
|
86
|
+
})}
|
|
92
87
|
</ThemedText>
|
|
93
88
|
)}
|
|
94
89
|
|
|
95
|
-
{filteredProfiles?.map((profile
|
|
90
|
+
{filteredProfiles?.map((profile) => {
|
|
91
|
+
const selected = members.some((m) => m.id === profile.id);
|
|
92
|
+
// The candidate rows are bare `ProfileCard` rows with no accessible
|
|
93
|
+
// wrapper, so they carry their own screen-reader identity: without
|
|
94
|
+
// it the whole DM picker is invisible to screen readers (issue
|
|
95
|
+
// #1666 round-10 review S1).
|
|
96
|
+
const rowLabel = selected
|
|
97
|
+
? t('profile.selector.rowSelected', {
|
|
98
|
+
name: profile.displayName || `@${profile.handle}`,
|
|
99
|
+
})
|
|
100
|
+
: profile.displayName || `@${profile.handle}`;
|
|
96
101
|
return (
|
|
97
102
|
<ProfileCard
|
|
98
|
-
key={
|
|
103
|
+
key={profile.id}
|
|
99
104
|
profile={profile}
|
|
100
|
-
hasAction={true}
|
|
101
105
|
actionType="select"
|
|
106
|
+
accessibilityRole="button"
|
|
107
|
+
accessibilityLabel={rowLabel}
|
|
108
|
+
accessibilityState={{ selected }}
|
|
102
109
|
rightComponent={
|
|
103
|
-
|
|
104
|
-
{
|
|
105
|
-
|
|
106
|
-
) : null}
|
|
107
|
-
</>
|
|
110
|
+
selected ? (
|
|
111
|
+
<CheckIcon size={16} className="text-primary" />
|
|
112
|
+
) : null
|
|
108
113
|
}
|
|
109
114
|
handleSelectProfile={() => {
|
|
110
|
-
if (
|
|
115
|
+
if (selected) {
|
|
111
116
|
removeMember(profile);
|
|
112
117
|
} else {
|
|
113
118
|
setMember(profile);
|
|
@@ -88,7 +88,10 @@ export const EventsIndex = ({
|
|
|
88
88
|
},
|
|
89
89
|
]}
|
|
90
90
|
/>
|
|
91
|
-
<EventsView
|
|
91
|
+
<EventsView
|
|
92
|
+
calendar={{ window: tab }}
|
|
93
|
+
list={<EventsFeed query={activeQuery} />}
|
|
94
|
+
/>
|
|
92
95
|
<NewEventButton visibility={visibility} currentProfile={currentProfile} />
|
|
93
96
|
</ThemedView>
|
|
94
97
|
);
|
package/src/pages/events/My.tsx
CHANGED