@planningcenter/chat-react-native 3.45.1-qa-897.0 → 3.45.1-qa-staging.1
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/build/components/conversation/attachments/video_attachment.js +2 -2
- package/build/components/conversation/attachments/video_attachment.js.map +1 -1
- package/build/components/display/index.d.ts +1 -0
- package/build/components/display/index.d.ts.map +1 -1
- package/build/components/display/index.js +1 -0
- package/build/components/display/index.js.map +1 -1
- package/build/components/display/keyboard_scroll_view.d.ts +5 -0
- package/build/components/display/keyboard_scroll_view.d.ts.map +1 -0
- package/build/components/display/keyboard_scroll_view.js +37 -0
- package/build/components/display/keyboard_scroll_view.js.map +1 -0
- package/build/hooks/direct_messages/use_direct_message_affiliations.d.ts +1 -0
- package/build/hooks/direct_messages/use_direct_message_affiliations.d.ts.map +1 -1
- package/build/hooks/direct_messages/use_direct_message_affiliations.js +3 -2
- package/build/hooks/direct_messages/use_direct_message_affiliations.js.map +1 -1
- package/build/screens/avatar_picker/avatar_picker_screen.d.ts.map +1 -1
- package/build/screens/avatar_picker/avatar_picker_screen.js +10 -2
- package/build/screens/avatar_picker/avatar_picker_screen.js.map +1 -1
- package/build/screens/bug_report_screen.d.ts.map +1 -1
- package/build/screens/bug_report_screen.js +5 -5
- package/build/screens/bug_report_screen.js.map +1 -1
- package/build/screens/conversation_select_recipients/components/results_heading.d.ts +6 -0
- package/build/screens/conversation_select_recipients/components/results_heading.d.ts.map +1 -0
- package/build/screens/conversation_select_recipients/components/results_heading.js +27 -0
- package/build/screens/conversation_select_recipients/components/results_heading.js.map +1 -0
- package/build/screens/conversation_select_recipients/conversation_select_direct_message_recipients_screen.d.ts.map +1 -1
- package/build/screens/conversation_select_recipients/conversation_select_direct_message_recipients_screen.js +6 -13
- package/build/screens/conversation_select_recipients/conversation_select_direct_message_recipients_screen.js.map +1 -1
- package/build/screens/message_report_screen.js +3 -3
- package/build/screens/message_report_screen.js.map +1 -1
- package/build/types/resources/direct_message_affiliations.d.ts +1 -0
- package/build/types/resources/direct_message_affiliations.d.ts.map +1 -1
- package/build/types/resources/direct_message_affiliations.js.map +1 -1
- package/build/utils/native_adapters/video.d.ts +1 -4
- package/build/utils/native_adapters/video.d.ts.map +1 -1
- package/build/utils/native_adapters/video.js.map +1 -1
- package/package.json +4 -4
- package/src/__tests__/components/conversation/attachments/video_attachment.test.tsx +111 -0
- package/src/__tests__/hooks/use_direct_message_affiliations.test.tsx +74 -0
- package/src/components/conversation/attachments/video_attachment.tsx +2 -2
- package/src/components/display/index.ts +1 -0
- package/src/components/display/keyboard_scroll_view.tsx +54 -0
- package/src/hooks/direct_messages/use_direct_message_affiliations.ts +4 -2
- package/src/screens/avatar_picker/avatar_picker_screen.tsx +11 -2
- package/src/screens/bug_report_screen.tsx +143 -149
- package/src/screens/conversation_select_recipients/components/__tests__/results_heading.test.tsx +32 -0
- package/src/screens/conversation_select_recipients/components/results_heading.tsx +50 -0
- package/src/screens/conversation_select_recipients/conversation_select_direct_message_recipients_screen.tsx +7 -15
- package/src/screens/message_report_screen.tsx +38 -40
- package/src/types/react-native-scroll-view.d.ts +7 -0
- package/src/types/resources/direct_message_affiliations.ts +1 -0
- package/src/utils/native_adapters/video.ts +1 -4
|
@@ -23,6 +23,7 @@ export * from './text_button'
|
|
|
23
23
|
export * from './text_inline_button'
|
|
24
24
|
export * from './text'
|
|
25
25
|
export * from './toggle_button'
|
|
26
|
+
export * from './keyboard_scroll_view'
|
|
26
27
|
export * from './keyboard_view'
|
|
27
28
|
export * from './platform_modal_header_buttons'
|
|
28
29
|
export * from './pressable_row'
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React, { useCallback, useRef } from 'react'
|
|
2
|
+
import { Keyboard, ScrollView, ScrollViewProps, TextInput } from 'react-native'
|
|
3
|
+
import { KeyboardView } from './keyboard_view'
|
|
4
|
+
|
|
5
|
+
const FOCUSED_INPUT_BOTTOM_MARGIN = 32
|
|
6
|
+
|
|
7
|
+
type KeyboardScrollViewProps = Pick<ScrollViewProps, 'children' | 'contentContainerStyle'>
|
|
8
|
+
|
|
9
|
+
export function KeyboardScrollView({ children, contentContainerStyle }: KeyboardScrollViewProps) {
|
|
10
|
+
const scrollViewRef = useRef<ScrollView>(null)
|
|
11
|
+
|
|
12
|
+
const scrollFocusedInputIntoView = useCallback(() => {
|
|
13
|
+
const scrollView = scrollViewRef.current
|
|
14
|
+
const input = TextInput.State.currentlyFocusedInput()
|
|
15
|
+
if (!scrollView || !input) return
|
|
16
|
+
|
|
17
|
+
const nativeScrollView = scrollView.getNativeScrollRef()
|
|
18
|
+
const innerView = scrollView.getInnerViewRef()
|
|
19
|
+
if (!nativeScrollView || !innerView) return
|
|
20
|
+
|
|
21
|
+
nativeScrollView.measureInWindow((_scrollX, scrollTop, _scrollWidth, scrollHeight) => {
|
|
22
|
+
const keyboardTop = Keyboard.metrics()?.screenY
|
|
23
|
+
const scrollBottom = scrollTop + scrollHeight
|
|
24
|
+
const visibleBottom =
|
|
25
|
+
keyboardTop === undefined ? scrollBottom : Math.min(scrollBottom, keyboardTop)
|
|
26
|
+
const visibleHeight = visibleBottom - scrollTop
|
|
27
|
+
|
|
28
|
+
input.measureInWindow((_inputX, inputTop, _inputWidth, inputHeight) => {
|
|
29
|
+
const inputBottom = inputTop + inputHeight + FOCUSED_INPUT_BOTTOM_MARGIN
|
|
30
|
+
if (inputBottom <= visibleBottom) return
|
|
31
|
+
|
|
32
|
+
input.measureLayout(innerView, (_left, contentTop, _contentWidth, contentHeight) => {
|
|
33
|
+
scrollView.scrollTo({
|
|
34
|
+
y: contentTop + contentHeight + FOCUSED_INPUT_BOTTOM_MARGIN - visibleHeight,
|
|
35
|
+
animated: true,
|
|
36
|
+
})
|
|
37
|
+
})
|
|
38
|
+
})
|
|
39
|
+
})
|
|
40
|
+
}, [])
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<KeyboardView>
|
|
44
|
+
<ScrollView
|
|
45
|
+
ref={scrollViewRef}
|
|
46
|
+
contentContainerStyle={contentContainerStyle}
|
|
47
|
+
onLayout={scrollFocusedInputIntoView}
|
|
48
|
+
onContentSizeChange={scrollFocusedInputIntoView}
|
|
49
|
+
>
|
|
50
|
+
{children}
|
|
51
|
+
</ScrollView>
|
|
52
|
+
</KeyboardView>
|
|
53
|
+
)
|
|
54
|
+
}
|
|
@@ -13,7 +13,7 @@ export function useDirectMessageAffiliations() {
|
|
|
13
13
|
apiClient.chat.get({
|
|
14
14
|
url: '/me/direct_message_affiliations',
|
|
15
15
|
data: {
|
|
16
|
-
fields: { DirectMessageAffiliations: ['groups', 'teams'] },
|
|
16
|
+
fields: { DirectMessageAffiliations: ['groups', 'teams', 'results_description'] },
|
|
17
17
|
},
|
|
18
18
|
}) as Promise<ApiResource<DirectMessageAffiliationsResource>>,
|
|
19
19
|
staleTime: 5 * 60 * 1000,
|
|
@@ -35,5 +35,7 @@ export function useDirectMessageAffiliations() {
|
|
|
35
35
|
[data]
|
|
36
36
|
)
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
const resultsDescription = data?.data?.resultsDescription ?? null
|
|
39
|
+
|
|
40
|
+
return { groups, teams, resultsDescription }
|
|
39
41
|
}
|
|
@@ -32,15 +32,24 @@ import { EmojiTab } from './emoji_tab'
|
|
|
32
32
|
import { IconGrid } from './icon_grid'
|
|
33
33
|
import { UploadTab } from './upload_tab'
|
|
34
34
|
|
|
35
|
+
// On iPad a native formSheet is a fixed-size centered sheet whose content gets
|
|
36
|
+
// laid out against the window instead of the sheet, clipping the bottom of the
|
|
37
|
+
// picker (CHAT-246) — present as a regular modal there instead.
|
|
38
|
+
const isPad = Platform.OS === 'ios' && Platform.isPad
|
|
39
|
+
const presentation = Platform.select({
|
|
40
|
+
android: 'modal' as const,
|
|
41
|
+
ios: isPad ? ('modal' as const) : ('formSheet' as const),
|
|
42
|
+
})
|
|
43
|
+
|
|
35
44
|
export const AvatarPickerScreenOptions = getFormSheetScreenOptions({
|
|
36
45
|
headerTitle: 'Update avatar',
|
|
37
|
-
presentation
|
|
46
|
+
presentation,
|
|
38
47
|
sheetAllowedDetents: [1],
|
|
39
48
|
})
|
|
40
49
|
|
|
41
50
|
export const AvatarPickerCreateScreenOptions = getFormSheetScreenOptions({
|
|
42
51
|
headerTitle: 'Choose avatar',
|
|
43
|
-
presentation
|
|
52
|
+
presentation,
|
|
44
53
|
sheetAllowedDetents: [1],
|
|
45
54
|
})
|
|
46
55
|
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
TextInlineButton,
|
|
23
23
|
ImageAttachmentPreview,
|
|
24
24
|
Icon,
|
|
25
|
-
|
|
25
|
+
KeyboardScrollView,
|
|
26
26
|
} from '../components'
|
|
27
27
|
import {
|
|
28
28
|
composeOptions,
|
|
@@ -217,166 +217,160 @@ export function BugReportScreen() {
|
|
|
217
217
|
}
|
|
218
218
|
|
|
219
219
|
return (
|
|
220
|
-
<
|
|
221
|
-
<
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
</Text>
|
|
220
|
+
<KeyboardScrollView contentContainerStyle={styles.container}>
|
|
221
|
+
<Text style={styles.description}>
|
|
222
|
+
Thanks for helping us improve {DisplayableAppName[name]}. We won't be able to respond to
|
|
223
|
+
your submission, but your feedback helps us improve the experience helps us improve the
|
|
224
|
+
experience.
|
|
225
|
+
</Text>
|
|
227
226
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
accessibilityElementsHidden
|
|
238
|
-
/>
|
|
239
|
-
</TouchableOpacity>
|
|
240
|
-
</View>
|
|
227
|
+
<View style={styles.textInputContainer}>
|
|
228
|
+
<Text style={styles.fieldLabel}>
|
|
229
|
+
Where did you experience the issue? <Text style={styles.required}>*</Text>
|
|
230
|
+
</Text>
|
|
231
|
+
<TouchableOpacity style={styles.pickerButton} onPress={() => setShowBugTypePicker(true)}>
|
|
232
|
+
<Text style={[styles.pickerText, !bugType && styles.pickerPlaceholder]}>{bugType}</Text>
|
|
233
|
+
<Icon name="general.downChevron" style={styles.pickerArrow} accessibilityElementsHidden />
|
|
234
|
+
</TouchableOpacity>
|
|
235
|
+
</View>
|
|
241
236
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
</View>
|
|
254
|
-
<ScrollView style={styles.modalContent}>
|
|
255
|
-
{Object.values(BUG_TYPE_OPTIONS).map(option => (
|
|
256
|
-
<TouchableOpacity
|
|
257
|
-
key={option}
|
|
258
|
-
style={styles.modalOption}
|
|
259
|
-
onPress={() => {
|
|
260
|
-
setBugType(option)
|
|
261
|
-
setShowBugTypePicker(false)
|
|
262
|
-
}}
|
|
263
|
-
>
|
|
264
|
-
<Text style={styles.modalOptionText}>{option}</Text>
|
|
265
|
-
{bugType === option && (
|
|
266
|
-
<Icon
|
|
267
|
-
name="general.check"
|
|
268
|
-
style={styles.modalCheckmark}
|
|
269
|
-
accessibilityElementsHidden
|
|
270
|
-
/>
|
|
271
|
-
)}
|
|
272
|
-
</TouchableOpacity>
|
|
273
|
-
))}
|
|
274
|
-
</ScrollView>
|
|
237
|
+
<SafeAreaModal
|
|
238
|
+
visible={showBugTypePicker}
|
|
239
|
+
animationType="slide"
|
|
240
|
+
presentationStyle="pageSheet"
|
|
241
|
+
onRequestClose={() => setShowBugTypePicker(false)}
|
|
242
|
+
>
|
|
243
|
+
<View style={styles.modalContainer}>
|
|
244
|
+
<View style={styles.modalHeader}>
|
|
245
|
+
<HeaderDismissButton title="Cancel" onPress={() => setShowBugTypePicker(false)} />
|
|
246
|
+
<Text style={styles.modalTitle}>Select Bug Type</Text>
|
|
247
|
+
<View style={styles.modalHeaderSpacer} />
|
|
275
248
|
</View>
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
249
|
+
<ScrollView style={styles.modalContent}>
|
|
250
|
+
{Object.values(BUG_TYPE_OPTIONS).map(option => (
|
|
251
|
+
<TouchableOpacity
|
|
252
|
+
key={option}
|
|
253
|
+
style={styles.modalOption}
|
|
254
|
+
onPress={() => {
|
|
255
|
+
setBugType(option)
|
|
256
|
+
setShowBugTypePicker(false)
|
|
257
|
+
}}
|
|
258
|
+
>
|
|
259
|
+
<Text style={styles.modalOptionText}>{option}</Text>
|
|
260
|
+
{bugType === option && (
|
|
261
|
+
<Icon
|
|
262
|
+
name="general.check"
|
|
263
|
+
style={styles.modalCheckmark}
|
|
264
|
+
accessibilityElementsHidden
|
|
265
|
+
/>
|
|
266
|
+
)}
|
|
267
|
+
</TouchableOpacity>
|
|
268
|
+
))}
|
|
269
|
+
</ScrollView>
|
|
296
270
|
</View>
|
|
271
|
+
</SafeAreaModal>
|
|
297
272
|
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
273
|
+
<View style={styles.textInputContainer}>
|
|
274
|
+
<Text style={styles.fieldLabel}>
|
|
275
|
+
What were you trying to do when you encountered the bug?{' '}
|
|
276
|
+
<Text style={styles.required}>*</Text>
|
|
277
|
+
</Text>
|
|
278
|
+
<TextInput
|
|
279
|
+
style={styles.textInput}
|
|
280
|
+
multiline
|
|
281
|
+
placeholder="Description"
|
|
282
|
+
value={whatWereDoing}
|
|
283
|
+
onChangeText={setWhatWereDoing}
|
|
284
|
+
maxLength={MAX_DESCRIPTION_LENGTH}
|
|
285
|
+
/>
|
|
286
|
+
{whatWereDoing.length >= MAX_DESCRIPTION_LENGTH - 100 && (
|
|
287
|
+
<Text variant="footnote">
|
|
288
|
+
{whatWereDoing.length}/{MAX_DESCRIPTION_LENGTH}
|
|
302
289
|
</Text>
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
multiline
|
|
306
|
-
placeholder="Description"
|
|
307
|
-
value={whatExpected}
|
|
308
|
-
onChangeText={setWhatExpected}
|
|
309
|
-
maxLength={MAX_DESCRIPTION_LENGTH}
|
|
310
|
-
/>
|
|
311
|
-
{whatExpected.length >= MAX_DESCRIPTION_LENGTH - 100 && (
|
|
312
|
-
<Text variant="footnote">
|
|
313
|
-
{whatExpected.length}/{MAX_DESCRIPTION_LENGTH}
|
|
314
|
-
</Text>
|
|
315
|
-
)}
|
|
316
|
-
</View>
|
|
290
|
+
)}
|
|
291
|
+
</View>
|
|
317
292
|
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
onRemovePress={handleRemoveAttachment}
|
|
333
|
-
/>
|
|
334
|
-
) : (
|
|
335
|
-
<VideoAttachmentPreview
|
|
336
|
-
name={attachment.name}
|
|
337
|
-
onRemovePress={handleRemoveAttachment}
|
|
338
|
-
/>
|
|
339
|
-
)}
|
|
340
|
-
</View>
|
|
341
|
-
) : (
|
|
342
|
-
<Button
|
|
343
|
-
title="Attach a screenshot or recording"
|
|
344
|
-
accessibilityHint="Opens your device's image gallery"
|
|
345
|
-
iconNameLeft="general.paperclip"
|
|
346
|
-
onPress={pickImage}
|
|
347
|
-
size="sm"
|
|
348
|
-
variant="outline"
|
|
349
|
-
style={styles.attachButton}
|
|
350
|
-
disabled={uploading || Boolean(attachment)}
|
|
351
|
-
/>
|
|
352
|
-
)}
|
|
293
|
+
<View style={styles.textInputContainer}>
|
|
294
|
+
<Text style={styles.fieldLabel}>
|
|
295
|
+
What did you expect to happen? Please describe what actually happened.{' '}
|
|
296
|
+
<Text style={styles.required}>*</Text>
|
|
297
|
+
</Text>
|
|
298
|
+
<TextInput
|
|
299
|
+
style={styles.textInput}
|
|
300
|
+
multiline
|
|
301
|
+
placeholder="Description"
|
|
302
|
+
value={whatExpected}
|
|
303
|
+
onChangeText={setWhatExpected}
|
|
304
|
+
maxLength={MAX_DESCRIPTION_LENGTH}
|
|
305
|
+
/>
|
|
306
|
+
{whatExpected.length >= MAX_DESCRIPTION_LENGTH - 100 && (
|
|
353
307
|
<Text variant="footnote">
|
|
354
|
-
|
|
355
|
-
<TextInlineButton
|
|
356
|
-
accessibilityRole="link"
|
|
357
|
-
variant="footnote"
|
|
358
|
-
onPress={() => Linking.openURL(VIDEO_RECORDING_HELP_URL)}
|
|
359
|
-
>
|
|
360
|
-
How to record your screen
|
|
361
|
-
</TextInlineButton>
|
|
308
|
+
{whatExpected.length}/{MAX_DESCRIPTION_LENGTH}
|
|
362
309
|
</Text>
|
|
363
|
-
|
|
310
|
+
)}
|
|
311
|
+
</View>
|
|
364
312
|
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
<
|
|
369
|
-
accessibilityRole="link"
|
|
370
|
-
variant="footnote"
|
|
371
|
-
onPress={() => Linking.openURL('https://www.planningcenter.com/privacy')}
|
|
372
|
-
>
|
|
373
|
-
Privacy Policy
|
|
374
|
-
</TextInlineButton>
|
|
375
|
-
.
|
|
313
|
+
<View style={styles.attachmentSection}>
|
|
314
|
+
<View style={styles.attachmentHeader}>
|
|
315
|
+
<Text style={styles.attachmentLabel}>
|
|
316
|
+
Attachment <Text style={styles.subLabel}>(optional)</Text>
|
|
376
317
|
</Text>
|
|
318
|
+
{uploading && <Spinner />}
|
|
377
319
|
</View>
|
|
378
|
-
|
|
379
|
-
|
|
320
|
+
{uploadError && <Text style={styles.attachmentErrorText}>{uploadError}</Text>}
|
|
321
|
+
{attachment ? (
|
|
322
|
+
<View style={styles.attachmentPreviewContainer}>
|
|
323
|
+
{isImageAttachment ? (
|
|
324
|
+
<ImageAttachmentPreview
|
|
325
|
+
uri={imagePreviewURI}
|
|
326
|
+
fileName={attachment.name}
|
|
327
|
+
onRemovePress={handleRemoveAttachment}
|
|
328
|
+
/>
|
|
329
|
+
) : (
|
|
330
|
+
<VideoAttachmentPreview
|
|
331
|
+
name={attachment.name}
|
|
332
|
+
onRemovePress={handleRemoveAttachment}
|
|
333
|
+
/>
|
|
334
|
+
)}
|
|
335
|
+
</View>
|
|
336
|
+
) : (
|
|
337
|
+
<Button
|
|
338
|
+
title="Attach a screenshot or recording"
|
|
339
|
+
accessibilityHint="Opens your device's image gallery"
|
|
340
|
+
iconNameLeft="general.paperclip"
|
|
341
|
+
onPress={pickImage}
|
|
342
|
+
size="sm"
|
|
343
|
+
variant="outline"
|
|
344
|
+
style={styles.attachButton}
|
|
345
|
+
disabled={uploading || Boolean(attachment)}
|
|
346
|
+
/>
|
|
347
|
+
)}
|
|
348
|
+
<Text variant="footnote">
|
|
349
|
+
Screenshots and screen recordings help us reproduce and fix issues faster.{' '}
|
|
350
|
+
<TextInlineButton
|
|
351
|
+
accessibilityRole="link"
|
|
352
|
+
variant="footnote"
|
|
353
|
+
onPress={() => Linking.openURL(VIDEO_RECORDING_HELP_URL)}
|
|
354
|
+
>
|
|
355
|
+
How to record your screen
|
|
356
|
+
</TextInlineButton>
|
|
357
|
+
</Text>
|
|
358
|
+
</View>
|
|
359
|
+
|
|
360
|
+
<View style={styles.footer}>
|
|
361
|
+
<Text variant="footnote">
|
|
362
|
+
For details on how we process your data and ensure its security, please refer to our{' '}
|
|
363
|
+
<TextInlineButton
|
|
364
|
+
accessibilityRole="link"
|
|
365
|
+
variant="footnote"
|
|
366
|
+
onPress={() => Linking.openURL('https://www.planningcenter.com/privacy')}
|
|
367
|
+
>
|
|
368
|
+
Privacy Policy
|
|
369
|
+
</TextInlineButton>
|
|
370
|
+
.
|
|
371
|
+
</Text>
|
|
372
|
+
</View>
|
|
373
|
+
</KeyboardScrollView>
|
|
380
374
|
)
|
|
381
375
|
}
|
|
382
376
|
|
package/src/screens/conversation_select_recipients/components/__tests__/results_heading.test.tsx
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { fireEvent, render } from '@testing-library/react-native'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import { ResultsHeading } from '../results_heading'
|
|
4
|
+
|
|
5
|
+
const description =
|
|
6
|
+
'You can start direct messages with anyone in your groups and teams. ' +
|
|
7
|
+
"People you don't share a group or team with won't appear here."
|
|
8
|
+
|
|
9
|
+
const renderResultsHeading = (value: string | null) =>
|
|
10
|
+
render(<ResultsHeading description={value} />)
|
|
11
|
+
|
|
12
|
+
describe('ResultsHeading', () => {
|
|
13
|
+
it('shows the description only after the info icon is tapped', () => {
|
|
14
|
+
const view = renderResultsHeading(description)
|
|
15
|
+
|
|
16
|
+
expect(view.getByText('Results')).toBeTruthy()
|
|
17
|
+
expect(view.queryByText(description)).toBeNull()
|
|
18
|
+
|
|
19
|
+
fireEvent.press(view.getByLabelText('Who appears in results'))
|
|
20
|
+
expect(view.getByText(description)).toBeTruthy()
|
|
21
|
+
|
|
22
|
+
fireEvent.press(view.getByLabelText('Who appears in results'))
|
|
23
|
+
expect(view.queryByText(description)).toBeNull()
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
it('hides the info icon when the server sends no description', () => {
|
|
27
|
+
const view = renderResultsHeading(null)
|
|
28
|
+
|
|
29
|
+
expect(view.getByText('Results')).toBeTruthy()
|
|
30
|
+
expect(view.queryByLabelText('Who appears in results')).toBeNull()
|
|
31
|
+
})
|
|
32
|
+
})
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
2
|
+
import { StyleSheet, View } from 'react-native'
|
|
3
|
+
import { Banner } from '../../../components/display/banner'
|
|
4
|
+
import { IconButton } from '../../../components/display/icon_button'
|
|
5
|
+
import { Text } from '../../../components/display/text'
|
|
6
|
+
|
|
7
|
+
interface ResultsHeadingProps {
|
|
8
|
+
description: string | null
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function ResultsHeading({ description }: ResultsHeadingProps) {
|
|
12
|
+
const [descriptionVisible, setDescriptionVisible] = useState(false)
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<View style={styles.container}>
|
|
16
|
+
<View style={styles.headingRow}>
|
|
17
|
+
<Text style={styles.heading}>Results</Text>
|
|
18
|
+
{description && (
|
|
19
|
+
<IconButton
|
|
20
|
+
name="general.outlinedInfoCircle"
|
|
21
|
+
size="xs"
|
|
22
|
+
accessibilityLabel="Who appears in results"
|
|
23
|
+
accessibilityState={{ expanded: descriptionVisible }}
|
|
24
|
+
onPress={() => setDescriptionVisible(visible => !visible)}
|
|
25
|
+
/>
|
|
26
|
+
)}
|
|
27
|
+
</View>
|
|
28
|
+
{description && descriptionVisible && (
|
|
29
|
+
<Banner appearance="neutral" description={description} />
|
|
30
|
+
)}
|
|
31
|
+
</View>
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const styles = StyleSheet.create({
|
|
36
|
+
container: {
|
|
37
|
+
paddingHorizontal: 16,
|
|
38
|
+
paddingTop: 16,
|
|
39
|
+
paddingBottom: 8,
|
|
40
|
+
gap: 8,
|
|
41
|
+
},
|
|
42
|
+
headingRow: {
|
|
43
|
+
flexDirection: 'row',
|
|
44
|
+
alignItems: 'center',
|
|
45
|
+
gap: 4,
|
|
46
|
+
},
|
|
47
|
+
heading: {
|
|
48
|
+
fontWeight: '600',
|
|
49
|
+
},
|
|
50
|
+
})
|
|
@@ -13,6 +13,7 @@ import { useDirectMessageConversationValidate } from '../../hooks/direct_message
|
|
|
13
13
|
import { useFindOrCreateDirectMessageConversation } from '../../hooks/direct_messages/use_find_or_create_direct_message_conversation'
|
|
14
14
|
import { availableFeatures, useFeatures } from '../../hooks/use_features'
|
|
15
15
|
import { DirectMessageCandidateResource } from '../../types/resources/direct_message_candidate'
|
|
16
|
+
import { ResultsHeading } from './components/results_heading'
|
|
16
17
|
import { ConversationSelectRecipientsScreenProps } from './types/screen_props'
|
|
17
18
|
|
|
18
19
|
const MAX_RECIPIENTS = 9
|
|
@@ -224,7 +225,7 @@ function CandidateResults({
|
|
|
224
225
|
}) {
|
|
225
226
|
const styles = useStyles()
|
|
226
227
|
const { data, isFetching } = useDirectMessageCandidates(term)
|
|
227
|
-
const { groups, teams } = useDirectMessageAffiliations()
|
|
228
|
+
const { groups, teams, resultsDescription } = useDirectMessageAffiliations()
|
|
228
229
|
|
|
229
230
|
if (term.length < 1) {
|
|
230
231
|
if (selectedPeople.size > 0) return null
|
|
@@ -279,6 +280,7 @@ function CandidateResults({
|
|
|
279
280
|
<CandidateList
|
|
280
281
|
candidates={unselectedCandidates}
|
|
281
282
|
hasTruncated={hasTruncated}
|
|
283
|
+
description={resultsDescription}
|
|
282
284
|
groups={groups}
|
|
283
285
|
teams={teams}
|
|
284
286
|
onSelect={onSelect}
|
|
@@ -313,12 +315,14 @@ function candidateAffiliationNames(
|
|
|
313
315
|
function CandidateList({
|
|
314
316
|
candidates,
|
|
315
317
|
hasTruncated,
|
|
318
|
+
description,
|
|
316
319
|
groups,
|
|
317
320
|
teams,
|
|
318
321
|
onSelect,
|
|
319
322
|
}: {
|
|
320
323
|
candidates: DirectMessageCandidateResource[]
|
|
321
324
|
hasTruncated: boolean
|
|
325
|
+
description: string | null
|
|
322
326
|
groups: Map<number, string>
|
|
323
327
|
teams: Map<number, string>
|
|
324
328
|
onSelect: (candidate: DirectMessageCandidateResource) => void
|
|
@@ -340,11 +344,7 @@ function CandidateList({
|
|
|
340
344
|
onSelect={() => onSelect(item)}
|
|
341
345
|
/>
|
|
342
346
|
)}
|
|
343
|
-
ListHeaderComponent={
|
|
344
|
-
<View style={styles.resultsHeader}>
|
|
345
|
-
<Text style={styles.resultsHeading}>Results</Text>
|
|
346
|
-
</View>
|
|
347
|
-
}
|
|
347
|
+
ListHeaderComponent={<ResultsHeading description={description} />}
|
|
348
348
|
ListFooterComponent={
|
|
349
349
|
<>
|
|
350
350
|
{dmDisabled.length > 0 && (
|
|
@@ -505,7 +505,7 @@ const useStyles = () => {
|
|
|
505
505
|
},
|
|
506
506
|
row: {
|
|
507
507
|
flexDirection: 'row',
|
|
508
|
-
alignItems: '
|
|
508
|
+
alignItems: 'center',
|
|
509
509
|
gap: 12,
|
|
510
510
|
paddingHorizontal: 16,
|
|
511
511
|
paddingVertical: 12,
|
|
@@ -534,14 +534,6 @@ const useStyles = () => {
|
|
|
534
534
|
candidateDisabled: {
|
|
535
535
|
opacity: 0.5,
|
|
536
536
|
},
|
|
537
|
-
resultsHeader: {
|
|
538
|
-
paddingHorizontal: 16,
|
|
539
|
-
paddingTop: 16,
|
|
540
|
-
paddingBottom: 8,
|
|
541
|
-
},
|
|
542
|
-
resultsHeading: {
|
|
543
|
-
fontWeight: '600',
|
|
544
|
-
},
|
|
545
537
|
unavailableHeader: {
|
|
546
538
|
paddingHorizontal: 16,
|
|
547
539
|
paddingTop: 16,
|