@planningcenter/chat-react-native 3.45.1-qa-897.0 → 4.0.0-rc.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/build/components/conversation/attachments/video_attachment.js +2 -2
- package/build/components/conversation/attachments/video_attachment.js.map +1 -1
- 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/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/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/hooks/direct_messages/use_direct_message_affiliations.ts +4 -2
- 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/types/resources/direct_message_affiliations.ts +1 -0
- package/src/utils/native_adapters/video.ts +1 -4
|
@@ -23,12 +23,12 @@ export function VideoAttachment({ attachment, onMessageAttachmentLongPress, isDe
|
|
|
23
23
|
setIsOpen(true);
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function closeVideo() {
|
|
27
27
|
videoRef.current?.pause();
|
|
28
28
|
setIsOpen(false);
|
|
29
29
|
}
|
|
30
30
|
const viewRef = useRef(null);
|
|
31
|
-
return (_jsx(View, { style: styles.container, ref: viewRef, children: _jsxs(PlatformPressable, { onPress: openVideo, onLongPress: () => !isDeleting && onMessageAttachmentLongPress(attachment), android_ripple: { color: colors.androidRippleNeutral, foreground: true }, accessibilityLabel: "Play Video", accessibilityHint: "Press to play video. Long press for more options", disabled: isDeleting, children: [_jsx(View, { style: styles.thumbnailOverlay }), _jsx(Video.Player, { ref: videoRef, source: { uri: url }, aspectRatio: width / height, style: styles.video,
|
|
31
|
+
return (_jsx(View, { style: styles.container, ref: viewRef, children: _jsxs(PlatformPressable, { onPress: openVideo, onLongPress: () => !isDeleting && onMessageAttachmentLongPress(attachment), android_ripple: { color: colors.androidRippleNeutral, foreground: true }, accessibilityLabel: "Play Video", accessibilityHint: "Press to play video. Long press for more options", disabled: isDeleting, children: [_jsx(View, { style: styles.thumbnailOverlay }), _jsx(Video.Player, { ref: videoRef, source: { uri: url }, aspectRatio: width / height, style: styles.video, onFullscreenDismiss: closeVideo }), !isOpen && !isDeleting && (_jsx(View, { style: styles.playContainer, children: _jsx(View, { style: styles.playCircle, children: _jsx(Icon, { name: "services.play", style: styles.playIcon, accessibilityElementsHidden: true }) }) })), isDeleting && _jsx(AttachmentDeletingOverlay, {})] }) }));
|
|
32
32
|
}
|
|
33
33
|
const OVERLAY_Z_INDEX = 1;
|
|
34
34
|
const useStyles = () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"video_attachment.js","sourceRoot":"","sources":["../../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AA;YACvB,SAAS,CAAC,IAAI,CAAC,CAAA;QACjB,CAAC;IACH,CAAC;IAED,SAAS,
|
|
1
|
+
{"version":3,"file":"video_attachment.js","sourceRoot":"","sources":["../../../../src/components/conversation/attachments/video_attachment.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAc,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC/C,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAEzC,OAAO,EAAE,KAAK,EAAqB,MAAM,gCAAgC,CAAA;AACzE,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAA;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AACpC,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAA;AACzE,OAAO,EAAE,+BAA+B,EAAE,MAAM,aAAa,CAAA;AAE7D,MAAM,UAAU,eAAe,CAAC,EAC9B,UAAU,EACV,4BAA4B,EAC5B,UAAU,GAKX;IACC,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,CAAA;IAC7B,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAE1B,MAAM,EAAE,UAAU,EAAE,GAAG,UAAU,CAAA;IACjC,MAAM,EAAE,KAAK,GAAG,+BAA+B,EAAE,MAAM,GAAG,+BAA+B,EAAE,GACzF,UAAU,CAAC,QAAQ,IAAI,EAAE,CAAA;IAC3B,MAAM,EAAE,GAAG,EAAE,GAAG,UAAU,CAAA;IAE1B,MAAM,QAAQ,GAAG,MAAM,CAAoB,IAAI,CAAC,CAAA;IAChD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IAE3C,SAAS,SAAS;QAChB,IAAI,CAAC,MAAM,IAAI,QAA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AW,EAAE,CAAC;SACf;QACD,QAAQ,EAAE;YACR,QAAQ,EAAE,EAAE;SACb;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { PlatformPressable } from '@react-navigation/elements'\nimport React, { useRef, useState } from 'react'\nimport { View, StyleSheet } from 'react-native'\nimport { useTheme } from '../../../hooks'\nimport { DenormalizedMessageAttachmentResource } from '../../../types/resources/denormalized_attachment_resource'\nimport { Video, VideoPlayerHandle } from '../../../utils/native_adapters'\nimport { tokens } from '../../../vendor/tapestry/tokens'\nimport { Icon } from '../../display'\nimport { AttachmentDeletingOverlay } from './attachment_deleting_overlay'\nimport { MESSAGE_ATTACHMENT_WIDTH_SINGLE } from './constants'\n\nexport function VideoAttachment({\n attachment,\n onMessageAttachmentLongPress,\n isDeleting,\n}: {\n attachment: DenormalizedMessageAttachmentResource\n onMessageAttachmentLongPress: (attachment: DenormalizedMessageAttachmentResource) => void\n isDeleting: boolean\n}) {\n const { colors } = useTheme()\n const styles = useStyles()\n\n const { attributes } = attachment\n const { width = MESSAGE_ATTACHMENT_WIDTH_SINGLE, height = MESSAGE_ATTACHMENT_WIDTH_SINGLE } =\n attributes.metadata || {}\n const { url } = attributes\n\n const videoRef = useRef<VideoPlayerHandle>(null)\n const [isOpen, setIsOpen] = useState(false)\n\n function openVideo() {\n if (!isOpen && videoRef.current) {\n videoRef.current.presentFullscreenPlayer()\n videoRef.current.play()\n setIsOpen(true)\n }\n }\n\n function closeVideo() {\n videoRef.current?.pause()\n setIsOpen(false)\n }\n\n const viewRef = useRef<View>(null)\n\n return (\n <View style={styles.container} ref={viewRef}>\n <PlatformPressable\n onPress={openVideo}\n onLongPress={() => !isDeleting && onMessageAttachmentLongPress(attachment)}\n android_ripple={{ color: colors.androidRippleNeutral, foreground: true }}\n accessibilityLabel=\"Play Video\"\n accessibilityHint=\"Press to play video. Long press for more options\"\n disabled={isDeleting}\n >\n <View style={styles.thumbnailOverlay} />\n <Video.Player\n ref={videoRef}\n source={{ uri: url }}\n aspectRatio={width / height}\n style={styles.video}\n onFullscreenDismiss={closeVideo}\n />\n {!isOpen && !isDeleting && (\n <View style={styles.playContainer}>\n <View style={styles.playCircle}>\n <Icon\n name=\"services.play\"\n style={styles.playIcon}\n accessibilityElementsHidden={true}\n />\n </View>\n </View>\n )}\n {isDeleting && <AttachmentDeletingOverlay />}\n </PlatformPressable>\n </View>\n )\n}\nconst OVERLAY_Z_INDEX = 1\n\nconst useStyles = () => {\n const { colors } = useTheme()\n const overlayBackgroundColor =\n colors.name === 'light'\n ? tokens.fillColorTransparencyDark010\n : tokens.fillColorTransparencyDark030\n\n return StyleSheet.create({\n container: {\n borderRadius: 8,\n overflow: 'hidden',\n },\n video: {\n width: '100%',\n backgroundColor: colors.fillColorNeutral070,\n },\n thumbnailOverlay: {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n backgroundColor: overlayBackgroundColor,\n zIndex: OVERLAY_Z_INDEX,\n },\n playContainer: {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n justifyContent: 'center',\n alignItems: 'center',\n zIndex: OVERLAY_Z_INDEX + 1,\n },\n playCircle: {\n justifyContent: 'center',\n alignItems: 'center',\n width: 42,\n height: 42,\n borderRadius: 25,\n backgroundColor: colors.fillColorNeutral100Inverted,\n borderColor: colors.borderColorDefaultBase,\n borderWidth: 1,\n },\n playIcon: {\n fontSize: 20,\n },\n })\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use_direct_message_affiliations.d.ts","sourceRoot":"","sources":["../../../src/hooks/direct_messages/use_direct_message_affiliations.ts"],"names":[],"mappings":"AAMA,wBAAgB,4BAA4B
|
|
1
|
+
{"version":3,"file":"use_direct_message_affiliations.d.ts","sourceRoot":"","sources":["../../../src/hooks/direct_messages/use_direct_message_affiliations.ts"],"names":[],"mappings":"AAMA,wBAAgB,4BAA4B;;;;EAkC3C"}
|
|
@@ -8,13 +8,14 @@ export function useDirectMessageAffiliations() {
|
|
|
8
8
|
queryFn: () => apiClient.chat.get({
|
|
9
9
|
url: '/me/direct_message_affiliations',
|
|
10
10
|
data: {
|
|
11
|
-
fields: { DirectMessageAffiliations: ['groups', 'teams'] },
|
|
11
|
+
fields: { DirectMessageAffiliations: ['groups', 'teams', 'results_description'] },
|
|
12
12
|
},
|
|
13
13
|
}),
|
|
14
14
|
staleTime: 5 * 60 * 1000,
|
|
15
15
|
});
|
|
16
16
|
const groups = useMemo(() => new Map(Object.entries(data?.data?.groups ?? {}).map(([id, name]) => [+id, name])), [data]);
|
|
17
17
|
const teams = useMemo(() => new Map(Object.entries(data?.data?.teams ?? {}).map(([id, name]) => [+id, name])), [data]);
|
|
18
|
-
|
|
18
|
+
const resultsDescription = data?.data?.resultsDescription ?? null;
|
|
19
|
+
return { groups, teams, resultsDescription };
|
|
19
20
|
}
|
|
20
21
|
//# sourceMappingURL=use_direct_message_affiliations.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use_direct_message_affiliations.js","sourceRoot":"","sources":["../../../src/hooks/direct_messages/use_direct_message_affiliations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAG/B,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAEhD,MAAM,UAAU,4BAA4B;IAC1C,MAAM,SAAS,GAAG,YAAY,EAAE,CAAA;IAEhC,MAAM,EAAE,IAAI,EAAE,GAAG,QAAQ,CAAC;QACxB,QAAQ,EAAE,CAAC,MAAM,EAAE,iCAAiC,CAAC;QACrD,OAAO,EAAE,GAAG,EAAE,CACZ,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC;YACjB,GAAG,EAAE,iCAAiC;YACtC,IAAI,EAAE;gBACJ,MAAM,EAAE,EAAE,yBAAyB,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE;
|
|
1
|
+
{"version":3,"file":"use_direct_message_affiliations.js","sourceRoot":"","sources":["../../../src/hooks/direct_messages/use_direct_message_affiliations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAG/B,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAEhD,MAAM,UAAU,4BAA4B;IAC1C,MAAM,SAAS,GAAG,YAAY,EAAE,CAAA;IAEhC,MAAM,EAAE,IAAI,EAAE,GAAG,QAAQ,CAAC;QACxB,QAAQ,EAAE,CAAC,MAAM,EAAE,iCAAiC,CAAC;QACrD,OAAO,EAAE,GAAG,EAAE,CACZ,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC;YACjB,GAAG,EAAE,iCAAiC;YACtC,IAAI,EAAE;gBACJ,MAAM,EAAE,EAAE,yBAAyB,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,qBAAqB,CAAC,EAAE;aAClF;SACF,CAA4D;QAC/D,SAAS,EAAE,CAAC,GAAG,EAAE,GAAG,IAAI;KACzB,CAAC,CAAA;IAEF,MAAM,MAAM,GAAG,OAAO,CACpB,GAAG,EAAE,CACH,IAAI,GAAG,CACL,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC,CAC1E,EACH,CAAC,IAAI,CAAC,CACP,CAAA;IAED,MAAM,KAAK,GAAG,OAAO,CACnB,GAAG,EAAE,CACH,IAAI,GAAG,CACL,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC,CACzE,EACH,CAAC,IAAI,CAAC,CACP,CAAA;IAED,MAAM,kBAAkB,GAAG,IAAI,EAAE,IAAI,EAAE,kBAAkB,IAAI,IAAI,CAAA;IAEjE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,kBAAkB,EAAE,CAAA;AAC9C,CAAC","sourcesContent":["import { useQuery } from '@tanstack/react-query'\nimport { useMemo } from 'react'\nimport { ApiResource } from '../../types'\nimport { DirectMessageAffiliationsResource } from '../../types/resources/direct_message_affiliations'\nimport { useApiClient } from '../use_api_client'\n\nexport function useDirectMessageAffiliations() {\n const apiClient = useApiClient()\n\n const { data } = useQuery({\n queryKey: ['chat', '/me/direct_message_affiliations'],\n queryFn: () =>\n apiClient.chat.get({\n url: '/me/direct_message_affiliations',\n data: {\n fields: { DirectMessageAffiliations: ['groups', 'teams', 'results_description'] },\n },\n }) as Promise<ApiResource<DirectMessageAffiliationsResource>>,\n staleTime: 5 * 60 * 1000,\n })\n\n const groups = useMemo(\n () =>\n new Map<number, string>(\n Object.entries(data?.data?.groups ?? {}).map(([id, name]) => [+id, name])\n ),\n [data]\n )\n\n const teams = useMemo(\n () =>\n new Map<number, string>(\n Object.entries(data?.data?.teams ?? {}).map(([id, name]) => [+id, name])\n ),\n [data]\n )\n\n const resultsDescription = data?.data?.resultsDescription ?? null\n\n return { groups, teams, resultsDescription }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"results_heading.d.ts","sourceRoot":"","sources":["../../../../src/screens/conversation_select_recipients/components/results_heading.tsx"],"names":[],"mappings":"AAMA,UAAU,mBAAmB;IAC3B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;CAC3B;AAED,wBAAgB,cAAc,CAAC,EAAE,WAAW,EAAE,EAAE,mBAAmB,2CAsBlE"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { StyleSheet, View } from 'react-native';
|
|
4
|
+
import { Banner } from '../../../components/display/banner';
|
|
5
|
+
import { IconButton } from '../../../components/display/icon_button';
|
|
6
|
+
import { Text } from '../../../components/display/text';
|
|
7
|
+
export function ResultsHeading({ description }) {
|
|
8
|
+
const [descriptionVisible, setDescriptionVisible] = useState(false);
|
|
9
|
+
return (_jsxs(View, { style: styles.container, children: [_jsxs(View, { style: styles.headingRow, children: [_jsx(Text, { style: styles.heading, children: "Results" }), description && (_jsx(IconButton, { name: "general.outlinedInfoCircle", size: "xs", accessibilityLabel: "Who appears in results", accessibilityState: { expanded: descriptionVisible }, onPress: () => setDescriptionVisible(visible => !visible) }))] }), description && descriptionVisible && (_jsx(Banner, { appearance: "neutral", description: description }))] }));
|
|
10
|
+
}
|
|
11
|
+
const styles = StyleSheet.create({
|
|
12
|
+
container: {
|
|
13
|
+
paddingHorizontal: 16,
|
|
14
|
+
paddingTop: 16,
|
|
15
|
+
paddingBottom: 8,
|
|
16
|
+
gap: 8,
|
|
17
|
+
},
|
|
18
|
+
headingRow: {
|
|
19
|
+
flexDirection: 'row',
|
|
20
|
+
alignItems: 'center',
|
|
21
|
+
gap: 4,
|
|
22
|
+
},
|
|
23
|
+
heading: {
|
|
24
|
+
fontWeight: '600',
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
//# sourceMappingURL=results_heading.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"results_heading.js","sourceRoot":"","sources":["../../../../src/screens/conversation_select_recipients/components/results_heading.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAChC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAA;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,yCAAyC,CAAA;AACpE,OAAO,EAAE,IAAI,EAAE,MAAM,kCAAkC,CAAA;AAMvD,MAAM,UAAU,cAAc,CAAC,EAAE,WAAW,EAAuB;IACjE,MAAM,CAAC,kBAAkB,EAAE,qBAAqB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IAEnE,OAAO,CACL,MAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,SAAS,aAC3B,MAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,UAAU,aAC5B,KAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,OAAO,wBAAgB,EAC1C,WAAW,IAAI,CACd,KAAC,UAAU,IACT,IAAI,EAAC,4BAA4B,EACjC,IAAI,EAAC,IAAI,EACT,kBAAkB,EAAC,wBAAwB,EAC3C,kBAAkB,EAAE,EAAE,QAAQ,EAAE,kBAAkB,EAAE,EACpD,OAAO,EAAE,GAAG,EAAE,CAAC,qBAAqB,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,GACzD,CACH,IACI,EACN,WAAW,IAAI,kBAAkB,IAAI,CACpC,KAAC,MAAM,IAAC,UAAU,EAAC,SAAS,EAAC,WAAW,EAAE,WAAW,GAAI,CAC1D,IACI,CACR,CAAA;AACH,CAAC;AAED,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,SAAS,EAAE;QACT,iBAAiB,EAAE,EAAE;QACrB,UAAU,EAAE,EAAE;QACd,aAAa,EAAE,CAAC;QAChB,GAAG,EAAE,CAAC;KACP;IACD,UAAU,EAAE;QACV,aAAa,EAAE,KAAK;QACpB,UAAU,EAAE,QAAQ;QACpB,GAAG,EAAE,CAAC;KACP;IACD,OAAO,EAAE;QACP,UAAU,EAAE,KAAK;KAClB;CACF,CAAC,CAAA","sourcesContent":["import { useState } from 'react'\nimport { StyleSheet, View } from 'react-native'\nimport { Banner } from '../../../components/display/banner'\nimport { IconButton } from '../../../components/display/icon_button'\nimport { Text } from '../../../components/display/text'\n\ninterface ResultsHeadingProps {\n description: string | null\n}\n\nexport function ResultsHeading({ description }: ResultsHeadingProps) {\n const [descriptionVisible, setDescriptionVisible] = useState(false)\n\n return (\n <View style={styles.container}>\n <View style={styles.headingRow}>\n <Text style={styles.heading}>Results</Text>\n {description && (\n <IconButton\n name=\"general.outlinedInfoCircle\"\n size=\"xs\"\n accessibilityLabel=\"Who appears in results\"\n accessibilityState={{ expanded: descriptionVisible }}\n onPress={() => setDescriptionVisible(visible => !visible)}\n />\n )}\n </View>\n {description && descriptionVisible && (\n <Banner appearance=\"neutral\" description={description} />\n )}\n </View>\n )\n}\n\nconst styles = StyleSheet.create({\n container: {\n paddingHorizontal: 16,\n paddingTop: 16,\n paddingBottom: 8,\n gap: 8,\n },\n headingRow: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 4,\n },\n heading: {\n fontWeight: '600',\n },\n})\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation_select_direct_message_recipients_screen.d.ts","sourceRoot":"","sources":["../../../src/screens/conversation_select_recipients/conversation_select_direct_message_recipients_screen.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"conversation_select_direct_message_recipients_screen.d.ts","sourceRoot":"","sources":["../../../src/screens/conversation_select_recipients/conversation_select_direct_message_recipients_screen.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAE,uCAAuC,EAAE,MAAM,sBAAsB,CAAA;AAI9E,wBAAgB,+CAA+C,CAAC,EAC9D,KAAK,GACN,EAAE,uCAAuC,2CAwHzC"}
|
|
@@ -13,6 +13,7 @@ import { useDirectMessageCandidates } from '../../hooks/direct_messages/use_dire
|
|
|
13
13
|
import { useDirectMessageConversationValidate } from '../../hooks/direct_messages/use_direct_message_conversation_validate';
|
|
14
14
|
import { useFindOrCreateDirectMessageConversation } from '../../hooks/direct_messages/use_find_or_create_direct_message_conversation';
|
|
15
15
|
import { availableFeatures, useFeatures } from '../../hooks/use_features';
|
|
16
|
+
import { ResultsHeading } from './components/results_heading';
|
|
16
17
|
const MAX_RECIPIENTS = 9;
|
|
17
18
|
export function ConversationSelectDirectMessageRecipientsScreen({ route, }) {
|
|
18
19
|
const { preselected_people = [] } = route.params ?? {};
|
|
@@ -91,7 +92,7 @@ function PersonChip({ person, onRemove, }) {
|
|
|
91
92
|
function CandidateResults({ term, selectedPeople, onSelect, }) {
|
|
92
93
|
const styles = useStyles();
|
|
93
94
|
const { data, isFetching } = useDirectMessageCandidates(term);
|
|
94
|
-
const { groups, teams } = useDirectMessageAffiliations();
|
|
95
|
+
const { groups, teams, resultsDescription } = useDirectMessageAffiliations();
|
|
95
96
|
if (term.length < 1) {
|
|
96
97
|
if (selectedPeople.size > 0)
|
|
97
98
|
return null;
|
|
@@ -109,7 +110,7 @@ function CandidateResults({ term, selectedPeople, onSelect, }) {
|
|
|
109
110
|
if (!isFetching && unselectedCandidates.length === 0) {
|
|
110
111
|
return (_jsxs(View, { style: styles.emptyState, children: [_jsx(Icon, { name: "general.search", size: 32, style: styles.emptyStateIcon }), _jsxs(Text, { style: styles.emptyStateTitle, children: ["No matches for \"", term, "\""] }), _jsx(Text, { variant: "secondary", style: styles.emptyStateSubtitle, children: "Try a different name, or check that you share a group or team with them." })] }));
|
|
111
112
|
}
|
|
112
|
-
return (_jsx(CandidateList, { candidates: unselectedCandidates, hasTruncated: hasTruncated, groups: groups, teams: teams, onSelect: onSelect }));
|
|
113
|
+
return (_jsx(CandidateList, { candidates: unselectedCandidates, hasTruncated: hasTruncated, description: resultsDescription, groups: groups, teams: teams, onSelect: onSelect }));
|
|
113
114
|
}
|
|
114
115
|
function candidateBadges(candidate) {
|
|
115
116
|
const badges = [];
|
|
@@ -131,11 +132,11 @@ function candidateAffiliationNames(candidate, groups, teams) {
|
|
|
131
132
|
}),
|
|
132
133
|
];
|
|
133
134
|
}
|
|
134
|
-
function CandidateList({ candidates, hasTruncated, groups, teams, onSelect, }) {
|
|
135
|
+
function CandidateList({ candidates, hasTruncated, description, groups, teams, onSelect, }) {
|
|
135
136
|
const styles = useStyles();
|
|
136
137
|
const available = candidates.filter(c => !c.directMessagesDisabled);
|
|
137
138
|
const dmDisabled = candidates.filter(c => c.directMessagesDisabled);
|
|
138
|
-
return (_jsx(FlatList, { data: available, keyboardShouldPersistTaps: "handled", keyExtractor: item => item.id, renderItem: ({ item }) => (_jsx(CandidateItem, { candidate: item, badges: candidateBadges(item), affiliationNames: candidateAffiliationNames(item, groups, teams), onSelect: () => onSelect(item) })), ListHeaderComponent: _jsx(
|
|
139
|
+
return (_jsx(FlatList, { data: available, keyboardShouldPersistTaps: "handled", keyExtractor: item => item.id, renderItem: ({ item }) => (_jsx(CandidateItem, { candidate: item, badges: candidateBadges(item), affiliationNames: candidateAffiliationNames(item, groups, teams), onSelect: () => onSelect(item) })), ListHeaderComponent: _jsx(ResultsHeading, { description: description }), ListFooterComponent: _jsxs(_Fragment, { children: [dmDisabled.length > 0 && (_jsxs(_Fragment, { children: [_jsx(View, { style: styles.unavailableHeader, children: _jsx(Text, { variant: "secondary", style: styles.unavailableLabel, children: "Unavailable for direct messages" }) }), dmDisabled.map(candidate => (_jsx(CandidateItem, { candidate: candidate, badges: candidateBadges(candidate), affiliationNames: candidateAffiliationNames(candidate, groups, teams), disabled: true }, candidate.id)))] })), hasTruncated && (_jsx(View, { style: styles.truncatedFooter, children: _jsx(Text, { variant: "secondary", style: styles.truncatedText, children: "Keep typing to narrow your results." }) }))] }) }));
|
|
139
140
|
}
|
|
140
141
|
function CandidateItem({ candidate, badges, affiliationNames, onSelect, disabled = false, }) {
|
|
141
142
|
const styles = useStyles();
|
|
@@ -223,7 +224,7 @@ const useStyles = () => {
|
|
|
223
224
|
},
|
|
224
225
|
row: {
|
|
225
226
|
flexDirection: 'row',
|
|
226
|
-
alignItems: '
|
|
227
|
+
alignItems: 'center',
|
|
227
228
|
gap: 12,
|
|
228
229
|
paddingHorizontal: 16,
|
|
229
230
|
paddingVertical: 12,
|
|
@@ -251,14 +252,6 @@ const useStyles = () => {
|
|
|
251
252
|
candidateDisabled: {
|
|
252
253
|
opacity: 0.5,
|
|
253
254
|
},
|
|
254
|
-
resultsHeader: {
|
|
255
|
-
paddingHorizontal: 16,
|
|
256
|
-
paddingTop: 16,
|
|
257
|
-
paddingBottom: 8,
|
|
258
|
-
},
|
|
259
|
-
resultsHeading: {
|
|
260
|
-
fontWeight: '600',
|
|
261
|
-
},
|
|
262
255
|
unavailableHeader: {
|
|
263
256
|
paddingHorizontal: 16,
|
|
264
257
|
paddingTop: 16,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation_select_direct_message_recipients_screen.js","sourceRoot":"","sources":["../../../src/screens/conversation_select_recipients/conversation_select_direct_message_recipients_screen.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACtE,OAAO,EAAa,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC9D,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAa,IAAI,EAAE,MAAM,cAAc,CAAA;AAC/E,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAC3F,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAA;AACrE,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAA;AAC7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAA;AACvF,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,4BAA4B,EAAE,MAAM,6DAA6D,CAAA;AAC1G,OAAO,EAAE,0BAA0B,EAAE,MAAM,2DAA2D,CAAA;AACtG,OAAO,EAAE,oCAAoC,EAAE,MAAM,sEA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;QACD,GAAG,EAAE;YACH,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,YAAY;YACxB,GAAG,EAAE,EAAE;YACP,iBAAiB,EAAE,EAAE;YACrB,eAAe,EAAE,EAAE;YACnB,iBAAiB,EAAE,CAAC;YACpB,WAAW,EAAE,MAAM,CAAC,qBAAqB;SAC1C;QACD,OAAO,EAAE;YACP,IAAI,EAAE,CAAC;YACP,GAAG,EAAE,CAAC;SACP;QACD,OAAO,EAAE;YACP,QAAQ,EAAE,EAAE;YACZ,UAAU,EAAE,KAAK;SAClB;QACD,eAAe,EAAE;YACf,QAAQ,EAAE,EAAE;YACZ,KAAK,EAAE,MAAM,CAAC,yBAAyB;SACxC;QACD,QAAQ,EAAE;YACR,aAAa,EAAE,KAAK;YACpB,QAAQ,EAAE,MAAM;YAChB,GAAG,EAAE,CAAC;YACN,SAAS,EAAE,CAAC;SACb;QAED,iBAAiB,EAAE;YACjB,OAAO,EAAE,GAAG;SACb;QACD,aAAa,EAAE;YACb,iBAAiB,EAAE,EAAE;YACrB,UAAU,EAAE,EAAE;YACd,aAAa,EAAE,CAAC;SACjB;QACD,cAAc,EAAE;YACd,UAAU,EAAE,KAAK;SAClB;QACD,iBAAiB,EAAE;YACjB,iBAAiB,EAAE,EAAE;YACrB,UAAU,EAAE,EAAE;YACd,aAAa,EAAE,CAAC;SACjB;QACD,gBAAgB,EAAE;YAChB,QAAQ,EAAE,EAAE;SACb;QACD,eAAe,EAAE;YACf,iBAAiB,EAAE,EAAE;YACrB,UAAU,EAAE,EAAE;YACd,aAAa,EAAE,CAAC;SACjB;QACD,aAAa,EAAE;YACb,QAAQ,EAAE,EAAE;YACZ,SAAS,EAAE,QAAQ;SACpB;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { PlatformPressable } from '@react-navigation/elements'\nimport { StackActions, useNavigation } from '@react-navigation/native'\nimport { RefObject, useEffect, useRef, useState } from 'react'\nimport { FlatList, Pressable, StyleSheet, TextInput, View } from 'react-native'\nimport { Avatar, Badge, Banner, Icon, KeyboardView, Spinner, Text } from '../../components'\nimport { ActionButton } from '../../components/display/action_button'\nimport { AutoFocusAwareTextInput } from '../../components/display/text_input'\nimport { ComponentErrorBoundary } from '../../components/page/component_error_boundary'\nimport { useTheme } from '../../hooks'\nimport { useDirectMessageAffiliations } from '../../hooks/direct_messages/use_direct_message_affiliations'\nimport { useDirectMessageCandidates } from '../../hooks/direct_messages/use_direct_message_candidates'\nimport { useDirectMessageConversationValidate } from '../../hooks/direct_messages/use_direct_message_conversation_validate'\nimport { useFindOrCreateDirectMessageConversation } from '../../hooks/direct_messages/use_find_or_create_direct_message_conversation'\nimport { availableFeatures, useFeatures } from '../../hooks/use_features'\nimport { DirectMessageCandidateResource } from '../../types/resources/direct_message_candidate'\nimport { ConversationSelectRecipientsScreenProps } from './types/screen_props'\n\nconst MAX_RECIPIENTS = 9\n\nexport function ConversationSelectDirectMessageRecipientsScreen({\n route,\n}: ConversationSelectRecipientsScreenProps) {\n const { preselected_people = [] } = route.params ?? {}\n const styles = useStyles()\n const navigation = useNavigation()\n const { featureEnabled } = useFeatures()\n const [searchTerm, setSearchTerm] = useState('')\n const [debouncedTerm, setDebouncedTerm] = useState('')\n const [selectedPeople, setSelectedPeople] = useState<Map<string, DirectMessageCandidateResource>>(\n () =>\n new Map(\n preselected_people.map(person => [\n person.id,\n {\n ...person,\n type: 'DirectMessageCandidate' as const,\n groups: [],\n teams: [],\n under_18: false,\n directMessagesDisabled: false,\n },\n ])\n )\n )\n const searchInputRef = useRef<TextInput>(null)\n\n useEffect(() => {\n const timer = setTimeout(() => setDebouncedTerm(searchTerm), 200)\n return () => clearTimeout(timer)\n }, [searchTerm])\n\n const selectPerson = (person: DirectMessageCandidateResource) => {\n if (selectedPeople.size >= MAX_RECIPIENTS) return\n setSelectedPeople(prev => new Map(prev).set(person.id, person))\n setSearchTerm('')\n setDebouncedTerm('')\n // Controlled TextInput can retain stale native text on iOS when the value\n // is cleared while it stays focused (keyboardShouldPersistTaps keeps it\n // focused through the tap) — clear() forces the native view to sync. Gated\n // so EAP reporters can toggle the fix on their devices to confirm it.\n if (featureEnabled(availableFeatures.dm_search_clear_fix)) {\n searchInputRef.current?.clear()\n }\n }\n\n const removePerson = (id: string) => {\n setSelectedPeople(prev => {\n const next = new Map(prev)\n next.delete(id)\n return next\n })\n }\n\n const recipientIds = [...selectedPeople.keys()]\n const { warnings, validationPending } = useDirectMessageConversationValidate({ recipientIds })\n\n const handleSuccess = (conversationId: number) => {\n navigation.getParent()?.goBack()\n navigation.dispatch(StackActions.push('Conversation', { conversation_id: conversationId }))\n }\n\n const { findOrCreateConversation, directMessageExists, isFinding, isError } =\n useFindOrCreateDirectMessageConversation({ recipientIds, onSuccess: handleSuccess })\n\n const buttonText = (() => {\n if (selectedPeople.size === 0) return 'Start conversation'\n if (selectedPeople.size === 1) {\n const firstName = selectedPeople.values().next().value!.name.split(' ')[0]\n return directMessageExists ? `Open message with ${firstName}` : `Message ${firstName}`\n }\n return directMessageExists\n ? `Open direct message (${selectedPeople.size})`\n : `Start direct message (${selectedPeople.size})`\n })()\n\n return (\n <KeyboardView>\n {isError && (\n <Banner\n appearance=\"error\"\n description=\"There was an issue starting the conversation. Please try again.\"\n style={styles.errorBanner}\n />\n )}\n <ToField\n selectedPeople={selectedPeople}\n searchTerm={searchTerm}\n onSearchChange={setSearchTerm}\n onRemove={removePerson}\n onClear={() => setSelectedPeople(new Map())}\n searchInputRef={searchInputRef}\n />\n <View style={styles.candidateResultsContainer}>\n <ComponentErrorBoundary\n key={debouncedTerm}\n fallback={\n <Banner\n appearance=\"error\"\n description=\"Couldn't load people right now. Try again.\"\n style={styles.errorBanner}\n />\n }\n >\n <CandidateResults\n term={debouncedTerm}\n selectedPeople={selectedPeople}\n onSelect={selectPerson}\n />\n </ComponentErrorBoundary>\n </View>\n <ActionButton\n title={buttonText}\n disabled={\n selectedPeople.size === 0 || validationPending || warnings.length > 0 || isFinding\n }\n loading={validationPending || isFinding}\n onPress={() => findOrCreateConversation(recipientIds)}\n warnings={warnings}\n />\n </KeyboardView>\n )\n}\n\nfunction ToField({\n selectedPeople,\n searchTerm,\n onSearchChange,\n onRemove,\n onClear,\n searchInputRef,\n}: {\n selectedPeople: Map<string, DirectMessageCandidateResource>\n searchTerm: string\n onSearchChange: (term: string) => void\n onRemove: (id: string) => void\n onClear: () => void\n searchInputRef: RefObject<TextInput | null>\n}) {\n const styles = useStyles()\n const { colors } = useTheme()\n const hasSelections = selectedPeople.size > 0\n\n return (\n <View style={styles.toField}>\n <View style={styles.toFieldHeader}>\n <Text style={styles.toLabel}>To</Text>\n {hasSelections && (\n <Pressable onPress={onClear} hitSlop={8}>\n <Text style={styles.clearButton}>Clear</Text>\n </Pressable>\n )}\n </View>\n <View style={styles.toInputArea}>\n {[...selectedPeople.values()].map(person => (\n <PersonChip key={person.id} person={person} onRemove={onRemove} />\n ))}\n <AutoFocusAwareTextInput\n autoFocus\n inputRef={searchInputRef}\n placeholder=\"Search\"\n placeholderTextColor={colors.textColorDefaultPlaceholder}\n value={searchTerm}\n onChangeText={onSearchChange}\n style={styles.toTextInput}\n returnKeyType=\"search\"\n />\n </View>\n </View>\n )\n}\n\nfunction PersonChip({\n person,\n onRemove,\n}: {\n person: DirectMessageCandidateResource\n onRemove: (id: string) => void\n}) {\n const styles = useStyles()\n\n return (\n <View style={styles.chip}>\n <Avatar sourceUri={person.avatar} size=\"sm\" showFallback={!person.avatar} />\n <Text style={styles.chipName}>{person.name}</Text>\n <Pressable\n onPress={() => onRemove(person.id)}\n hitSlop={8}\n accessibilityLabel={`Remove ${person.name}`}\n >\n <Icon name=\"general.x\" size={12} style={styles.chipRemoveIcon} />\n </Pressable>\n </View>\n )\n}\n\nfunction CandidateResults({\n term,\n selectedPeople,\n onSelect,\n}: {\n term: string\n selectedPeople: Map<string, DirectMessageCandidateResource>\n onSelect: (candidate: DirectMessageCandidateResource) => void\n}) {\n const styles = useStyles()\n const { data, isFetching } = useDirectMessageCandidates(term)\n const { groups, teams } = useDirectMessageAffiliations()\n\n if (term.length < 1) {\n if (selectedPeople.size > 0) return null\n\n return (\n <View style={styles.emptyState}>\n <Icon name=\"churchCenter.people\" size={40} style={styles.emptyStateIcon} />\n <Text style={styles.emptyStateTitle}>Search for people to direct message</Text>\n <Text variant=\"secondary\" style={styles.emptyStateSubtitle}>\n Start a conversation with people in your groups and teams.\n </Text>\n </View>\n )\n }\n\n const isAtLimit = selectedPeople.size >= MAX_RECIPIENTS\n\n if (isAtLimit) {\n return (\n <View style={styles.emptyState}>\n <Text variant=\"secondary\" style={styles.emptyStateSubtitle}>\n You can add up to {MAX_RECIPIENTS} people to a direct message.\n </Text>\n </View>\n )\n }\n\n const unselectedCandidates = (data?.data ?? []).filter(c => !selectedPeople.has(c.id))\n const hasTruncated = (data?.meta.totalCount ?? 0) > (data?.data.length ?? 0)\n\n if (isFetching && unselectedCandidates.length === 0) {\n return (\n <View style={styles.emptyState}>\n <Spinner />\n </View>\n )\n }\n\n if (!isFetching && unselectedCandidates.length === 0) {\n return (\n <View style={styles.emptyState}>\n <Icon name=\"general.search\" size={32} style={styles.emptyStateIcon} />\n <Text style={styles.emptyStateTitle}>No matches for \"{term}\"</Text>\n <Text variant=\"secondary\" style={styles.emptyStateSubtitle}>\n Try a different name, or check that you share a group or team with them.\n </Text>\n </View>\n )\n }\n\n return (\n <CandidateList\n candidates={unselectedCandidates}\n hasTruncated={hasTruncated}\n groups={groups}\n teams={teams}\n onSelect={onSelect}\n />\n )\n}\n\nfunction candidateBadges(candidate: DirectMessageCandidateResource) {\n const badges = []\n if (candidate.directMessagesDisabled) badges.push({ title: 'DMs off' })\n if (candidate.under_18) badges.push({ title: 'Under 18' })\n return badges\n}\n\nfunction candidateAffiliationNames(\n candidate: DirectMessageCandidateResource,\n groups: Map<number, string>,\n teams: Map<number, string>\n) {\n return [\n ...candidate.groups.flatMap(id => {\n const name = groups.get(id)\n return name ? [name] : []\n }),\n ...candidate.teams.flatMap(id => {\n const name = teams.get(id)\n return name ? [name] : []\n }),\n ]\n}\n\nfunction CandidateList({\n candidates,\n hasTruncated,\n groups,\n teams,\n onSelect,\n}: {\n candidates: DirectMessageCandidateResource[]\n hasTruncated: boolean\n groups: Map<number, string>\n teams: Map<number, string>\n onSelect: (candidate: DirectMessageCandidateResource) => void\n}) {\n const styles = useStyles()\n const available = candidates.filter(c => !c.directMessagesDisabled)\n const dmDisabled = candidates.filter(c => c.directMessagesDisabled)\n\n return (\n <FlatList<DirectMessageCandidateResource>\n data={available}\n keyboardShouldPersistTaps=\"handled\"\n keyExtractor={item => item.id}\n renderItem={({ item }) => (\n <CandidateItem\n candidate={item}\n badges={candidateBadges(item)}\n affiliationNames={candidateAffiliationNames(item, groups, teams)}\n onSelect={() => onSelect(item)}\n />\n )}\n ListHeaderComponent={\n <View style={styles.resultsHeader}>\n <Text style={styles.resultsHeading}>Results</Text>\n </View>\n }\n ListFooterComponent={\n <>\n {dmDisabled.length > 0 && (\n <>\n <View style={styles.unavailableHeader}>\n <Text variant=\"secondary\" style={styles.unavailableLabel}>\n Unavailable for direct messages\n </Text>\n </View>\n {dmDisabled.map(candidate => (\n <CandidateItem\n key={candidate.id}\n candidate={candidate}\n badges={candidateBadges(candidate)}\n affiliationNames={candidateAffiliationNames(candidate, groups, teams)}\n disabled\n />\n ))}\n </>\n )}\n {hasTruncated && (\n <View style={styles.truncatedFooter}>\n <Text variant=\"secondary\" style={styles.truncatedText}>\n Keep typing to narrow your results.\n </Text>\n </View>\n )}\n </>\n }\n />\n )\n}\n\nfunction CandidateItem({\n candidate,\n badges,\n affiliationNames,\n onSelect,\n disabled = false,\n}: {\n candidate: DirectMessageCandidateResource\n badges: { title: string }[]\n affiliationNames: string[]\n onSelect?: () => void\n disabled?: boolean\n}) {\n const styles = useStyles()\n\n return (\n <PlatformPressable\n onPress={disabled ? undefined : onSelect}\n accessibilityRole=\"button\"\n accessibilityLabel={`Select ${candidate.name}`}\n accessibilityState={{ disabled }}\n >\n <View style={[styles.row, disabled && styles.candidateDisabled]}>\n <Avatar sourceUri={candidate.avatar} size=\"lg\" showFallback={!candidate.avatar} />\n <View style={styles.rowInfo}>\n <Text style={styles.rowName}>{candidate.name}</Text>\n {affiliationNames.length > 0 && (\n <Text style={styles.rowAffiliations} numberOfLines={2}>\n {affiliationNames.join(', ')}\n </Text>\n )}\n {badges.length > 0 && (\n <View style={styles.badgeRow}>\n {badges.map(({ title }) => (\n <Badge key={title} label={title} />\n ))}\n </View>\n )}\n </View>\n </View>\n </PlatformPressable>\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n\n return StyleSheet.create({\n candidateResultsContainer: {\n flex: 1,\n },\n toField: {\n paddingHorizontal: 16,\n paddingTop: 16,\n paddingBottom: 8,\n },\n toFieldHeader: {\n flexDirection: 'row',\n justifyContent: 'space-between',\n alignItems: 'center',\n marginBottom: 8,\n },\n toLabel: {\n fontWeight: '600',\n color: colors.textColorDefaultSecondary,\n },\n clearButton: {\n color: colors.interaction,\n },\n toInputArea: {\n flexDirection: 'row',\n flexWrap: 'wrap',\n alignItems: 'center',\n gap: 6,\n borderWidth: 1,\n borderColor: colors.borderColorDefaultBase,\n borderRadius: 8,\n paddingHorizontal: 10,\n paddingVertical: 8,\n },\n toTextInput: {\n flex: 1,\n minWidth: 80,\n color: colors.textColorDefaultPrimary,\n fontSize: 16,\n paddingVertical: 2,\n },\n chip: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 4,\n borderWidth: 1,\n borderColor: colors.borderColorDefaultBase,\n borderRadius: 100,\n paddingLeft: 4,\n paddingRight: 6,\n paddingVertical: 3,\n },\n chipName: {\n fontSize: 14,\n },\n chipRemoveIcon: {\n color: colors.iconColorDefaultSecondary,\n },\n errorBanner: {\n margin: 16,\n },\n emptyState: {\n alignItems: 'center',\n paddingTop: 32,\n paddingHorizontal: 32,\n gap: 8,\n },\n emptyStateIcon: {\n color: colors.iconColorDefaultSecondary,\n marginBottom: 4,\n },\n emptyStateTitle: {\n fontWeight: '600',\n textAlign: 'center',\n },\n emptyStateSubtitle: {\n textAlign: 'center',\n fontSize: 14,\n },\n row: {\n flexDirection: 'row',\n alignItems: 'flex-start',\n gap: 12,\n paddingHorizontal: 16,\n paddingVertical: 12,\n borderBottomWidth: 1,\n borderColor: colors.borderColorDefaultDim,\n },\n rowInfo: {\n flex: 1,\n gap: 2,\n },\n rowName: {\n fontSize: 15,\n fontWeight: '500',\n },\n rowAffiliations: {\n fontSize: 12,\n color: colors.textColorDefaultSecondary,\n },\n badgeRow: {\n flexDirection: 'row',\n flexWrap: 'wrap',\n gap: 4,\n marginTop: 4,\n },\n\n candidateDisabled: {\n opacity: 0.5,\n },\n resultsHeader: {\n paddingHorizontal: 16,\n paddingTop: 16,\n paddingBottom: 8,\n },\n resultsHeading: {\n fontWeight: '600',\n },\n unavailableHeader: {\n paddingHorizontal: 16,\n paddingTop: 16,\n paddingBottom: 8,\n },\n unavailableLabel: {\n fontSize: 13,\n },\n truncatedFooter: {\n paddingHorizontal: 16,\n paddingTop: 12,\n paddingBottom: 8,\n },\n truncatedText: {\n fontSize: 13,\n textAlign: 'center',\n },\n })\n}\n"]}
|
|
1
|
+
{"version":3,"file":"conversation_select_direct_message_recipients_screen.js","sourceRoot":"","sources":["../../../src/screens/conversation_select_recipients/conversation_select_direct_message_recipients_screen.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACtE,OAAO,EAAa,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC9D,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAa,IAAI,EAAE,MAAM,cAAc,CAAA;AAC/E,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA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;QACD,aAAa,EAAE;YACb,QAAQ,EAAE,EAAE;YACZ,SAAS,EAAE,QAAQ;SACpB;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { PlatformPressable } from '@react-navigation/elements'\nimport { StackActions, useNavigation } from '@react-navigation/native'\nimport { RefObject, useEffect, useRef, useState } from 'react'\nimport { FlatList, Pressable, StyleSheet, TextInput, View } from 'react-native'\nimport { Avatar, Badge, Banner, Icon, KeyboardView, Spinner, Text } from '../../components'\nimport { ActionButton } from '../../components/display/action_button'\nimport { AutoFocusAwareTextInput } from '../../components/display/text_input'\nimport { ComponentErrorBoundary } from '../../components/page/component_error_boundary'\nimport { useTheme } from '../../hooks'\nimport { useDirectMessageAffiliations } from '../../hooks/direct_messages/use_direct_message_affiliations'\nimport { useDirectMessageCandidates } from '../../hooks/direct_messages/use_direct_message_candidates'\nimport { useDirectMessageConversationValidate } from '../../hooks/direct_messages/use_direct_message_conversation_validate'\nimport { useFindOrCreateDirectMessageConversation } from '../../hooks/direct_messages/use_find_or_create_direct_message_conversation'\nimport { availableFeatures, useFeatures } from '../../hooks/use_features'\nimport { DirectMessageCandidateResource } from '../../types/resources/direct_message_candidate'\nimport { ResultsHeading } from './components/results_heading'\nimport { ConversationSelectRecipientsScreenProps } from './types/screen_props'\n\nconst MAX_RECIPIENTS = 9\n\nexport function ConversationSelectDirectMessageRecipientsScreen({\n route,\n}: ConversationSelectRecipientsScreenProps) {\n const { preselected_people = [] } = route.params ?? {}\n const styles = useStyles()\n const navigation = useNavigation()\n const { featureEnabled } = useFeatures()\n const [searchTerm, setSearchTerm] = useState('')\n const [debouncedTerm, setDebouncedTerm] = useState('')\n const [selectedPeople, setSelectedPeople] = useState<Map<string, DirectMessageCandidateResource>>(\n () =>\n new Map(\n preselected_people.map(person => [\n person.id,\n {\n ...person,\n type: 'DirectMessageCandidate' as const,\n groups: [],\n teams: [],\n under_18: false,\n directMessagesDisabled: false,\n },\n ])\n )\n )\n const searchInputRef = useRef<TextInput>(null)\n\n useEffect(() => {\n const timer = setTimeout(() => setDebouncedTerm(searchTerm), 200)\n return () => clearTimeout(timer)\n }, [searchTerm])\n\n const selectPerson = (person: DirectMessageCandidateResource) => {\n if (selectedPeople.size >= MAX_RECIPIENTS) return\n setSelectedPeople(prev => new Map(prev).set(person.id, person))\n setSearchTerm('')\n setDebouncedTerm('')\n // Controlled TextInput can retain stale native text on iOS when the value\n // is cleared while it stays focused (keyboardShouldPersistTaps keeps it\n // focused through the tap) — clear() forces the native view to sync. Gated\n // so EAP reporters can toggle the fix on their devices to confirm it.\n if (featureEnabled(availableFeatures.dm_search_clear_fix)) {\n searchInputRef.current?.clear()\n }\n }\n\n const removePerson = (id: string) => {\n setSelectedPeople(prev => {\n const next = new Map(prev)\n next.delete(id)\n return next\n })\n }\n\n const recipientIds = [...selectedPeople.keys()]\n const { warnings, validationPending } = useDirectMessageConversationValidate({ recipientIds })\n\n const handleSuccess = (conversationId: number) => {\n navigation.getParent()?.goBack()\n navigation.dispatch(StackActions.push('Conversation', { conversation_id: conversationId }))\n }\n\n const { findOrCreateConversation, directMessageExists, isFinding, isError } =\n useFindOrCreateDirectMessageConversation({ recipientIds, onSuccess: handleSuccess })\n\n const buttonText = (() => {\n if (selectedPeople.size === 0) return 'Start conversation'\n if (selectedPeople.size === 1) {\n const firstName = selectedPeople.values().next().value!.name.split(' ')[0]\n return directMessageExists ? `Open message with ${firstName}` : `Message ${firstName}`\n }\n return directMessageExists\n ? `Open direct message (${selectedPeople.size})`\n : `Start direct message (${selectedPeople.size})`\n })()\n\n return (\n <KeyboardView>\n {isError && (\n <Banner\n appearance=\"error\"\n description=\"There was an issue starting the conversation. Please try again.\"\n style={styles.errorBanner}\n />\n )}\n <ToField\n selectedPeople={selectedPeople}\n searchTerm={searchTerm}\n onSearchChange={setSearchTerm}\n onRemove={removePerson}\n onClear={() => setSelectedPeople(new Map())}\n searchInputRef={searchInputRef}\n />\n <View style={styles.candidateResultsContainer}>\n <ComponentErrorBoundary\n key={debouncedTerm}\n fallback={\n <Banner\n appearance=\"error\"\n description=\"Couldn't load people right now. Try again.\"\n style={styles.errorBanner}\n />\n }\n >\n <CandidateResults\n term={debouncedTerm}\n selectedPeople={selectedPeople}\n onSelect={selectPerson}\n />\n </ComponentErrorBoundary>\n </View>\n <ActionButton\n title={buttonText}\n disabled={\n selectedPeople.size === 0 || validationPending || warnings.length > 0 || isFinding\n }\n loading={validationPending || isFinding}\n onPress={() => findOrCreateConversation(recipientIds)}\n warnings={warnings}\n />\n </KeyboardView>\n )\n}\n\nfunction ToField({\n selectedPeople,\n searchTerm,\n onSearchChange,\n onRemove,\n onClear,\n searchInputRef,\n}: {\n selectedPeople: Map<string, DirectMessageCandidateResource>\n searchTerm: string\n onSearchChange: (term: string) => void\n onRemove: (id: string) => void\n onClear: () => void\n searchInputRef: RefObject<TextInput | null>\n}) {\n const styles = useStyles()\n const { colors } = useTheme()\n const hasSelections = selectedPeople.size > 0\n\n return (\n <View style={styles.toField}>\n <View style={styles.toFieldHeader}>\n <Text style={styles.toLabel}>To</Text>\n {hasSelections && (\n <Pressable onPress={onClear} hitSlop={8}>\n <Text style={styles.clearButton}>Clear</Text>\n </Pressable>\n )}\n </View>\n <View style={styles.toInputArea}>\n {[...selectedPeople.values()].map(person => (\n <PersonChip key={person.id} person={person} onRemove={onRemove} />\n ))}\n <AutoFocusAwareTextInput\n autoFocus\n inputRef={searchInputRef}\n placeholder=\"Search\"\n placeholderTextColor={colors.textColorDefaultPlaceholder}\n value={searchTerm}\n onChangeText={onSearchChange}\n style={styles.toTextInput}\n returnKeyType=\"search\"\n />\n </View>\n </View>\n )\n}\n\nfunction PersonChip({\n person,\n onRemove,\n}: {\n person: DirectMessageCandidateResource\n onRemove: (id: string) => void\n}) {\n const styles = useStyles()\n\n return (\n <View style={styles.chip}>\n <Avatar sourceUri={person.avatar} size=\"sm\" showFallback={!person.avatar} />\n <Text style={styles.chipName}>{person.name}</Text>\n <Pressable\n onPress={() => onRemove(person.id)}\n hitSlop={8}\n accessibilityLabel={`Remove ${person.name}`}\n >\n <Icon name=\"general.x\" size={12} style={styles.chipRemoveIcon} />\n </Pressable>\n </View>\n )\n}\n\nfunction CandidateResults({\n term,\n selectedPeople,\n onSelect,\n}: {\n term: string\n selectedPeople: Map<string, DirectMessageCandidateResource>\n onSelect: (candidate: DirectMessageCandidateResource) => void\n}) {\n const styles = useStyles()\n const { data, isFetching } = useDirectMessageCandidates(term)\n const { groups, teams, resultsDescription } = useDirectMessageAffiliations()\n\n if (term.length < 1) {\n if (selectedPeople.size > 0) return null\n\n return (\n <View style={styles.emptyState}>\n <Icon name=\"churchCenter.people\" size={40} style={styles.emptyStateIcon} />\n <Text style={styles.emptyStateTitle}>Search for people to direct message</Text>\n <Text variant=\"secondary\" style={styles.emptyStateSubtitle}>\n Start a conversation with people in your groups and teams.\n </Text>\n </View>\n )\n }\n\n const isAtLimit = selectedPeople.size >= MAX_RECIPIENTS\n\n if (isAtLimit) {\n return (\n <View style={styles.emptyState}>\n <Text variant=\"secondary\" style={styles.emptyStateSubtitle}>\n You can add up to {MAX_RECIPIENTS} people to a direct message.\n </Text>\n </View>\n )\n }\n\n const unselectedCandidates = (data?.data ?? []).filter(c => !selectedPeople.has(c.id))\n const hasTruncated = (data?.meta.totalCount ?? 0) > (data?.data.length ?? 0)\n\n if (isFetching && unselectedCandidates.length === 0) {\n return (\n <View style={styles.emptyState}>\n <Spinner />\n </View>\n )\n }\n\n if (!isFetching && unselectedCandidates.length === 0) {\n return (\n <View style={styles.emptyState}>\n <Icon name=\"general.search\" size={32} style={styles.emptyStateIcon} />\n <Text style={styles.emptyStateTitle}>No matches for \"{term}\"</Text>\n <Text variant=\"secondary\" style={styles.emptyStateSubtitle}>\n Try a different name, or check that you share a group or team with them.\n </Text>\n </View>\n )\n }\n\n return (\n <CandidateList\n candidates={unselectedCandidates}\n hasTruncated={hasTruncated}\n description={resultsDescription}\n groups={groups}\n teams={teams}\n onSelect={onSelect}\n />\n )\n}\n\nfunction candidateBadges(candidate: DirectMessageCandidateResource) {\n const badges = []\n if (candidate.directMessagesDisabled) badges.push({ title: 'DMs off' })\n if (candidate.under_18) badges.push({ title: 'Under 18' })\n return badges\n}\n\nfunction candidateAffiliationNames(\n candidate: DirectMessageCandidateResource,\n groups: Map<number, string>,\n teams: Map<number, string>\n) {\n return [\n ...candidate.groups.flatMap(id => {\n const name = groups.get(id)\n return name ? [name] : []\n }),\n ...candidate.teams.flatMap(id => {\n const name = teams.get(id)\n return name ? [name] : []\n }),\n ]\n}\n\nfunction CandidateList({\n candidates,\n hasTruncated,\n description,\n groups,\n teams,\n onSelect,\n}: {\n candidates: DirectMessageCandidateResource[]\n hasTruncated: boolean\n description: string | null\n groups: Map<number, string>\n teams: Map<number, string>\n onSelect: (candidate: DirectMessageCandidateResource) => void\n}) {\n const styles = useStyles()\n const available = candidates.filter(c => !c.directMessagesDisabled)\n const dmDisabled = candidates.filter(c => c.directMessagesDisabled)\n\n return (\n <FlatList<DirectMessageCandidateResource>\n data={available}\n keyboardShouldPersistTaps=\"handled\"\n keyExtractor={item => item.id}\n renderItem={({ item }) => (\n <CandidateItem\n candidate={item}\n badges={candidateBadges(item)}\n affiliationNames={candidateAffiliationNames(item, groups, teams)}\n onSelect={() => onSelect(item)}\n />\n )}\n ListHeaderComponent={<ResultsHeading description={description} />}\n ListFooterComponent={\n <>\n {dmDisabled.length > 0 && (\n <>\n <View style={styles.unavailableHeader}>\n <Text variant=\"secondary\" style={styles.unavailableLabel}>\n Unavailable for direct messages\n </Text>\n </View>\n {dmDisabled.map(candidate => (\n <CandidateItem\n key={candidate.id}\n candidate={candidate}\n badges={candidateBadges(candidate)}\n affiliationNames={candidateAffiliationNames(candidate, groups, teams)}\n disabled\n />\n ))}\n </>\n )}\n {hasTruncated && (\n <View style={styles.truncatedFooter}>\n <Text variant=\"secondary\" style={styles.truncatedText}>\n Keep typing to narrow your results.\n </Text>\n </View>\n )}\n </>\n }\n />\n )\n}\n\nfunction CandidateItem({\n candidate,\n badges,\n affiliationNames,\n onSelect,\n disabled = false,\n}: {\n candidate: DirectMessageCandidateResource\n badges: { title: string }[]\n affiliationNames: string[]\n onSelect?: () => void\n disabled?: boolean\n}) {\n const styles = useStyles()\n\n return (\n <PlatformPressable\n onPress={disabled ? undefined : onSelect}\n accessibilityRole=\"button\"\n accessibilityLabel={`Select ${candidate.name}`}\n accessibilityState={{ disabled }}\n >\n <View style={[styles.row, disabled && styles.candidateDisabled]}>\n <Avatar sourceUri={candidate.avatar} size=\"lg\" showFallback={!candidate.avatar} />\n <View style={styles.rowInfo}>\n <Text style={styles.rowName}>{candidate.name}</Text>\n {affiliationNames.length > 0 && (\n <Text style={styles.rowAffiliations} numberOfLines={2}>\n {affiliationNames.join(', ')}\n </Text>\n )}\n {badges.length > 0 && (\n <View style={styles.badgeRow}>\n {badges.map(({ title }) => (\n <Badge key={title} label={title} />\n ))}\n </View>\n )}\n </View>\n </View>\n </PlatformPressable>\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n\n return StyleSheet.create({\n candidateResultsContainer: {\n flex: 1,\n },\n toField: {\n paddingHorizontal: 16,\n paddingTop: 16,\n paddingBottom: 8,\n },\n toFieldHeader: {\n flexDirection: 'row',\n justifyContent: 'space-between',\n alignItems: 'center',\n marginBottom: 8,\n },\n toLabel: {\n fontWeight: '600',\n color: colors.textColorDefaultSecondary,\n },\n clearButton: {\n color: colors.interaction,\n },\n toInputArea: {\n flexDirection: 'row',\n flexWrap: 'wrap',\n alignItems: 'center',\n gap: 6,\n borderWidth: 1,\n borderColor: colors.borderColorDefaultBase,\n borderRadius: 8,\n paddingHorizontal: 10,\n paddingVertical: 8,\n },\n toTextInput: {\n flex: 1,\n minWidth: 80,\n color: colors.textColorDefaultPrimary,\n fontSize: 16,\n paddingVertical: 2,\n },\n chip: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 4,\n borderWidth: 1,\n borderColor: colors.borderColorDefaultBase,\n borderRadius: 100,\n paddingLeft: 4,\n paddingRight: 6,\n paddingVertical: 3,\n },\n chipName: {\n fontSize: 14,\n },\n chipRemoveIcon: {\n color: colors.iconColorDefaultSecondary,\n },\n errorBanner: {\n margin: 16,\n },\n emptyState: {\n alignItems: 'center',\n paddingTop: 32,\n paddingHorizontal: 32,\n gap: 8,\n },\n emptyStateIcon: {\n color: colors.iconColorDefaultSecondary,\n marginBottom: 4,\n },\n emptyStateTitle: {\n fontWeight: '600',\n textAlign: 'center',\n },\n emptyStateSubtitle: {\n textAlign: 'center',\n fontSize: 14,\n },\n row: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 12,\n paddingHorizontal: 16,\n paddingVertical: 12,\n borderBottomWidth: 1,\n borderColor: colors.borderColorDefaultDim,\n },\n rowInfo: {\n flex: 1,\n gap: 2,\n },\n rowName: {\n fontSize: 15,\n fontWeight: '500',\n },\n rowAffiliations: {\n fontSize: 12,\n color: colors.textColorDefaultSecondary,\n },\n badgeRow: {\n flexDirection: 'row',\n flexWrap: 'wrap',\n gap: 4,\n marginTop: 4,\n },\n\n candidateDisabled: {\n opacity: 0.5,\n },\n unavailableHeader: {\n paddingHorizontal: 16,\n paddingTop: 16,\n paddingBottom: 8,\n },\n unavailableLabel: {\n fontSize: 13,\n },\n truncatedFooter: {\n paddingHorizontal: 16,\n paddingTop: 12,\n paddingBottom: 8,\n },\n truncatedText: {\n fontSize: 13,\n textAlign: 'center',\n },\n })\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"direct_message_affiliations.d.ts","sourceRoot":"","sources":["../../../src/types/resources/direct_message_affiliations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAElD,MAAM,WAAW,iCAAkC,SAAQ,cAAc;IACvE,IAAI,EAAE,2BAA2B,CAAA;IACjC,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC9B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"direct_message_affiliations.d.ts","sourceRoot":"","sources":["../../../src/types/resources/direct_message_affiliations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAElD,MAAM,WAAW,iCAAkC,SAAQ,cAAc;IACvE,IAAI,EAAE,2BAA2B,CAAA;IACjC,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC9B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC7B,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAA;CAClC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"direct_message_affiliations.js","sourceRoot":"","sources":["../../../src/types/resources/direct_message_affiliations.ts"],"names":[],"mappings":"","sourcesContent":["import { ResourceObject } from '../api_primitives'\n\nexport interface DirectMessageAffiliationsResource extends ResourceObject {\n type: 'DirectMessageAffiliations'\n id: string\n groups: Record<string, string>\n teams: Record<string, string>\n}\n"]}
|
|
1
|
+
{"version":3,"file":"direct_message_affiliations.js","sourceRoot":"","sources":["../../../src/types/resources/direct_message_affiliations.ts"],"names":[],"mappings":"","sourcesContent":["import { ResourceObject } from '../api_primitives'\n\nexport interface DirectMessageAffiliationsResource extends ResourceObject {\n type: 'DirectMessageAffiliations'\n id: string\n groups: Record<string, string>\n teams: Record<string, string>\n resultsDescription: string | null\n}\n"]}
|
|
@@ -5,10 +5,7 @@ export interface VideoPlayerProps {
|
|
|
5
5
|
};
|
|
6
6
|
aspectRatio?: number;
|
|
7
7
|
style?: StyleProp<ViewStyle>;
|
|
8
|
-
|
|
9
|
-
onFullscreenPlayerDidPresent?: () => void;
|
|
10
|
-
onFullscreenPlayerWillDismiss?: () => void;
|
|
11
|
-
onFullscreenPlayerDidDismiss?: () => void;
|
|
8
|
+
onFullscreenDismiss: () => void;
|
|
12
9
|
}
|
|
13
10
|
export interface VideoPlayerHandle {
|
|
14
11
|
play: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"video.d.ts","sourceRoot":"","sources":["../../../src/utils/native_adapters/video.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAEnD,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAA;IACvB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;IAC5B,
|
|
1
|
+
{"version":3,"file":"video.d.ts","sourceRoot":"","sources":["../../../src/utils/native_adapters/video.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAEnD,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAA;IACvB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;IAC5B,mBAAmB,EAAE,MAAM,IAAI,CAAA;CAChC;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,IAAI,CAAA;IAChB,KAAK,EAAE,MAAM,IAAI,CAAA;IACjB,uBAAuB,EAAE,MAAM,IAAI,CAAA;IACnC,iBAAiB,EAAE,MAAM,IAAI,CAAA;CAC9B;AAED,KAAK,WAAW,GAAG,KAAK,CAAC,yBAAyB,CAChD,gBAAgB,GAAG,KAAK,CAAC,aAAa,CAAC,iBAAiB,CAAC,CAC1D,CAAA;AAED,qBAAa,YAAY;IACvB,MAAM,EAAE,WAAW,CAAA;gBAEP,OAAO,EAAE,YAAY;CAGlC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"video.js","sourceRoot":"","sources":["../../../src/utils/native_adapters/video.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"video.js","sourceRoot":"","sources":["../../../src/utils/native_adapters/video.ts"],"names":[],"mappings":"AAoBA,MAAM,OAAO,YAAY;IACvB,MAAM,CAAa;IAEnB,YAAY,OAAqB;QAC/B,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAA;IAC9B,CAAC;CACF","sourcesContent":["import { StyleProp, ViewStyle } from 'react-native'\n\nexport interface VideoPlayerProps {\n source: { uri: string }\n aspectRatio?: number\n style?: StyleProp<ViewStyle>\n onFullscreenDismiss: () => void\n}\n\nexport interface VideoPlayerHandle {\n play: () => void\n pause: () => void\n presentFullscreenPlayer: () => void\n dismissFullscreen: () => void\n}\n\ntype VideoPlayer = React.ForwardRefExoticComponent<\n VideoPlayerProps & React.RefAttributes<VideoPlayerHandle>\n>\n\nexport class VideoAdapter {\n Player: VideoPlayer\n\n constructor(methods: VideoAdapter) {\n this.Player = methods.Player\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@planningcenter/chat-react-native",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-rc.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@fortawesome/fontawesome-svg-core": "^7.2.0",
|
|
33
33
|
"@fortawesome/react-native-fontawesome": "^0.3.2",
|
|
34
|
-
"@planningcenter/emoji-keyboard": "3.45.
|
|
34
|
+
"@planningcenter/emoji-keyboard": "3.45.0",
|
|
35
35
|
"lodash-inflection": "^1.5.0",
|
|
36
36
|
"react-compiler-runtime": "^1.0.0"
|
|
37
37
|
},
|
|
@@ -72,11 +72,11 @@
|
|
|
72
72
|
"msw": "^2.7.3",
|
|
73
73
|
"prettier": "^3.4.2",
|
|
74
74
|
"react": "19.2.3",
|
|
75
|
-
"react-native": "0.86.2",
|
|
75
|
+
"react-native": "patch:react-native@npm%3A0.86.2#~/.yarn/patches/react-native-npm-0.86.2-c9d546616f.patch",
|
|
76
76
|
"react-native-svg": "15.15.4",
|
|
77
77
|
"react-native-url-polyfill": "^2.0.0",
|
|
78
78
|
"sf-symbols-typescript": "^2.2.0",
|
|
79
79
|
"typescript": "~6.0.3"
|
|
80
80
|
},
|
|
81
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "b528eaada6793bdc405230fcf0a249fb5a2389dc"
|
|
82
82
|
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { DefaultTheme, ThemeProvider } from '@react-navigation/native'
|
|
2
|
+
import { act, fireEvent, render } from '@testing-library/react-native'
|
|
3
|
+
import React, { forwardRef, useImperativeHandle } from 'react'
|
|
4
|
+
import { VideoAttachment } from '../../../../components/conversation/attachments/video_attachment'
|
|
5
|
+
import { DenormalizedMessageAttachmentResource } from '../../../../types/resources/denormalized_attachment_resource'
|
|
6
|
+
import {
|
|
7
|
+
AudioAdapter,
|
|
8
|
+
ChatAdapters,
|
|
9
|
+
ClipboardAdapter,
|
|
10
|
+
ImagePickerAdapter,
|
|
11
|
+
VideoAdapter,
|
|
12
|
+
} from '../../../../utils/native_adapters'
|
|
13
|
+
import { VideoPlayerHandle, VideoPlayerProps } from '../../../../utils/native_adapters/video'
|
|
14
|
+
|
|
15
|
+
const handle: VideoPlayerHandle = {
|
|
16
|
+
play: jest.fn(),
|
|
17
|
+
pause: jest.fn(),
|
|
18
|
+
presentFullscreenPlayer: jest.fn(),
|
|
19
|
+
dismissFullscreen: jest.fn(),
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const playerRender = jest.fn<void, [VideoPlayerProps]>()
|
|
23
|
+
|
|
24
|
+
const Player = forwardRef<VideoPlayerHandle, VideoPlayerProps>((props, ref) => {
|
|
25
|
+
playerRender(props)
|
|
26
|
+
useImperativeHandle(ref, () => handle)
|
|
27
|
+
return null
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
function latestPlayerProps() {
|
|
31
|
+
return playerRender.mock.calls.at(-1)?.[0]
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const attachment: DenormalizedMessageAttachmentResource = {
|
|
35
|
+
type: 'MessageAttachment',
|
|
36
|
+
id: '1',
|
|
37
|
+
attributes: {
|
|
38
|
+
filename: 'clip.mp4',
|
|
39
|
+
key: 'clip',
|
|
40
|
+
contentType: 'video/mp4',
|
|
41
|
+
byteSize: 1,
|
|
42
|
+
checksum: 'abc',
|
|
43
|
+
metadata: { width: 100, height: 100 },
|
|
44
|
+
url: 'https://example.com/clip.mp4',
|
|
45
|
+
},
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
describe('VideoAttachment', () => {
|
|
49
|
+
beforeAll(() => {
|
|
50
|
+
ChatAdapters.configure({
|
|
51
|
+
clipboard: new ClipboardAdapter({
|
|
52
|
+
getStringAsync: jest.fn(async () => ''),
|
|
53
|
+
setStringAsync: jest.fn(async () => {}),
|
|
54
|
+
}),
|
|
55
|
+
audio: new AudioAdapter({
|
|
56
|
+
useAudio: () => ({
|
|
57
|
+
play: jest.fn(),
|
|
58
|
+
pause: jest.fn(),
|
|
59
|
+
isPlaying: false,
|
|
60
|
+
duration: 0,
|
|
61
|
+
position: 0,
|
|
62
|
+
AudioPlayer: null,
|
|
63
|
+
}),
|
|
64
|
+
}),
|
|
65
|
+
video: new VideoAdapter({ Player }),
|
|
66
|
+
imagePicker: new ImagePickerAdapter({
|
|
67
|
+
openCameraAsync: async () => ({ canceled: true, assets: null }),
|
|
68
|
+
openImageLibraryAsync: async () => ({ canceled: true, assets: null }),
|
|
69
|
+
}),
|
|
70
|
+
})
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
beforeEach(() => {
|
|
74
|
+
jest.clearAllMocks()
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
function renderAttachment() {
|
|
78
|
+
return render(
|
|
79
|
+
<ThemeProvider value={DefaultTheme}>
|
|
80
|
+
<VideoAttachment
|
|
81
|
+
attachment={attachment}
|
|
82
|
+
onMessageAttachmentLongPress={jest.fn()}
|
|
83
|
+
isDeleting={false}
|
|
84
|
+
/>
|
|
85
|
+
</ThemeProvider>
|
|
86
|
+
)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
it('opens fullscreen and plays once per open', () => {
|
|
90
|
+
const { getByLabelText } = renderAttachment()
|
|
91
|
+
|
|
92
|
+
fireEvent.press(getByLabelText('Play Video'))
|
|
93
|
+
fireEvent.press(getByLabelText('Play Video'))
|
|
94
|
+
|
|
95
|
+
expect(handle.presentFullscreenPlayer).toHaveBeenCalledTimes(1)
|
|
96
|
+
expect(handle.play).toHaveBeenCalledTimes(1)
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
it('pauses and can be reopened after the player dismisses fullscreen', () => {
|
|
100
|
+
const { getByLabelText } = renderAttachment()
|
|
101
|
+
fireEvent.press(getByLabelText('Play Video'))
|
|
102
|
+
|
|
103
|
+
act(() => latestPlayerProps()?.onFullscreenDismiss())
|
|
104
|
+
|
|
105
|
+
expect(handle.pause).toHaveBeenCalledTimes(1)
|
|
106
|
+
|
|
107
|
+
fireEvent.press(getByLabelText('Play Video'))
|
|
108
|
+
|
|
109
|
+
expect(handle.presentFullscreenPlayer).toHaveBeenCalledTimes(2)
|
|
110
|
+
})
|
|
111
|
+
})
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { QueryClientProvider } from '@tanstack/react-query'
|
|
2
|
+
import { renderHook, waitFor } from '@testing-library/react-native'
|
|
3
|
+
import React from 'react'
|
|
4
|
+
import { buildTestQueryClient } from '../../__utils__/query_client'
|
|
5
|
+
import { useDirectMessageAffiliations } from '../../hooks/direct_messages/use_direct_message_affiliations'
|
|
6
|
+
import { ApiClient, useApiClient } from '../../hooks/use_api_client'
|
|
7
|
+
|
|
8
|
+
jest.mock('../../hooks/use_api_client')
|
|
9
|
+
|
|
10
|
+
const mockedUseApiClient = useApiClient as jest.MockedFunction<typeof useApiClient>
|
|
11
|
+
|
|
12
|
+
let get: jest.Mock
|
|
13
|
+
|
|
14
|
+
const renderUseDirectMessageAffiliations = () => {
|
|
15
|
+
const wrapper = ({ children }: { children: React.ReactNode }) => (
|
|
16
|
+
<QueryClientProvider client={buildTestQueryClient()}>{children}</QueryClientProvider>
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
return renderHook(() => useDirectMessageAffiliations(), { wrapper })
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
beforeEach(() => {
|
|
23
|
+
get = jest.fn().mockResolvedValue({
|
|
24
|
+
data: {
|
|
25
|
+
id: '1',
|
|
26
|
+
type: 'DirectMessageAffiliations',
|
|
27
|
+
groups: { '10': 'Youth' },
|
|
28
|
+
teams: { '20': 'Band' },
|
|
29
|
+
resultsDescription: 'Who you can message',
|
|
30
|
+
},
|
|
31
|
+
})
|
|
32
|
+
mockedUseApiClient.mockReturnValue({ chat: { get } } as unknown as ApiClient)
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
afterEach(() => {
|
|
36
|
+
jest.clearAllMocks()
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
describe('useDirectMessageAffiliations', () => {
|
|
40
|
+
it('requests the results description alongside groups and teams', async () => {
|
|
41
|
+
renderUseDirectMessageAffiliations()
|
|
42
|
+
|
|
43
|
+
await waitFor(() => expect(get).toHaveBeenCalled())
|
|
44
|
+
|
|
45
|
+
expect(get).toHaveBeenCalledWith(
|
|
46
|
+
expect.objectContaining({
|
|
47
|
+
url: '/me/direct_message_affiliations',
|
|
48
|
+
data: { fields: { DirectMessageAffiliations: ['groups', 'teams', 'results_description'] } },
|
|
49
|
+
})
|
|
50
|
+
)
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
it('exposes the server rendered results description', async () => {
|
|
54
|
+
const { result } = renderUseDirectMessageAffiliations()
|
|
55
|
+
|
|
56
|
+
await waitFor(() => expect(result.current.resultsDescription).toBe('Who you can message'))
|
|
57
|
+
|
|
58
|
+
expect(result.current.groups.get(10)).toBe('Youth')
|
|
59
|
+
expect(result.current.teams.get(20)).toBe('Band')
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
it('returns null when the server sends no description', async () => {
|
|
63
|
+
get.mockResolvedValue({
|
|
64
|
+
data: { id: '1', type: 'DirectMessageAffiliations', groups: {}, teams: {} },
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
const { result } = renderUseDirectMessageAffiliations()
|
|
68
|
+
|
|
69
|
+
await waitFor(() => expect(get).toHaveBeenCalled())
|
|
70
|
+
await waitFor(() => expect(result.current.groups.size).toBe(0))
|
|
71
|
+
|
|
72
|
+
expect(result.current.resultsDescription).toBeNull()
|
|
73
|
+
})
|
|
74
|
+
})
|
|
@@ -37,7 +37,7 @@ export function VideoAttachment({
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
function
|
|
40
|
+
function closeVideo() {
|
|
41
41
|
videoRef.current?.pause()
|
|
42
42
|
setIsOpen(false)
|
|
43
43
|
}
|
|
@@ -60,7 +60,7 @@ export function VideoAttachment({
|
|
|
60
60
|
source={{ uri: url }}
|
|
61
61
|
aspectRatio={width / height}
|
|
62
62
|
style={styles.video}
|
|
63
|
-
|
|
63
|
+
onFullscreenDismiss={closeVideo}
|
|
64
64
|
/>
|
|
65
65
|
{!isOpen && !isDeleting && (
|
|
66
66
|
<View style={styles.playContainer}>
|
|
@@ -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
|
}
|
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,
|
|
@@ -4,10 +4,7 @@ export interface VideoPlayerProps {
|
|
|
4
4
|
source: { uri: string }
|
|
5
5
|
aspectRatio?: number
|
|
6
6
|
style?: StyleProp<ViewStyle>
|
|
7
|
-
|
|
8
|
-
onFullscreenPlayerDidPresent?: () => void
|
|
9
|
-
onFullscreenPlayerWillDismiss?: () => void
|
|
10
|
-
onFullscreenPlayerDidDismiss?: () => void
|
|
7
|
+
onFullscreenDismiss: () => void
|
|
11
8
|
}
|
|
12
9
|
|
|
13
10
|
export interface VideoPlayerHandle {
|