@planningcenter/chat-react-native 3.16.0-rc.3 → 3.16.0-rc.4
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/message.d.ts +2 -1
- package/build/components/conversation/message.d.ts.map +1 -1
- package/build/components/conversation/message.js +18 -2
- package/build/components/conversation/message.js.map +1 -1
- package/build/components/conversation/message_form.d.ts +2 -1
- package/build/components/conversation/message_form.d.ts.map +1 -1
- package/build/components/conversation/message_form.js +38 -16
- package/build/components/conversation/message_form.js.map +1 -1
- package/build/components/conversation/reply_connectors.js +1 -1
- package/build/components/conversation/reply_connectors.js.map +1 -1
- package/build/components/conversation/shadow_message.d.ts +2 -1
- package/build/components/conversation/shadow_message.d.ts.map +1 -1
- package/build/components/conversation/shadow_message.js +10 -5
- package/build/components/conversation/shadow_message.js.map +1 -1
- package/build/components/display/icon.d.ts +3 -1
- package/build/components/display/icon.d.ts.map +1 -1
- package/build/components/display/icon.js +2 -0
- package/build/components/display/icon.js.map +1 -1
- package/build/hooks/use_conversation_messages.d.ts +6 -3
- package/build/hooks/use_conversation_messages.d.ts.map +1 -1
- package/build/hooks/use_conversation_messages.js +32 -25
- package/build/hooks/use_conversation_messages.js.map +1 -1
- package/build/hooks/use_message_create_or_update.d.ts +2 -1
- package/build/hooks/use_message_create_or_update.d.ts.map +1 -1
- package/build/hooks/use_message_create_or_update.js +6 -2
- package/build/hooks/use_message_create_or_update.js.map +1 -1
- package/build/hooks/use_suspense_api.d.ts +3 -1
- package/build/hooks/use_suspense_api.d.ts.map +1 -1
- package/build/hooks/use_suspense_api.js +1 -0
- package/build/hooks/use_suspense_api.js.map +1 -1
- package/build/navigation/index.d.ts +6 -0
- package/build/navigation/index.d.ts.map +1 -1
- package/build/navigation/index.js +6 -0
- package/build/navigation/index.js.map +1 -1
- package/build/screens/conversation_screen.d.ts +2 -1
- package/build/screens/conversation_screen.d.ts.map +1 -1
- package/build/screens/conversation_screen.js +7 -5
- package/build/screens/conversation_screen.js.map +1 -1
- package/build/screens/message_actions_screen.d.ts +1 -0
- package/build/screens/message_actions_screen.d.ts.map +1 -1
- package/build/screens/message_actions_screen.js +16 -3
- package/build/screens/message_actions_screen.js.map +1 -1
- package/build/types/jolt_events/message_events.d.ts +2 -0
- package/build/types/jolt_events/message_events.d.ts.map +1 -1
- package/build/types/jolt_events/message_events.js.map +1 -1
- package/build/types/resources/message.d.ts +2 -0
- package/build/types/resources/message.d.ts.map +1 -1
- package/build/types/resources/message.js.map +1 -1
- package/build/utils/cache/optimistically_create_message.d.ts.map +1 -1
- package/build/utils/cache/optimistically_create_message.js +2 -0
- package/build/utils/cache/optimistically_create_message.js.map +1 -1
- package/build/utils/index.d.ts +1 -0
- package/build/utils/index.d.ts.map +1 -1
- package/build/utils/index.js +1 -0
- package/build/utils/index.js.map +1 -1
- package/build/utils/jolt/transform_message_event_data_to_message_resource.d.ts.map +1 -1
- package/build/utils/jolt/transform_message_event_data_to_message_resource.js +2 -0
- package/build/utils/jolt/transform_message_event_data_to_message_resource.js.map +1 -1
- package/build/utils/replies_local_feature_flag.d.ts +2 -0
- package/build/utils/replies_local_feature_flag.d.ts.map +1 -0
- package/build/utils/replies_local_feature_flag.js +3 -0
- package/build/utils/replies_local_feature_flag.js.map +1 -0
- package/package.json +2 -2
- package/src/components/conversation/message.tsx +29 -1
- package/src/components/conversation/message_form.tsx +85 -15
- package/src/components/conversation/reply_connectors.tsx +1 -1
- package/src/components/conversation/shadow_message.tsx +15 -7
- package/src/components/display/icon.tsx +3 -0
- package/src/hooks/use_conversation_messages.ts +45 -25
- package/src/hooks/use_message_create_or_update.ts +7 -2
- package/src/hooks/use_suspense_api.ts +3 -0
- package/src/navigation/index.tsx +6 -0
- package/src/screens/conversation_screen.tsx +9 -4
- package/src/screens/message_actions_screen.tsx +27 -1
- package/src/types/jolt_events/message_events.ts +2 -0
- package/src/types/resources/message.ts +2 -0
- package/src/utils/cache/optimistically_create_message.ts +2 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/jolt/transform_message_event_data_to_message_resource.ts +2 -0
- package/src/utils/replies_local_feature_flag.ts +2 -0
|
@@ -7,7 +7,8 @@ interface MessageProps extends MessageResource {
|
|
|
7
7
|
canDeleteNonAuthoredMessages: boolean;
|
|
8
8
|
conversation_id: number;
|
|
9
9
|
latestReadMessageSortKey?: string;
|
|
10
|
+
inReplyScreen?: boolean;
|
|
10
11
|
}
|
|
11
|
-
export declare function Message({ canDeleteNonAuthoredMessages, conversation_id, latestReadMessageSortKey, ...message }: MessageProps): React.JSX.Element;
|
|
12
|
+
export declare function Message({ canDeleteNonAuthoredMessages, conversation_id, latestReadMessageSortKey, inReplyScreen, ...message }: MessageProps): React.JSX.Element;
|
|
12
13
|
export {};
|
|
13
14
|
//# sourceMappingURL=message.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/message.tsx"],"names":[],"mappings":"AACA,OAAO,KAAoB,MAAM,OAAO,CAAA;AASxC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/message.tsx"],"names":[],"mappings":"AACA,OAAO,KAAoB,MAAM,OAAO,CAAA;AASxC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAmB7C;;GAEG;AACH,UAAU,YAAa,SAAQ,eAAe;IAC5C,4BAA4B,EAAE,OAAO,CAAA;IACrC,eAAe,EAAE,MAAM,CAAA;IACvB,wBAAwB,CAAC,EAAE,MAAM,CAAA;IACjC,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB;AAED,wBAAgB,OAAO,CAAC,EACtB,4BAA4B,EAC5B,eAAe,EACf,wBAAwB,EACxB,aAAa,EACb,GAAG,OAAO,EACX,EAAE,YAAY,qBA0Nd"}
|
|
@@ -2,7 +2,7 @@ import { useNavigation } from '@react-navigation/native';
|
|
|
2
2
|
import React, { useEffect } from 'react';
|
|
3
3
|
import { Pressable, StyleSheet, useWindowDimensions, View } from 'react-native';
|
|
4
4
|
import { MessageReaction } from '../../components/conversation/message_reaction';
|
|
5
|
-
import { Avatar, Icon, Spinner, Text, TextInlineButton } from '../../components/display';
|
|
5
|
+
import { Avatar, Icon, Spinner, Text, TextButton, TextInlineButton } from '../../components/display';
|
|
6
6
|
import { useAnimatedMessageBackgroundColor, useInteractionGhostBackgroundColor, useTheme, } from '../../hooks';
|
|
7
7
|
import { MessageAttachments } from './message_attachments';
|
|
8
8
|
import ErrorBoundary from '../page/error_boundary';
|
|
@@ -14,7 +14,8 @@ import { MessageReadReceipts } from './message_read_receipts';
|
|
|
14
14
|
import { isNewMessage, useMessageCreateOrUpdate } from '../../hooks/use_message_create_or_update';
|
|
15
15
|
import { Haptic } from '../../utils/native_adapters';
|
|
16
16
|
import { TheirReplyConnector, MyReplyConnector } from './reply_connectors';
|
|
17
|
-
|
|
17
|
+
import { REPLIES_FEATURE_ENABLED } from '../../utils';
|
|
18
|
+
export function Message({ canDeleteNonAuthoredMessages, conversation_id, latestReadMessageSortKey, inReplyScreen, ...message }) {
|
|
18
19
|
const { text, reactionCounts, pending, error } = message;
|
|
19
20
|
const styles = useMessageStyles(message);
|
|
20
21
|
const navigation = useNavigation();
|
|
@@ -57,6 +58,7 @@ export function Message({ canDeleteNonAuthoredMessages, conversation_id, latestR
|
|
|
57
58
|
message_id: message.id,
|
|
58
59
|
conversation_id,
|
|
59
60
|
canDeleteNonAuthoredMessages,
|
|
61
|
+
inReplyScreen,
|
|
60
62
|
});
|
|
61
63
|
};
|
|
62
64
|
const handleReactionLongPress = (reaction) => {
|
|
@@ -78,6 +80,13 @@ export function Message({ canDeleteNonAuthoredMessages, conversation_id, latestR
|
|
|
78
80
|
myMessage: message.mine,
|
|
79
81
|
});
|
|
80
82
|
};
|
|
83
|
+
const handleNavigateToReplyPress = () => {
|
|
84
|
+
navigation.navigate('ConversationReply', {
|
|
85
|
+
conversation_id,
|
|
86
|
+
reply_root_id: message.id,
|
|
87
|
+
// TODO: Add a way to pass the reply root author's name
|
|
88
|
+
});
|
|
89
|
+
};
|
|
81
90
|
const metaProps = {
|
|
82
91
|
authorName: message.author.name,
|
|
83
92
|
createdAt: message.createdAt,
|
|
@@ -85,6 +94,7 @@ export function Message({ canDeleteNonAuthoredMessages, conversation_id, latestR
|
|
|
85
94
|
const renderAuthor = (!message.mine && message.renderAuthor) || false;
|
|
86
95
|
const messageBottomMargin = message.lastInGroup ? 12 : hasReactions || showMessageMeta ? 8 : 4;
|
|
87
96
|
const messagePendingLabel = isPersisted ? 'Saving' : 'Sending';
|
|
97
|
+
const showReplyCountButton = !inReplyScreen && message.replyRootId === message.id && REPLIES_FEATURE_ENABLED;
|
|
88
98
|
return (<Pressable onLongPress={handleMessageLongPress} onPress={() => setShowMessageMetaToggle(!showMessageMetaToggle)} onPressIn={handleMessagePressIn} onPressOut={handleMessagePressOut} android_ripple={{ color: colors.androidRippleNeutral }} accessibilityHint="Long press to view message actions like reacting and copying.">
|
|
89
99
|
<Animated.View style={[styles.message, animatedBackgroundColor]}>
|
|
90
100
|
{!message.mine && (<View>
|
|
@@ -101,6 +111,9 @@ export function Message({ canDeleteNonAuthoredMessages, conversation_id, latestR
|
|
|
101
111
|
<MessageMarkdown text={text}/>
|
|
102
112
|
</View>)}
|
|
103
113
|
</View>
|
|
114
|
+
{showReplyCountButton && (<TextButton variant="footnote" onPress={handleNavigateToReplyPress} style={styles.messageReplyCount} accessibilityHint="Navigates to reply screen for this message" accessibilityRole="link">
|
|
115
|
+
{message.replyCount} replies
|
|
116
|
+
</TextButton>)}
|
|
104
117
|
{hasReactions && (<View style={styles.messageReactions}>
|
|
105
118
|
{reactionCounts.map(reaction => (<MessageReaction key={reaction.value} reaction={reaction} onLongPress={handleReactionLongPress} message={message} conversationId={conversation_id}/>))}
|
|
106
119
|
</View>)}
|
|
@@ -167,6 +180,9 @@ const useMessageStyles = ({ mine }) => {
|
|
|
167
180
|
gap: 4,
|
|
168
181
|
justifyContent: mine ? 'flex-end' : 'flex-start',
|
|
169
182
|
},
|
|
183
|
+
messageReplyCount: {
|
|
184
|
+
alignSelf: mine ? 'flex-end' : 'flex-start',
|
|
185
|
+
},
|
|
170
186
|
messageMeta: {
|
|
171
187
|
flexDirection: 'row',
|
|
172
188
|
alignItems: 'center',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message.js","sourceRoot":"","sources":["../../../src/components/conversation/message.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACxD,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACxC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,mBAAmB,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC/E,OAAO,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAA;AAChF,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AACxF,OAAO,EACL,iCAAiC,EACjC,kCAAkC,EAClC,QAAQ,GACT,MAAM,aAAa,CAAA;AAGpB,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AAC1D,OAAO,aAAa,MAAM,wBAAwB,CAAA;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAEpD,OAAO,EACL,4CAA4C,EAC5C,kCAAkC,EAClC,wBAAwB,GACzB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,QAAQ,MAAM,yBAAyB,CAAA;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAA;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAC7D,OAAO,EAAE,YAAY,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAA;AACjG,OAAO,EAAE,MAAM,EA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,4BAA4B;YAC7C,YAAY,EAAE,CAAC;YACf,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK;YACnC,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY;SAC5C;QACD,WAAW,EAAE;YACX,eAAe,EAAE,CAAC;YAClB,iBAAiB,EAAE,CAAC;SACrB;QACD,gBAAgB,EAAE;YAChB,aAAa,EAAE,KAAK;YACpB,GAAG,EAAE,CAAC;YACN,cAAc,EAAE,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY;SACjD;QACD,WAAW,EAAE;YACX,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,cAAc,EAAE,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY;YAChD,GAAG,EAAE,CAAC;SACP;QACD,UAAU,EAAE;YACV,UAAU,EAAE,wBAAwB;SACrC;QACD,yBAAyB,EAAE;YACzB,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,GAAG,EAAE,CAAC;SACP;QACD,cAAc,EAAE;YACd,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,GAAG,EAAE,CAAC;SACP;QACD,SAAS,EAAE;YACT,KAAK,EAAE,MAAM,CAAC,eAAe;SAC9B;QACD,SAAS,EAAE;YACT,KAAK,EAAE,MAAM,CAAC,eAAe;SAC9B;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { useNavigation } from '@react-navigation/native'\nimport React, { useEffect } from 'react'\nimport { Pressable, StyleSheet, useWindowDimensions, View } from 'react-native'\nimport { MessageReaction } from '../../components/conversation/message_reaction'\nimport { Avatar, Icon, Spinner, Text, TextInlineButton } from '../../components/display'\nimport {\n useAnimatedMessageBackgroundColor,\n useInteractionGhostBackgroundColor,\n useTheme,\n} from '../../hooks'\nimport { MessageResource } from '../../types'\nimport { ReactionCountResource } from '../../types/resources/reaction'\nimport { MessageAttachments } from './message_attachments'\nimport ErrorBoundary from '../page/error_boundary'\nimport { MessageMarkdown } from './message_markdown'\nimport { DenormalizedMessageAttachmentResource } from '../../types/resources/denormalized_attachment_resource'\nimport {\n CONVERSATION_MESSAGE_LIST_PADDING_HORIZONTAL,\n MESSAGE_AUTHOR_AVATAR_COLUMN_WIDTH,\n platformFontWeightMedium,\n} from '../../utils/styles'\nimport Animated from 'react-native-reanimated'\nimport { useLiveRelativeTime } from '../../hooks/use_live_relative_time'\nimport { MessageReadReceipts } from './message_read_receipts'\nimport { isNewMessage, useMessageCreateOrUpdate } from '../../hooks/use_message_create_or_update'\nimport { Haptic } from '../../utils/native_adapters'\nimport { TheirReplyConnector, MyReplyConnector } from './reply_connectors'\n\n/** Message\n * Component for display of a message within a conversation list\n */\ninterface MessageProps extends MessageResource {\n canDeleteNonAuthoredMessages: boolean\n conversation_id: number\n latestReadMessageSortKey?: string\n}\n\nexport function Message({\n canDeleteNonAuthoredMessages,\n conversation_id,\n latestReadMessageSortKey,\n ...message\n}: MessageProps) {\n const { text, reactionCounts, pending, error } = message\n const styles = useMessageStyles(message)\n const navigation = useNavigation()\n const { colors } = useTheme()\n const hasReactions = reactionCounts.length > 0\n const [showMessageMetaToggle, setShowMessageMetaToggle] = React.useState(false)\n const showMessageMeta =\n showMessageMetaToggle || message.myLatestInConversation || !!pending || !!error || false\n const timestamp = useLiveRelativeTime(message.createdAt)\n const wasEdited = Boolean(message.textEditedAt)\n const isPersisted = !isNewMessage(message)\n const [temporarilyHidePendingState, setTemporarilyHidePendingState] = React.useState(true)\n const [messageBubbleHeight, setMessageBubbleHeight] = React.useState(0)\n const { animatedBackgroundColor, handleMessagePressIn, handleMessagePressOut } =\n useAnimatedMessageBackgroundColor()\n\n useEffect(() => {\n if (pending) {\n const timer = setTimeout(() => {\n setTemporarilyHidePendingState(false)\n }, 2000)\n return () => clearTimeout(timer)\n }\n return () => {}\n }, [pending])\n\n const retryFailedSaveMutation = useMessageCreateOrUpdate({\n conversationId: conversation_id,\n message,\n })\n\n const handleRetry = () => {\n if (text && error) {\n retryFailedSaveMutation.mutateAsync({\n text,\n attachments: message.attachmentsForCreate,\n })\n }\n }\n\n const handleMessageLongPress = () => {\n if (!isPersisted) return\n\n Haptic.impactLight()\n navigation.navigate('MessageActions', {\n message_id: message.id,\n conversation_id,\n canDeleteNonAuthoredMessages,\n })\n }\n const handleReactionLongPress = (reaction: ReactionCountResource) => {\n Haptic.impactLight()\n navigation.navigate('Reactions', {\n message_id: message.id,\n conversation_id,\n reaction_value: reaction.value,\n })\n }\n\n const handleMessageAttachmentLongPress = (attachment: DenormalizedMessageAttachmentResource) => {\n Haptic.impactLight()\n navigation.navigate('AttachmentActions', {\n attachmentId: attachment?.id,\n attachmentContentType: attachment?.attributes.contentType,\n attachmentUrl: attachment?.attributes.url,\n conversation_id,\n canDeleteNonAuthoredMessages,\n myMessage: message.mine,\n })\n }\n\n const metaProps = {\n authorName: message.author.name,\n createdAt: message.createdAt,\n }\n\n const renderAuthor = (!message.mine && message.renderAuthor) || false\n const messageBottomMargin = message.lastInGroup ? 12 : hasReactions || showMessageMeta ? 8 : 4\n const messagePendingLabel = isPersisted ? 'Saving' : 'Sending'\n\n return (\n <Pressable\n onLongPress={handleMessageLongPress}\n onPress={() => setShowMessageMetaToggle(!showMessageMetaToggle)}\n onPressIn={handleMessagePressIn}\n onPressOut={handleMessagePressOut}\n android_ripple={{ color: colors.androidRippleNeutral }}\n accessibilityHint=\"Long press to view message actions like reacting and copying.\"\n >\n <Animated.View style={[styles.message, animatedBackgroundColor]}>\n {!message.mine && (\n <View>\n {renderAuthor ? (\n <Avatar\n size={'md'}\n sourceUri={message.author.avatar}\n style={styles.avatar}\n maxFontSizeMultiplier={1}\n minFontSizeMultiplier={1}\n />\n ) : (\n <View style={styles.avatarPlaceholder} />\n )}\n <TheirReplyConnector message={message} messageBubbleHeight={messageBubbleHeight} />\n </View>\n )}\n <View style={[styles.messageContent, { marginBottom: messageBottomMargin }]}>\n {renderAuthor && <Text variant=\"tertiary\">{message.author.name}</Text>}\n <View\n style={styles.messageBubble}\n onLayout={e => setMessageBubbleHeight(e.nativeEvent.layout.height)}\n >\n <ErrorBoundary>\n <MessageAttachments\n attachments={message.attachments}\n metaProps={metaProps}\n onMessageAttachmentLongPress={handleMessageAttachmentLongPress}\n onMessageLongPress={handleMessageLongPress}\n />\n </ErrorBoundary>\n {text && (\n <View style={styles.messageText}>\n <MessageMarkdown text={text} />\n </View>\n )}\n </View>\n {hasReactions && (\n <View style={styles.messageReactions}>\n {reactionCounts.map(reaction => (\n <MessageReaction\n key={reaction.value}\n reaction={reaction}\n onLongPress={handleReactionLongPress}\n message={message}\n conversationId={conversation_id}\n />\n ))}\n </View>\n )}\n {showMessageMeta && (\n <View style={styles.messageMeta}>\n {message.mine && !pending && !error && (\n <MessageReadReceipts\n message={message}\n latestReadMessageSortKey={latestReadMessageSortKey}\n />\n )}\n {error ? (\n <View style={styles.errorContainer}>\n {retryFailedSaveMutation.isPending ? (\n <Spinner size={12} />\n ) : (\n <Icon name=\"general.exclamationTriangle\" size={12} style={styles.errorIcon} />\n )}\n <Text variant=\"footnote\" style={styles.errorText}>\n Failed to {isPersisted ? 'edit' : 'send'} |{' '}\n <TextInlineButton\n onPress={handleRetry}\n variant=\"footnote\"\n appearance=\"danger\"\n disabled={retryFailedSaveMutation.isPending}\n >\n Try again\n </TextInlineButton>\n </Text>\n </View>\n ) : pending && (!temporarilyHidePendingState || isPersisted) ? (\n <View style={styles.pendingIndicatorContainer}>\n <Icon\n name=\"general.outlinedClock\"\n size={12}\n color={colors.iconColorDefaultSecondary}\n />\n <Text variant=\"footnote\">{messagePendingLabel}</Text>\n </View>\n ) : isPersisted ? (\n <Text variant=\"footnote\">{timestamp}</Text>\n ) : null}\n {!pending && !error && wasEdited && (\n <Text variant=\"footnote\">\n |{' '}\n <Text variant=\"footnote\" style={styles.editedText}>\n Edited\n </Text>\n </Text>\n )}\n </View>\n )}\n </View>\n {message.mine && (\n <MyReplyConnector message={message} messageBubbleHeight={messageBubbleHeight} />\n )}\n </Animated.View>\n </Pressable>\n )\n}\n\nconst useMessageStyles = ({ mine }: MessageResource) => {\n const { colors } = useTheme()\n const myMessageBackgroundColor = useInteractionGhostBackgroundColor()\n const { width } = useWindowDimensions()\n const tabletWidth = width >= 744 // Smallest iPad Mini's width\n\n const messageBubbleBackgroundColor = mine ? myMessageBackgroundColor : colors.fillColorNeutral070\n\n return StyleSheet.create({\n message: {\n gap: 8,\n flexDirection: mine ? 'row-reverse' : 'row',\n paddingHorizontal: CONVERSATION_MESSAGE_LIST_PADDING_HORIZONTAL,\n },\n messageContent: {\n flex: 1,\n gap: 4,\n },\n avatar: {\n marginBottom: 8,\n },\n avatarPlaceholder: {\n width: MESSAGE_AUTHOR_AVATAR_COLUMN_WIDTH, // Same width as avatar\n },\n messageBubble: {\n backgroundColor: messageBubbleBackgroundColor,\n borderRadius: 8,\n maxWidth: tabletWidth ? 360 : '80%',\n alignSelf: mine ? 'flex-end' : 'flex-start',\n },\n messageText: {\n paddingVertical: 6,\n paddingHorizontal: 8,\n },\n messageReactions: {\n flexDirection: 'row',\n gap: 4,\n justifyContent: mine ? 'flex-end' : 'flex-start',\n },\n messageMeta: {\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: mine ? 'flex-end' : 'flex-start',\n gap: 4,\n },\n editedText: {\n fontWeight: platformFontWeightMedium,\n },\n pendingIndicatorContainer: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 4,\n },\n errorContainer: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 4,\n },\n errorIcon: {\n color: colors.statusErrorIcon,\n },\n errorText: {\n color: colors.statusErrorText,\n },\n })\n}\n"]}
|
|
1
|
+
{"version":3,"file":"message.js","sourceRoot":"","sources":["../../../src/components/conversation/message.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACxD,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B;QACD,SAAS,EAAE;YACT,KAAK,EAAE,MAAM,CAAC,eAAe;SAC9B;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { useNavigation } from '@react-navigation/native'\nimport React, { useEffect } from 'react'\nimport { Pressable, StyleSheet, useWindowDimensions, View } from 'react-native'\nimport { MessageReaction } from '../../components/conversation/message_reaction'\nimport { Avatar, Icon, Spinner, Text, TextButton, TextInlineButton } from '../../components/display'\nimport {\n useAnimatedMessageBackgroundColor,\n useInteractionGhostBackgroundColor,\n useTheme,\n} from '../../hooks'\nimport { MessageResource } from '../../types'\nimport { ReactionCountResource } from '../../types/resources/reaction'\nimport { MessageAttachments } from './message_attachments'\nimport ErrorBoundary from '../page/error_boundary'\nimport { MessageMarkdown } from './message_markdown'\nimport { DenormalizedMessageAttachmentResource } from '../../types/resources/denormalized_attachment_resource'\nimport {\n CONVERSATION_MESSAGE_LIST_PADDING_HORIZONTAL,\n MESSAGE_AUTHOR_AVATAR_COLUMN_WIDTH,\n platformFontWeightMedium,\n} from '../../utils/styles'\nimport Animated from 'react-native-reanimated'\nimport { useLiveRelativeTime } from '../../hooks/use_live_relative_time'\nimport { MessageReadReceipts } from './message_read_receipts'\nimport { isNewMessage, useMessageCreateOrUpdate } from '../../hooks/use_message_create_or_update'\nimport { Haptic } from '../../utils/native_adapters'\nimport { TheirReplyConnector, MyReplyConnector } from './reply_connectors'\nimport { REPLIES_FEATURE_ENABLED } from '../../utils'\n\n/** Message\n * Component for display of a message within a conversation list\n */\ninterface MessageProps extends MessageResource {\n canDeleteNonAuthoredMessages: boolean\n conversation_id: number\n latestReadMessageSortKey?: string\n inReplyScreen?: boolean\n}\n\nexport function Message({\n canDeleteNonAuthoredMessages,\n conversation_id,\n latestReadMessageSortKey,\n inReplyScreen,\n ...message\n}: MessageProps) {\n const { text, reactionCounts, pending, error } = message\n const styles = useMessageStyles(message)\n const navigation = useNavigation()\n const { colors } = useTheme()\n const hasReactions = reactionCounts.length > 0\n const [showMessageMetaToggle, setShowMessageMetaToggle] = React.useState(false)\n const showMessageMeta =\n showMessageMetaToggle || message.myLatestInConversation || !!pending || !!error || false\n const timestamp = useLiveRelativeTime(message.createdAt)\n const wasEdited = Boolean(message.textEditedAt)\n const isPersisted = !isNewMessage(message)\n const [temporarilyHidePendingState, setTemporarilyHidePendingState] = React.useState(true)\n const [messageBubbleHeight, setMessageBubbleHeight] = React.useState(0)\n const { animatedBackgroundColor, handleMessagePressIn, handleMessagePressOut } =\n useAnimatedMessageBackgroundColor()\n\n useEffect(() => {\n if (pending) {\n const timer = setTimeout(() => {\n setTemporarilyHidePendingState(false)\n }, 2000)\n return () => clearTimeout(timer)\n }\n return () => {}\n }, [pending])\n\n const retryFailedSaveMutation = useMessageCreateOrUpdate({\n conversationId: conversation_id,\n message,\n })\n\n const handleRetry = () => {\n if (text && error) {\n retryFailedSaveMutation.mutateAsync({\n text,\n attachments: message.attachmentsForCreate,\n })\n }\n }\n\n const handleMessageLongPress = () => {\n if (!isPersisted) return\n\n Haptic.impactLight()\n navigation.navigate('MessageActions', {\n message_id: message.id,\n conversation_id,\n canDeleteNonAuthoredMessages,\n inReplyScreen,\n })\n }\n const handleReactionLongPress = (reaction: ReactionCountResource) => {\n Haptic.impactLight()\n navigation.navigate('Reactions', {\n message_id: message.id,\n conversation_id,\n reaction_value: reaction.value,\n })\n }\n\n const handleMessageAttachmentLongPress = (attachment: DenormalizedMessageAttachmentResource) => {\n Haptic.impactLight()\n navigation.navigate('AttachmentActions', {\n attachmentId: attachment?.id,\n attachmentContentType: attachment?.attributes.contentType,\n attachmentUrl: attachment?.attributes.url,\n conversation_id,\n canDeleteNonAuthoredMessages,\n myMessage: message.mine,\n })\n }\n\n const handleNavigateToReplyPress = () => {\n navigation.navigate('ConversationReply', {\n conversation_id,\n reply_root_id: message.id,\n // TODO: Add a way to pass the reply root author's name\n })\n }\n\n const metaProps = {\n authorName: message.author.name,\n createdAt: message.createdAt,\n }\n\n const renderAuthor = (!message.mine && message.renderAuthor) || false\n const messageBottomMargin = message.lastInGroup ? 12 : hasReactions || showMessageMeta ? 8 : 4\n const messagePendingLabel = isPersisted ? 'Saving' : 'Sending'\n const showReplyCountButton =\n !inReplyScreen && message.replyRootId === message.id && REPLIES_FEATURE_ENABLED\n\n return (\n <Pressable\n onLongPress={handleMessageLongPress}\n onPress={() => setShowMessageMetaToggle(!showMessageMetaToggle)}\n onPressIn={handleMessagePressIn}\n onPressOut={handleMessagePressOut}\n android_ripple={{ color: colors.androidRippleNeutral }}\n accessibilityHint=\"Long press to view message actions like reacting and copying.\"\n >\n <Animated.View style={[styles.message, animatedBackgroundColor]}>\n {!message.mine && (\n <View>\n {renderAuthor ? (\n <Avatar\n size={'md'}\n sourceUri={message.author.avatar}\n style={styles.avatar}\n maxFontSizeMultiplier={1}\n minFontSizeMultiplier={1}\n />\n ) : (\n <View style={styles.avatarPlaceholder} />\n )}\n <TheirReplyConnector message={message} messageBubbleHeight={messageBubbleHeight} />\n </View>\n )}\n <View style={[styles.messageContent, { marginBottom: messageBottomMargin }]}>\n {renderAuthor && <Text variant=\"tertiary\">{message.author.name}</Text>}\n <View\n style={styles.messageBubble}\n onLayout={e => setMessageBubbleHeight(e.nativeEvent.layout.height)}\n >\n <ErrorBoundary>\n <MessageAttachments\n attachments={message.attachments}\n metaProps={metaProps}\n onMessageAttachmentLongPress={handleMessageAttachmentLongPress}\n onMessageLongPress={handleMessageLongPress}\n />\n </ErrorBoundary>\n {text && (\n <View style={styles.messageText}>\n <MessageMarkdown text={text} />\n </View>\n )}\n </View>\n {showReplyCountButton && (\n <TextButton\n variant=\"footnote\"\n onPress={handleNavigateToReplyPress}\n style={styles.messageReplyCount}\n accessibilityHint=\"Navigates to reply screen for this message\"\n accessibilityRole=\"link\"\n >\n {message.replyCount} replies\n </TextButton>\n )}\n {hasReactions && (\n <View style={styles.messageReactions}>\n {reactionCounts.map(reaction => (\n <MessageReaction\n key={reaction.value}\n reaction={reaction}\n onLongPress={handleReactionLongPress}\n message={message}\n conversationId={conversation_id}\n />\n ))}\n </View>\n )}\n {showMessageMeta && (\n <View style={styles.messageMeta}>\n {message.mine && !pending && !error && (\n <MessageReadReceipts\n message={message}\n latestReadMessageSortKey={latestReadMessageSortKey}\n />\n )}\n {error ? (\n <View style={styles.errorContainer}>\n {retryFailedSaveMutation.isPending ? (\n <Spinner size={12} />\n ) : (\n <Icon name=\"general.exclamationTriangle\" size={12} style={styles.errorIcon} />\n )}\n <Text variant=\"footnote\" style={styles.errorText}>\n Failed to {isPersisted ? 'edit' : 'send'} |{' '}\n <TextInlineButton\n onPress={handleRetry}\n variant=\"footnote\"\n appearance=\"danger\"\n disabled={retryFailedSaveMutation.isPending}\n >\n Try again\n </TextInlineButton>\n </Text>\n </View>\n ) : pending && (!temporarilyHidePendingState || isPersisted) ? (\n <View style={styles.pendingIndicatorContainer}>\n <Icon\n name=\"general.outlinedClock\"\n size={12}\n color={colors.iconColorDefaultSecondary}\n />\n <Text variant=\"footnote\">{messagePendingLabel}</Text>\n </View>\n ) : isPersisted ? (\n <Text variant=\"footnote\">{timestamp}</Text>\n ) : null}\n {!pending && !error && wasEdited && (\n <Text variant=\"footnote\">\n |{' '}\n <Text variant=\"footnote\" style={styles.editedText}>\n Edited\n </Text>\n </Text>\n )}\n </View>\n )}\n </View>\n {message.mine && (\n <MyReplyConnector message={message} messageBubbleHeight={messageBubbleHeight} />\n )}\n </Animated.View>\n </Pressable>\n )\n}\n\nconst useMessageStyles = ({ mine }: MessageResource) => {\n const { colors } = useTheme()\n const myMessageBackgroundColor = useInteractionGhostBackgroundColor()\n const { width } = useWindowDimensions()\n const tabletWidth = width >= 744 // Smallest iPad Mini's width\n\n const messageBubbleBackgroundColor = mine ? myMessageBackgroundColor : colors.fillColorNeutral070\n\n return StyleSheet.create({\n message: {\n gap: 8,\n flexDirection: mine ? 'row-reverse' : 'row',\n paddingHorizontal: CONVERSATION_MESSAGE_LIST_PADDING_HORIZONTAL,\n },\n messageContent: {\n flex: 1,\n gap: 4,\n },\n avatar: {\n marginBottom: 8,\n },\n avatarPlaceholder: {\n width: MESSAGE_AUTHOR_AVATAR_COLUMN_WIDTH, // Same width as avatar\n },\n messageBubble: {\n backgroundColor: messageBubbleBackgroundColor,\n borderRadius: 8,\n maxWidth: tabletWidth ? 360 : '80%',\n alignSelf: mine ? 'flex-end' : 'flex-start',\n },\n messageText: {\n paddingVertical: 6,\n paddingHorizontal: 8,\n },\n messageReactions: {\n flexDirection: 'row',\n gap: 4,\n justifyContent: mine ? 'flex-end' : 'flex-start',\n },\n messageReplyCount: {\n alignSelf: mine ? 'flex-end' : 'flex-start',\n },\n messageMeta: {\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: mine ? 'flex-end' : 'flex-start',\n gap: 4,\n },\n editedText: {\n fontWeight: platformFontWeightMedium,\n },\n pendingIndicatorContainer: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 4,\n },\n errorContainer: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 4,\n },\n errorIcon: {\n color: colors.statusErrorIcon,\n },\n errorText: {\n color: colors.statusErrorText,\n },\n })\n}\n"]}
|
|
@@ -11,8 +11,9 @@ export declare const MessageForm: {
|
|
|
11
11
|
interface MessagesFormRootProps extends ViewProps {
|
|
12
12
|
conversation: ConversationResource;
|
|
13
13
|
currentlyEditingMessage?: MessageResource | null;
|
|
14
|
+
replyRootId?: string;
|
|
14
15
|
}
|
|
15
|
-
declare function MessageFormRoot({ conversation, currentlyEditingMessage, children, }: MessagesFormRootProps): React.JSX.Element;
|
|
16
|
+
declare function MessageFormRoot({ conversation, currentlyEditingMessage, children, replyRootId, }: MessagesFormRootProps): React.JSX.Element;
|
|
16
17
|
declare function MessageFormInput(): React.JSX.Element;
|
|
17
18
|
declare function MessageFormSubmitBtn(): React.JSX.Element;
|
|
18
19
|
declare function MessageFormAttachmentPicker(): React.JSX.Element | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message_form.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/message_form.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAuD,MAAM,OAAO,CAAA;AAC3E,OAAO,EAOL,SAAS,EAEV,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"message_form.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/message_form.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAuD,MAAM,OAAO,CAAA;AAC3E,OAAO,EAOL,SAAS,EAEV,MAAM,cAAc,CAAA;AAQrB,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAyBnE,eAAO,MAAM,WAAW;;;;;;CAOvB,CAAA;AAED,UAAU,qBAAsB,SAAQ,SAAS;IAC/C,YAAY,EAAE,oBAAoB,CAAA;IAClC,uBAAuB,CAAC,EAAE,eAAe,GAAG,IAAI,CAAA;IAChD,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AA8BD,iBAAS,eAAe,CAAC,EACvB,YAAY,EACZ,uBAAuB,EACvB,QAAQ,EACR,WAAW,GACZ,EAAE,qBAAqB,qBAkKvB;AAkDD,iBAAS,gBAAgB,sBA+CxB;AAcD,iBAAS,oBAAoB,sBAgD5B;AAED,iBAAS,2BAA2B,6BAoFnC;AAED,iBAAS,mBAAmB,6BAkC3B"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { useNavigation, useTheme as useNavigationTheme, useRoute, } from '@react-navigation/native';
|
|
2
2
|
import React, { useCallback, useContext, useEffect, useState } from 'react';
|
|
3
3
|
import { Platform, Pressable, ScrollView, StyleSheet, TextInput, View, Keyboard, } from 'react-native';
|
|
4
|
-
import { Icon, IconButton, Text, TextButton } from '../../components';
|
|
5
|
-
import { useCreateAndroidRippleColor, useTheme, useInteractionGhostBackgroundColor, } from '../../hooks';
|
|
4
|
+
import { Heading, Icon, IconButton, Text, TextButton } from '../../components';
|
|
5
|
+
import { useCreateAndroidRippleColor, useTheme, useInteractionGhostBackgroundColor, useScalableNumberOfLines, } from '../../hooks';
|
|
6
6
|
import { ChatContext } from '../../contexts/chat_context';
|
|
7
7
|
import { Haptic, ImagePicker } from '../../utils/native_adapters';
|
|
8
|
-
import { platformFontWeightMedium, platformPressedOpacityStyle } from '../../utils';
|
|
8
|
+
import { MAX_FONT_SIZE_MULTIPLIER_LANDMARK, REPLIES_FEATURE_ENABLED, platformFontWeightMedium, platformPressedOpacityStyle, } from '../../utils';
|
|
9
9
|
import { useAttachmentUploader } from '../../hooks/use_attachment_uploader';
|
|
10
10
|
import { useMessageDraft } from '../../hooks/use_message_draft';
|
|
11
11
|
import { MessageFormAttachmentImage } from './message_form/message_form_attachment_image';
|
|
@@ -31,10 +31,11 @@ const MessageFormContext = React.createContext({
|
|
|
31
31
|
setUsingGiphy: (_usingGiphy) => { },
|
|
32
32
|
currentlyEditingMessage: null,
|
|
33
33
|
reset: () => { },
|
|
34
|
+
replyRootId: undefined,
|
|
34
35
|
});
|
|
35
36
|
const GIPHY_MAX_LENGTH = 50;
|
|
36
37
|
const MAX_MESSAGE_LENGTH = 5000;
|
|
37
|
-
function MessageFormRoot({ conversation, currentlyEditingMessage, children, }) {
|
|
38
|
+
function MessageFormRoot({ conversation, currentlyEditingMessage, children, replyRootId, }) {
|
|
38
39
|
const { giphyApiKey } = useContext(ChatContext);
|
|
39
40
|
const canGiphy = !!giphyApiKey && !currentlyEditingMessage;
|
|
40
41
|
const styles = useMessageFormStyles();
|
|
@@ -49,6 +50,7 @@ function MessageFormRoot({ conversation, currentlyEditingMessage, children, }) {
|
|
|
49
50
|
const { status, isPending, reset: resetMutation, mutateAsync, } = useMessageCreateOrUpdate({
|
|
50
51
|
conversationId: conversation.id,
|
|
51
52
|
message: currentlyEditingMessage || undefined,
|
|
53
|
+
replyRootId,
|
|
52
54
|
});
|
|
53
55
|
const attachmentUploader = useAttachmentUploader({
|
|
54
56
|
conversationId: conversation.id,
|
|
@@ -171,9 +173,11 @@ function MessageFormRoot({ conversation, currentlyEditingMessage, children, }) {
|
|
|
171
173
|
attachmentUploader,
|
|
172
174
|
currentlyEditingMessage,
|
|
173
175
|
reset,
|
|
176
|
+
replyRootId,
|
|
174
177
|
}}>
|
|
175
178
|
<View style={styles.container}>
|
|
176
179
|
<EditingIndicator />
|
|
180
|
+
<ReplyIndicator />
|
|
177
181
|
<View style={styles.textInputContainer}>{children}</View>
|
|
178
182
|
</View>
|
|
179
183
|
</MessageFormContext.Provider>);
|
|
@@ -327,19 +331,31 @@ function MessageFormCommands() {
|
|
|
327
331
|
}
|
|
328
332
|
function EditingIndicator() {
|
|
329
333
|
const { currentlyEditingMessage, reset } = React.useContext(MessageFormContext);
|
|
330
|
-
const styles = useMessageFormStyles();
|
|
331
334
|
if (!currentlyEditingMessage) {
|
|
332
335
|
return null;
|
|
333
336
|
}
|
|
334
|
-
return (<
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
337
|
+
return (<FormIndicatorRow title="Editing message" buttonText="Cancel" accessibilityHint="Exit message editing mode without saving" iconName="accounts.editor" onPress={() => reset()}/>);
|
|
338
|
+
}
|
|
339
|
+
function ReplyIndicator() {
|
|
340
|
+
const { replyRootId } = React.useContext(MessageFormContext);
|
|
341
|
+
const navigation = useNavigation();
|
|
342
|
+
if (!REPLIES_FEATURE_ENABLED || !replyRootId)
|
|
343
|
+
return null;
|
|
344
|
+
return (<FormIndicatorRow title="Reply" // TODO: Get root reply author
|
|
345
|
+
buttonText="Exit replies" accessibilityHint="Return to the main conversation" iconName="registrations.undo" onPress={() => navigation.goBack()}/>);
|
|
346
|
+
}
|
|
347
|
+
function FormIndicatorRow({ title, buttonText, accessibilityHint, iconName, onPress, }) {
|
|
348
|
+
const styles = useMessageFormStyles();
|
|
349
|
+
const scalableNumberOfLines = useScalableNumberOfLines(1);
|
|
350
|
+
return (<View style={styles.formIndicatorRow}>
|
|
351
|
+
<View style={styles.formIndicatorRowTitleContainer}>
|
|
352
|
+
<Icon name={iconName} size={16} style={styles.formIndicatorRowIcon}/>
|
|
353
|
+
<Heading variant="h4" style={styles.formIndicatorRowTitle} numberOfLines={scalableNumberOfLines} maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}>
|
|
354
|
+
{title}
|
|
355
|
+
</Heading>
|
|
340
356
|
</View>
|
|
341
|
-
<TextButton onPress={
|
|
342
|
-
|
|
357
|
+
<TextButton onPress={onPress} accessibilityHint={accessibilityHint} maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}>
|
|
358
|
+
{buttonText}
|
|
343
359
|
</TextButton>
|
|
344
360
|
</View>);
|
|
345
361
|
}
|
|
@@ -469,20 +485,26 @@ const useMessageFormStyles = () => {
|
|
|
469
485
|
paddingHorizontal: 16,
|
|
470
486
|
paddingVertical: 4,
|
|
471
487
|
},
|
|
472
|
-
|
|
488
|
+
formIndicatorRow: {
|
|
473
489
|
flexDirection: 'row',
|
|
474
490
|
alignItems: 'center',
|
|
475
491
|
justifyContent: 'space-between',
|
|
476
492
|
gap: 8,
|
|
477
493
|
paddingBottom: 12,
|
|
478
494
|
},
|
|
479
|
-
|
|
495
|
+
formIndicatorRowTitleContainer: {
|
|
480
496
|
flexDirection: 'row',
|
|
481
497
|
alignItems: 'center',
|
|
482
498
|
gap: 8,
|
|
499
|
+
flex: 1,
|
|
500
|
+
},
|
|
501
|
+
formIndicatorRowIcon: {
|
|
502
|
+
color: theme.colors.iconColorDefaultSecondary,
|
|
483
503
|
},
|
|
484
|
-
|
|
504
|
+
formIndicatorRowTitle: {
|
|
485
505
|
fontWeight: platformFontWeightMedium,
|
|
506
|
+
textTransform: 'none',
|
|
507
|
+
flexShrink: 1,
|
|
486
508
|
},
|
|
487
509
|
});
|
|
488
510
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message_form.js","sourceRoot":"","sources":["../../../src/components/conversation/message_form.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,aAAa,EACb,QAAQ,IAAI,kBAAkB,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EAAE,EAAE;SACR;QACD,sBAAsB,EAAE;YACtB,eAAe,EAAE,KAAK,CAAC,MAAM,CAAC,mBAAmB;YACjD,YAAY,EAAE,EAAE;YAChB,MAAM,EAAE,UAAU;YAClB,KAAK,EAAE,UAAU;YACjB,SAAS,EAAE,CAAC;YACZ,GAAG,QAAQ,CAAC,MAAM,CAAC;gBACjB,GAAG,EAAE;oBACH,WAAW,EAAE,CAAC;oBACd,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,sBAAsB;iBACjD;gBACD,OAAO,EAAE,IAAI;aACd,CAAC;SACH;QACD,sBAAsB,EAAE;YACtB,QAAQ,EAAE,QAAQ;YAClB,iBAAiB,EAAE,EAAE;YACrB,UAAU,EAAE,EAAE;YACd,GAAG,EAAE,CAAC;SACP;QACD,iBAAiB,EAAE;YACjB,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,eAAe;YACnC,QAAQ,EAAE,EAAE;YACZ,iBAAiB,EAAE,EAAE;YACrB,eAAe,EAAE,CAAC;SACnB;QACD,gBAAgB,EAAE;YAChB,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,cAAc,EAAE,eAAe;YAC/B,GAAG,EAAE,CAAC;YACN,aAAa,EAAE,EAAE;SAClB;QACD,8BAA8B,EAAE;YAC9B,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,GAAG,EAAE,CAAC;SACP;QACD,qBAAqB,EAAE;YACrB,UAAU,EAAE,wBAAwB;SACrC;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import {\n RouteProp,\n useNavigation,\n useTheme as useNavigationTheme,\n useRoute,\n} from '@react-navigation/native'\nimport React, { useCallback, useContext, useEffect, useState } from 'react'\nimport {\n Platform,\n Pressable,\n ScrollView,\n StyleSheet,\n TextInput,\n View,\n ViewProps,\n Keyboard,\n} from 'react-native'\nimport { Icon, IconButton, Text, TextButton } from '../../components'\nimport {\n useCreateAndroidRippleColor,\n useTheme,\n useInteractionGhostBackgroundColor,\n} from '../../hooks'\nimport { ConversationResource, MessageResource } from '../../types'\n\nimport { ConversationScreenProps } from '../../screens/conversation_screen'\n\nimport { ChatContext } from '../../contexts/chat_context'\nimport { Haptic, ImagePicker, ImagePickerResult } from '../../utils/native_adapters'\nimport { platformFontWeightMedium, platformPressedOpacityStyle } from '../../utils'\nimport { useAttachmentUploader } from '../../hooks/use_attachment_uploader'\nimport { useMessageDraft } from '../../hooks/use_message_draft'\nimport {\n DenormalizedAttachmentResourceForCreate,\n DenormalizedMessageAttachmentResourceForCreate,\n} from '../../types/resources/denormalized_attachment_resource_for_create'\nimport { MessageFormAttachmentImage } from './message_form/message_form_attachment_image'\nimport { useMessageCreateOrUpdate } from '../../hooks/use_message_create_or_update'\nimport { useBroadcastTypingStatus } from '../../hooks/use_broadcast_typing_status'\nimport { tokens } from '../../vendor/tapestry/tokens'\nimport LinearGradient from 'react-native-linear-gradient'\nimport { MessageFormAttachmentVideo } from './message_form/message_form_attachment_video'\n\nexport const MessageForm = {\n Root: MessageFormRoot,\n\n TextInput: MessageFormInput,\n SubmitButton: MessageFormSubmitBtn,\n AttachmentPicker: MessageFormAttachmentPicker,\n Commands: MessageFormCommands,\n}\n\ninterface MessagesFormRootProps extends ViewProps {\n conversation: ConversationResource\n currentlyEditingMessage?: MessageResource | null\n}\n\nconst MessageFormContext = React.createContext<{\n text: string\n setText: (text: string) => void\n onSubmit: () => void\n disabled: boolean\n canGiphy: boolean\n usingGiphy: boolean\n setUsingGiphy: (usingGiphy: boolean) => void\n attachmentUploader?: ReturnType<typeof useAttachmentUploader>\n currentlyEditingMessage?: MessageResource | null\n reset: () => void\n}>({\n text: '',\n setText: (_text: string) => {},\n onSubmit: () => {},\n disabled: false,\n canGiphy: false,\n usingGiphy: false,\n setUsingGiphy: (_usingGiphy: boolean) => {},\n currentlyEditingMessage: null,\n reset: () => {},\n})\n\nconst GIPHY_MAX_LENGTH = 50\nconst MAX_MESSAGE_LENGTH = 5000\n\nfunction MessageFormRoot({\n conversation,\n currentlyEditingMessage,\n children,\n}: MessagesFormRootProps) {\n const { giphyApiKey } = useContext(ChatContext)\n const canGiphy = !!giphyApiKey && !currentlyEditingMessage\n const styles = useMessageFormStyles()\n const { draft, saveDraft, clearDraft } = useMessageDraft(conversation.id)\n const [text, setText] = React.useState(() => {\n // Initialize from draft only when not editing a message\n return currentlyEditingMessage ? '' : draft?.text || ''\n })\n const [usingGiphy, setUsingGiphy] = useState(false)\n const navigation = useNavigation()\n const route = useRoute() as ConversationScreenProps['route']\n const {\n status,\n isPending,\n reset: resetMutation,\n mutateAsync,\n } = useMessageCreateOrUpdate({\n conversationId: conversation.id,\n message: currentlyEditingMessage || undefined,\n })\n const attachmentUploader = useAttachmentUploader({\n conversationId: conversation.id,\n draftAttachments: currentlyEditingMessage ? undefined : draft?.attachments,\n })\n const resetAttachmentUploader = attachmentUploader.reset\n\n const reset = useCallback(() => {\n resetAttachmentUploader()\n resetMutation()\n setText('')\n setUsingGiphy(false)\n if (!currentlyEditingMessage) {\n clearDraft()\n }\n navigation.setParams({\n editing_message_id: null,\n })\n }, [resetAttachmentUploader, resetMutation, navigation, currentlyEditingMessage, clearDraft])\n\n useEffect(() => {\n if (canGiphy && !usingGiphy && text.startsWith('/giphy ')) {\n setUsingGiphy(true)\n setText('')\n }\n }, [canGiphy, text, usingGiphy])\n\n useEffect(() => {\n switch (status) {\n case 'success':\n reset()\n break\n }\n }, [reset, status])\n\n useEffect(() => {\n if (route.params.clear_input) {\n reset()\n navigation.setParams({ ...route.params, clear_input: false })\n }\n }, [reset, navigation, route.params])\n\n // Save draft when text or attachments change (debounced)\n useEffect(() => {\n // Don't save drafts when editing a message\n if (currentlyEditingMessage) return\n\n const timeoutId = setTimeout(() => {\n saveDraft(text, attachmentUploader.attachments)\n }, 500)\n\n return () => clearTimeout(timeoutId)\n }, [text, attachmentUploader.attachments, saveDraft, currentlyEditingMessage])\n\n const canSubmit = (() => {\n if (isPending) return false\n if (attachmentUploader?.pendingUploads) return false\n if (text.length > 0) return true\n if (attachmentUploader?.attachments?.length) return true\n return false\n })()\n const disabled = !canSubmit\n\n /*\n Opening a FormSheet on Android while the keyboard is visible breaks the FormSheet's height & position.\n This is a workaround to ensure we don't open the FormSheet while the keyboard is visible.\n */\n const navigateToSendGiphyAfterKeyboardHides = useCallback(() => {\n if (!Keyboard.isVisible() || Platform.OS === 'ios') {\n navigation.navigate('SendGiphy', {\n conversation_id: conversation.id,\n search_term: text,\n })\n } else {\n const keyboardListener = Keyboard.addListener('keyboardDidHide', () => {\n navigation.navigate('SendGiphy', {\n conversation_id: conversation.id,\n search_term: text,\n })\n keyboardListener?.remove()\n })\n }\n }, [conversation.id, navigation, text])\n\n const handleSubmit = () => {\n if (!canSubmit) return\n\n if (canGiphy && usingGiphy) {\n TextInput.State.blurTextInput(TextInput.State.currentlyFocusedInput())\n Haptic.impactLight()\n navigateToSendGiphyAfterKeyboardHides()\n } else {\n let attachmentsForSubmit: DenormalizedAttachmentResourceForCreate[] =\n attachmentUploader.attachments\n .filter(a => a.status === 'success' && a.id)\n .map(\n (attachment): DenormalizedMessageAttachmentResourceForCreate => ({\n type: 'MessageAttachment',\n id: attachment.id as string,\n file: attachment.file,\n })\n )\n if (currentlyEditingMessage) {\n mutateAsync({ text })\n reset()\n } else {\n mutateAsync({ text, attachments: attachmentsForSubmit })\n reset()\n }\n }\n }\n\n useEffect(() => {\n if (currentlyEditingMessage) {\n setText(currentlyEditingMessage.text || '')\n }\n }, [currentlyEditingMessage])\n\n return (\n <MessageFormContext.Provider\n value={{\n text,\n setText,\n onSubmit: handleSubmit,\n disabled,\n canGiphy,\n usingGiphy,\n setUsingGiphy,\n attachmentUploader,\n currentlyEditingMessage,\n reset,\n }}\n >\n <View style={styles.container}>\n <EditingIndicator />\n <View style={styles.textInputContainer}>{children}</View>\n </View>\n </MessageFormContext.Provider>\n )\n}\n\nfunction MessageFormAttachments() {\n const styles = useMessageFormStyles()\n const { attachmentUploader } = React.useContext(MessageFormContext)\n const numberOfAttachments = attachmentUploader?.attachments?.length || 0\n const attachments = attachmentUploader?.attachments || []\n\n if (numberOfAttachments === 0) {\n return null\n }\n\n return (\n <ScrollView\n horizontal\n showsHorizontalScrollIndicator={false}\n contentContainerStyle={styles.messageFormAttachments}\n >\n {attachments.map(attachment => {\n if (attachment.file.type.startsWith('video/')) {\n return (\n <MessageFormAttachmentVideo\n key={attachment.file.uri}\n name={attachment.file.name}\n status={attachment.status}\n removeAttachment={() => {\n attachmentUploader?.removeAttachment(attachment)\n }}\n />\n )\n }\n\n return (\n <MessageFormAttachmentImage\n key={attachment.file.uri}\n uri={attachment.file.uri}\n alt={attachment.file.name}\n status={attachment.status}\n width={attachment.file.width}\n height={attachment.file.height}\n removeAttachment={() => {\n attachmentUploader?.removeAttachment(attachment)\n }}\n />\n )\n })}\n </ScrollView>\n )\n}\n\nfunction MessageFormInput() {\n const styles = useMessageFormStyles()\n const theme = useTheme()\n const { text, setText, onSubmit, usingGiphy, attachmentUploader } =\n React.useContext(MessageFormContext)\n const attachmentError = attachmentUploader?.errorMessage\n\n const route = useRoute<RouteProp<ConversationScreenProps['route']>>()\n const conversationId = route.params.conversation_id\n const broadcastTypingStatus = useBroadcastTypingStatus(conversationId)\n\n const handleTextChange = (newText: string) => {\n setText(newText)\n\n if (newText.length > 0) {\n broadcastTypingStatus()\n }\n }\n\n return (\n <View style={styles.textInputBoundary}>\n <MessageFormAttachments />\n {attachmentError ? <Text style={styles.inputErrorMessage}>{attachmentError}</Text> : null}\n <View style={styles.textInputRow}>\n {usingGiphy ? (\n <View style={styles.giphyBadge}>\n <Icon name=\"general.bolt\" style={styles.giphyBadgeIcon} />\n <Text variant=\"tertiary\" style={styles.giphyBadgeText}>\n /giphy\n </Text>\n </View>\n ) : null}\n\n <TextInput\n style={[styles.textInput, usingGiphy && styles.textInputWithGiphy]}\n multiline={true}\n placeholder={usingGiphy ? 'search GIFs' : 'Send a message'}\n placeholderTextColor={theme.colors.textColorDefaultPlaceholder}\n onChangeText={handleTextChange}\n value={text}\n maxLength={usingGiphy ? GIPHY_MAX_LENGTH : MAX_MESSAGE_LENGTH}\n onSubmitEditing={onSubmit}\n submitBehavior={usingGiphy ? 'submit' : 'newline'}\n />\n </View>\n </View>\n )\n}\n\nconst SUBMIT_ACCESSIBILITY_LABEL_MAP = {\n giphy: 'Search Giphy',\n editing: 'Save changes',\n send: 'Send message',\n} as const\n\nconst SUBMIT_ICON_NAME_MAP = {\n giphy: 'general.search',\n editing: 'general.check',\n send: 'general.upArrow',\n} as const\n\nfunction MessageFormSubmitBtn() {\n const { onSubmit, disabled, usingGiphy, currentlyEditingMessage } =\n React.useContext(MessageFormContext)\n const styles = useMessageFormStyles()\n const { colors } = useTheme()\n\n const formStateKey = usingGiphy ? 'giphy' : currentlyEditingMessage ? 'editing' : 'send'\n const colorKey = disabled ? 'disabled' : 'interaction'\n const interactionStart = colors.buttonStart || colors.interaction\n const interactionEnd = colors.buttonEnd || colors.interaction\n const colorMap = {\n disabled: [\n colors.fillColorButtonNeutralSolidDisabled,\n colors.fillColorButtonNeutralSolidDisabled,\n ],\n interaction: [interactionStart, interactionEnd],\n }\n\n const androidRippleColor = useCreateAndroidRippleColor({ color: colorMap[colorKey][0] })\n const gradientColors = colorMap[colorKey] as [string, string]\n const iconStyles = [styles.submitIcon, disabled && styles.submitIconDisabled]\n\n return (\n <Pressable\n disabled={disabled}\n onPress={onSubmit}\n accessibilityRole=\"button\"\n accessibilityLabel={SUBMIT_ACCESSIBILITY_LABEL_MAP[formStateKey]}\n style={({ pressed }) => [\n styles.submitPressableWrapper,\n pressed && platformPressedOpacityStyle,\n ]}\n android_ripple={{ color: androidRippleColor, borderless: false, foreground: true }}\n >\n <LinearGradient\n start={{ x: 0.1, y: 0.1 }}\n end={{ x: 0.9, y: 0.9 }}\n colors={gradientColors}\n style={styles.submitGradientWrapper}\n >\n <Icon\n name={SUBMIT_ICON_NAME_MAP[formStateKey]}\n style={iconStyles}\n accessibilityElementsHidden={true}\n />\n </LinearGradient>\n </Pressable>\n )\n}\n\nfunction MessageFormAttachmentPicker() {\n const styles = useMessageFormStyles()\n const { usingGiphy, attachmentUploader, currentlyEditingMessage } =\n React.useContext(MessageFormContext)\n const [isOpen, setIsOpen] = useState(false)\n\n function uploadImagePickerResult(result: ImagePickerResult) {\n if (result.canceled) {\n return\n }\n\n const filteredAssets = result.assets\n .filter(asset => {\n return asset.fileSize && asset.mimeType && asset.uri\n })\n .map(asset => {\n return {\n uri: asset.uri,\n name: asset.fileName || asset.uri.split('/').pop() || 'attachment',\n type: asset.mimeType as string,\n size: asset.fileSize as number,\n height: asset.height,\n width: asset.width,\n }\n })\n\n attachmentUploader?.handleFilesAttached(filteredAssets)\n }\n\n const openCamera = async () => {\n setIsOpen(false)\n let result = await ImagePicker.openCameraAsync()\n if (!result.canceled) {\n uploadImagePickerResult(result)\n }\n }\n\n const pickImage = async () => {\n setIsOpen(false)\n let result = await ImagePicker.openImageLibraryAsync()\n if (!result.canceled) {\n uploadImagePickerResult(result)\n }\n }\n\n if (usingGiphy || currentlyEditingMessage) {\n return null\n }\n\n return (\n <View style={styles.attachmentPicker}>\n {isOpen && (\n <View style={styles.attachmentPickerButtonsContainer}>\n <IconButton\n accessibilityLabel=\"Take a photo\"\n accessibilityHint=\"Opens your camera\"\n size=\"lg\"\n appearance=\"neutral\"\n name=\"chat.camera\"\n onPress={openCamera}\n style={styles.attachmentPickerButton}\n />\n <IconButton\n accessibilityLabel=\"Choose a photo\"\n accessibilityHint=\"Opens your photo gallery\"\n size=\"lg\"\n appearance=\"neutral\"\n name=\"churchCenter.photosIos\"\n onPress={pickImage}\n style={styles.attachmentPickerButton}\n />\n </View>\n )}\n <IconButton\n accessibilityLabel=\"File Menu\"\n accessibilityHint=\"Opens options to attach or take a photo\"\n size=\"lg\"\n appearance=\"neutral\"\n name=\"general.paperclip\"\n onPress={() => setIsOpen(!isOpen)}\n style={styles.formButton}\n />\n </View>\n )\n}\n\nfunction MessageFormCommands() {\n const { text, canGiphy, usingGiphy, setUsingGiphy } = React.useContext(MessageFormContext)\n const styles = useMessageFormStyles()\n\n if (!canGiphy) {\n return null\n }\n\n if (usingGiphy) {\n return (\n <IconButton\n accessibilityLabel=\"Exit Giphy Search\"\n accessibilityHint=\"Changes input back to a text field for sending messages\"\n size=\"lg\"\n appearance=\"neutral\"\n name=\"general.xCircle\"\n onPress={() => setUsingGiphy(false)}\n style={styles.formButton}\n />\n )\n }\n\n return (\n <IconButton\n accessibilityLabel=\"Search Giphy\"\n accessibilityHint=\"Changes input into a search field for finding Giphys\"\n size=\"lg\"\n appearance=\"neutral\"\n name={'general.bolt'}\n onPress={() => setUsingGiphy(true)}\n disabled={text.length > GIPHY_MAX_LENGTH}\n style={styles.formButton}\n />\n )\n}\n\nfunction EditingIndicator() {\n const { currentlyEditingMessage, reset } = React.useContext(MessageFormContext)\n const styles = useMessageFormStyles()\n\n if (!currentlyEditingMessage) {\n return null\n }\n\n return (\n <View style={styles.editingIndicator}>\n <View style={styles.editingIndicatorTitleContainer}>\n <Icon name=\"accounts.editor\" size={16} />\n <Text variant=\"tertiary\" style={styles.editingIndicatorTitle}>\n Editing message\n </Text>\n </View>\n <TextButton\n onPress={() => reset()}\n accessibilityHint=\"Exit message editing mode without saving\"\n >\n Cancel\n </TextButton>\n </View>\n )\n}\n\nconst useMessageFormStyles = () => {\n const theme = useTheme()\n const navigationTheme = useNavigationTheme()\n const buttonSize = 38\n\n const giphyBadgeBackgroundColor = useInteractionGhostBackgroundColor()\n\n return StyleSheet.create({\n container: {\n borderColor: theme.colors.borderColorDefaultDim,\n borderTopWidth: 1,\n padding: 12,\n },\n textInputContainer: {\n backgroundColor: navigationTheme.colors.card,\n flexDirection: 'row',\n alignItems: 'flex-end',\n gap: 16,\n },\n textInputBoundary: {\n overflow: 'hidden',\n borderRadius: 24,\n borderWidth: 1,\n borderColor: theme.colors.fillColorNeutral050Base,\n flex: 1,\n gap: 8,\n },\n textInputRow: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 8,\n },\n textInput: {\n paddingBottom: 8,\n // TODO: Remove iOS's extra top padding and use `textAlignVertical: \"center\"` for both platforms when services-react-native upgrades to v0.74.5 or greater.\n paddingTop: Platform.select({\n ios: 9, // Extra padding compensates for `textAlignVertical` not working in Services iOS.\n default: 8,\n }),\n textAlignVertical: Platform.select({\n ios: 'top', // Services iOS doesn't support `textAlignVertical` due to its lower React Native version of 0.72.14. (React Native 0.74.5+ seems to support this style.)\n default: 'center', // centers the text vertically for multiline TextInput.\n }),\n paddingHorizontal: 16,\n color: theme.colors.textColorDefaultPrimary,\n justifyContent: 'center',\n flex: 1,\n fontSize: 16,\n maxHeight: 200,\n },\n textInputWithGiphy: {\n paddingLeft: 0,\n },\n giphyBadge: {\n backgroundColor: giphyBadgeBackgroundColor,\n borderRadius: 24,\n paddingVertical: 4,\n paddingHorizontal: 12,\n marginLeft: 6,\n flexDirection: 'row',\n alignItems: 'center',\n gap: 4,\n },\n giphyBadgeText: {\n color: theme.colors.interaction,\n marginBottom: 1,\n },\n giphyBadgeIcon: {\n color: theme.colors.interaction,\n },\n formButton: {\n height: buttonSize,\n },\n submitPressableWrapper: {\n borderRadius: buttonSize,\n overflow: 'hidden',\n },\n submitGradientWrapper: {\n flexDirection: 'row',\n justifyContent: 'center',\n alignItems: 'center',\n borderRadius: buttonSize,\n height: buttonSize,\n width: buttonSize,\n },\n submitIcon: {\n fontSize: 16,\n color: tokens.colorNeutral100White,\n },\n submitIconDisabled: {\n color: theme.colors.iconColorDefaultDisabled,\n },\n attachmentPicker: {\n position: 'relative',\n },\n attachmentPickerButtonsContainer: {\n position: 'absolute',\n left: 0,\n bottom: 40,\n zIndex: 10,\n gap: 12,\n },\n attachmentPickerButton: {\n backgroundColor: theme.colors.fillColorNeutral070,\n borderRadius: 20,\n height: buttonSize,\n width: buttonSize,\n elevation: 3,\n ...Platform.select({\n ios: {\n borderWidth: 1,\n borderColor: theme.colors.borderColorDefaultBase,\n },\n default: null,\n }),\n },\n messageFormAttachments: {\n overflow: 'hidden',\n paddingHorizontal: 12,\n paddingTop: 12,\n gap: 8,\n },\n inputErrorMessage: {\n color: theme.colors.statusErrorText,\n fontSize: 14,\n paddingHorizontal: 16,\n paddingVertical: 4,\n },\n editingIndicator: {\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'space-between',\n gap: 8,\n paddingBottom: 12,\n },\n editingIndicatorTitleContainer: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 8,\n },\n editingIndicatorTitle: {\n fontWeight: platformFontWeightMedium,\n },\n })\n}\n"]}
|
|
1
|
+
{"version":3,"file":"message_form.js","sourceRoot":"","sources":["../../../src/components/conversation/message_form.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,aAAa,EACb,QAAQ,IAAI,kBAAkB,EAC9B,QAAQ,GACT,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC3E,OAAO,EACL,QAAQ,EACR,SAAS,EACT,UAAU,EACV,UAAU,EACV,SAAS,EACT,IAAI,EAEJ,QAAQ,GACT,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAc,IAAI,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC1F,OAAO,EACL,2BAA2B,EAC3B,QAAQ,EACR,kCAAkC,EAClC,wBAAwB,GACzB,MAAM,aAAa,CAAA;AAKpB,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AACzD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAqB,MAAM,6BAA6B,CAAA;AACpF,OAAO,EACL,iCAAiC,EACjC,uBAAuB,EACvB,wBAAwB,EACxB,2BAA2B,GAC5B,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAA;AAC3E,OAAO,EAAE,eAAe,EAA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EAAE,EAAE;SAClB;QACD,8BAA8B,EAAE;YAC9B,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,GAAG,EAAE,CAAC;YACN,IAAI,EAAE,CAAC;SACR;QACD,oBAAoB,EAAE;YACpB,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,yBAAyB;SAC9C;QACD,qBAAqB,EAAE;YACrB,UAAU,EAAE,wBAAwB;YACpC,aAAa,EAAE,MAAM;YACrB,UAAU,EAAE,CAAC;SACd;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import {\n RouteProp,\n useNavigation,\n useTheme as useNavigationTheme,\n useRoute,\n} from '@react-navigation/native'\nimport React, { useCallback, useContext, useEffect, useState } from 'react'\nimport {\n Platform,\n Pressable,\n ScrollView,\n StyleSheet,\n TextInput,\n View,\n ViewProps,\n Keyboard,\n} from 'react-native'\nimport { Heading, Icon, IconButton, IconString, Text, TextButton } from '../../components'\nimport {\n useCreateAndroidRippleColor,\n useTheme,\n useInteractionGhostBackgroundColor,\n useScalableNumberOfLines,\n} from '../../hooks'\nimport { ConversationResource, MessageResource } from '../../types'\n\nimport { ConversationScreenProps } from '../../screens/conversation_screen'\n\nimport { ChatContext } from '../../contexts/chat_context'\nimport { Haptic, ImagePicker, ImagePickerResult } from '../../utils/native_adapters'\nimport {\n MAX_FONT_SIZE_MULTIPLIER_LANDMARK,\n REPLIES_FEATURE_ENABLED,\n platformFontWeightMedium,\n platformPressedOpacityStyle,\n} from '../../utils'\nimport { useAttachmentUploader } from '../../hooks/use_attachment_uploader'\nimport { useMessageDraft } from '../../hooks/use_message_draft'\nimport {\n DenormalizedAttachmentResourceForCreate,\n DenormalizedMessageAttachmentResourceForCreate,\n} from '../../types/resources/denormalized_attachment_resource_for_create'\nimport { MessageFormAttachmentImage } from './message_form/message_form_attachment_image'\nimport { useMessageCreateOrUpdate } from '../../hooks/use_message_create_or_update'\nimport { useBroadcastTypingStatus } from '../../hooks/use_broadcast_typing_status'\nimport { tokens } from '../../vendor/tapestry/tokens'\nimport LinearGradient from 'react-native-linear-gradient'\nimport { MessageFormAttachmentVideo } from './message_form/message_form_attachment_video'\n\nexport const MessageForm = {\n Root: MessageFormRoot,\n\n TextInput: MessageFormInput,\n SubmitButton: MessageFormSubmitBtn,\n AttachmentPicker: MessageFormAttachmentPicker,\n Commands: MessageFormCommands,\n}\n\ninterface MessagesFormRootProps extends ViewProps {\n conversation: ConversationResource\n currentlyEditingMessage?: MessageResource | null\n replyRootId?: string\n}\n\nconst MessageFormContext = React.createContext<{\n text: string\n setText: (text: string) => void\n onSubmit: () => void\n disabled: boolean\n canGiphy: boolean\n usingGiphy: boolean\n setUsingGiphy: (usingGiphy: boolean) => void\n attachmentUploader?: ReturnType<typeof useAttachmentUploader>\n currentlyEditingMessage?: MessageResource | null\n reset: () => void\n replyRootId?: string\n}>({\n text: '',\n setText: (_text: string) => {},\n onSubmit: () => {},\n disabled: false,\n canGiphy: false,\n usingGiphy: false,\n setUsingGiphy: (_usingGiphy: boolean) => {},\n currentlyEditingMessage: null,\n reset: () => {},\n replyRootId: undefined,\n})\n\nconst GIPHY_MAX_LENGTH = 50\nconst MAX_MESSAGE_LENGTH = 5000\n\nfunction MessageFormRoot({\n conversation,\n currentlyEditingMessage,\n children,\n replyRootId,\n}: MessagesFormRootProps) {\n const { giphyApiKey } = useContext(ChatContext)\n const canGiphy = !!giphyApiKey && !currentlyEditingMessage\n const styles = useMessageFormStyles()\n const { draft, saveDraft, clearDraft } = useMessageDraft(conversation.id)\n const [text, setText] = React.useState(() => {\n // Initialize from draft only when not editing a message\n return currentlyEditingMessage ? '' : draft?.text || ''\n })\n const [usingGiphy, setUsingGiphy] = useState(false)\n const navigation = useNavigation()\n const route = useRoute() as ConversationScreenProps['route']\n const {\n status,\n isPending,\n reset: resetMutation,\n mutateAsync,\n } = useMessageCreateOrUpdate({\n conversationId: conversation.id,\n message: currentlyEditingMessage || undefined,\n replyRootId,\n })\n const attachmentUploader = useAttachmentUploader({\n conversationId: conversation.id,\n draftAttachments: currentlyEditingMessage ? undefined : draft?.attachments,\n })\n const resetAttachmentUploader = attachmentUploader.reset\n\n const reset = useCallback(() => {\n resetAttachmentUploader()\n resetMutation()\n setText('')\n setUsingGiphy(false)\n if (!currentlyEditingMessage) {\n clearDraft()\n }\n navigation.setParams({\n editing_message_id: null,\n })\n }, [resetAttachmentUploader, resetMutation, navigation, currentlyEditingMessage, clearDraft])\n\n useEffect(() => {\n if (canGiphy && !usingGiphy && text.startsWith('/giphy ')) {\n setUsingGiphy(true)\n setText('')\n }\n }, [canGiphy, text, usingGiphy])\n\n useEffect(() => {\n switch (status) {\n case 'success':\n reset()\n break\n }\n }, [reset, status])\n\n useEffect(() => {\n if (route.params.clear_input) {\n reset()\n navigation.setParams({ ...route.params, clear_input: false })\n }\n }, [reset, navigation, route.params])\n\n // Save draft when text or attachments change (debounced)\n useEffect(() => {\n // Don't save drafts when editing a message\n if (currentlyEditingMessage) return\n\n const timeoutId = setTimeout(() => {\n saveDraft(text, attachmentUploader.attachments)\n }, 500)\n\n return () => clearTimeout(timeoutId)\n }, [text, attachmentUploader.attachments, saveDraft, currentlyEditingMessage])\n\n const canSubmit = (() => {\n if (isPending) return false\n if (attachmentUploader?.pendingUploads) return false\n if (text.length > 0) return true\n if (attachmentUploader?.attachments?.length) return true\n return false\n })()\n const disabled = !canSubmit\n\n /*\n Opening a FormSheet on Android while the keyboard is visible breaks the FormSheet's height & position.\n This is a workaround to ensure we don't open the FormSheet while the keyboard is visible.\n */\n const navigateToSendGiphyAfterKeyboardHides = useCallback(() => {\n if (!Keyboard.isVisible() || Platform.OS === 'ios') {\n navigation.navigate('SendGiphy', {\n conversation_id: conversation.id,\n search_term: text,\n })\n } else {\n const keyboardListener = Keyboard.addListener('keyboardDidHide', () => {\n navigation.navigate('SendGiphy', {\n conversation_id: conversation.id,\n search_term: text,\n })\n keyboardListener?.remove()\n })\n }\n }, [conversation.id, navigation, text])\n\n const handleSubmit = () => {\n if (!canSubmit) return\n\n if (canGiphy && usingGiphy) {\n TextInput.State.blurTextInput(TextInput.State.currentlyFocusedInput())\n Haptic.impactLight()\n navigateToSendGiphyAfterKeyboardHides()\n } else {\n let attachmentsForSubmit: DenormalizedAttachmentResourceForCreate[] =\n attachmentUploader.attachments\n .filter(a => a.status === 'success' && a.id)\n .map(\n (attachment): DenormalizedMessageAttachmentResourceForCreate => ({\n type: 'MessageAttachment',\n id: attachment.id as string,\n file: attachment.file,\n })\n )\n if (currentlyEditingMessage) {\n mutateAsync({ text })\n reset()\n } else {\n mutateAsync({ text, attachments: attachmentsForSubmit })\n reset()\n }\n }\n }\n\n useEffect(() => {\n if (currentlyEditingMessage) {\n setText(currentlyEditingMessage.text || '')\n }\n }, [currentlyEditingMessage])\n\n return (\n <MessageFormContext.Provider\n value={{\n text,\n setText,\n onSubmit: handleSubmit,\n disabled,\n canGiphy,\n usingGiphy,\n setUsingGiphy,\n attachmentUploader,\n currentlyEditingMessage,\n reset,\n replyRootId,\n }}\n >\n <View style={styles.container}>\n <EditingIndicator />\n <ReplyIndicator />\n <View style={styles.textInputContainer}>{children}</View>\n </View>\n </MessageFormContext.Provider>\n )\n}\n\nfunction MessageFormAttachments() {\n const styles = useMessageFormStyles()\n const { attachmentUploader } = React.useContext(MessageFormContext)\n const numberOfAttachments = attachmentUploader?.attachments?.length || 0\n const attachments = attachmentUploader?.attachments || []\n\n if (numberOfAttachments === 0) {\n return null\n }\n\n return (\n <ScrollView\n horizontal\n showsHorizontalScrollIndicator={false}\n contentContainerStyle={styles.messageFormAttachments}\n >\n {attachments.map(attachment => {\n if (attachment.file.type.startsWith('video/')) {\n return (\n <MessageFormAttachmentVideo\n key={attachment.file.uri}\n name={attachment.file.name}\n status={attachment.status}\n removeAttachment={() => {\n attachmentUploader?.removeAttachment(attachment)\n }}\n />\n )\n }\n\n return (\n <MessageFormAttachmentImage\n key={attachment.file.uri}\n uri={attachment.file.uri}\n alt={attachment.file.name}\n status={attachment.status}\n width={attachment.file.width}\n height={attachment.file.height}\n removeAttachment={() => {\n attachmentUploader?.removeAttachment(attachment)\n }}\n />\n )\n })}\n </ScrollView>\n )\n}\n\nfunction MessageFormInput() {\n const styles = useMessageFormStyles()\n const theme = useTheme()\n const { text, setText, onSubmit, usingGiphy, attachmentUploader } =\n React.useContext(MessageFormContext)\n const attachmentError = attachmentUploader?.errorMessage\n\n const route = useRoute<RouteProp<ConversationScreenProps['route']>>()\n const conversationId = route.params.conversation_id\n const broadcastTypingStatus = useBroadcastTypingStatus(conversationId)\n\n const handleTextChange = (newText: string) => {\n setText(newText)\n\n if (newText.length > 0) {\n broadcastTypingStatus()\n }\n }\n\n return (\n <View style={styles.textInputBoundary}>\n <MessageFormAttachments />\n {attachmentError ? <Text style={styles.inputErrorMessage}>{attachmentError}</Text> : null}\n <View style={styles.textInputRow}>\n {usingGiphy ? (\n <View style={styles.giphyBadge}>\n <Icon name=\"general.bolt\" style={styles.giphyBadgeIcon} />\n <Text variant=\"tertiary\" style={styles.giphyBadgeText}>\n /giphy\n </Text>\n </View>\n ) : null}\n\n <TextInput\n style={[styles.textInput, usingGiphy && styles.textInputWithGiphy]}\n multiline={true}\n placeholder={usingGiphy ? 'search GIFs' : 'Send a message'}\n placeholderTextColor={theme.colors.textColorDefaultPlaceholder}\n onChangeText={handleTextChange}\n value={text}\n maxLength={usingGiphy ? GIPHY_MAX_LENGTH : MAX_MESSAGE_LENGTH}\n onSubmitEditing={onSubmit}\n submitBehavior={usingGiphy ? 'submit' : 'newline'}\n />\n </View>\n </View>\n )\n}\n\nconst SUBMIT_ACCESSIBILITY_LABEL_MAP = {\n giphy: 'Search Giphy',\n editing: 'Save changes',\n send: 'Send message',\n} as const\n\nconst SUBMIT_ICON_NAME_MAP = {\n giphy: 'general.search',\n editing: 'general.check',\n send: 'general.upArrow',\n} as const\n\nfunction MessageFormSubmitBtn() {\n const { onSubmit, disabled, usingGiphy, currentlyEditingMessage } =\n React.useContext(MessageFormContext)\n const styles = useMessageFormStyles()\n const { colors } = useTheme()\n\n const formStateKey = usingGiphy ? 'giphy' : currentlyEditingMessage ? 'editing' : 'send'\n const colorKey = disabled ? 'disabled' : 'interaction'\n const interactionStart = colors.buttonStart || colors.interaction\n const interactionEnd = colors.buttonEnd || colors.interaction\n const colorMap = {\n disabled: [\n colors.fillColorButtonNeutralSolidDisabled,\n colors.fillColorButtonNeutralSolidDisabled,\n ],\n interaction: [interactionStart, interactionEnd],\n }\n\n const androidRippleColor = useCreateAndroidRippleColor({ color: colorMap[colorKey][0] })\n const gradientColors = colorMap[colorKey] as [string, string]\n const iconStyles = [styles.submitIcon, disabled && styles.submitIconDisabled]\n\n return (\n <Pressable\n disabled={disabled}\n onPress={onSubmit}\n accessibilityRole=\"button\"\n accessibilityLabel={SUBMIT_ACCESSIBILITY_LABEL_MAP[formStateKey]}\n style={({ pressed }) => [\n styles.submitPressableWrapper,\n pressed && platformPressedOpacityStyle,\n ]}\n android_ripple={{ color: androidRippleColor, borderless: false, foreground: true }}\n >\n <LinearGradient\n start={{ x: 0.1, y: 0.1 }}\n end={{ x: 0.9, y: 0.9 }}\n colors={gradientColors}\n style={styles.submitGradientWrapper}\n >\n <Icon\n name={SUBMIT_ICON_NAME_MAP[formStateKey]}\n style={iconStyles}\n accessibilityElementsHidden={true}\n />\n </LinearGradient>\n </Pressable>\n )\n}\n\nfunction MessageFormAttachmentPicker() {\n const styles = useMessageFormStyles()\n const { usingGiphy, attachmentUploader, currentlyEditingMessage } =\n React.useContext(MessageFormContext)\n const [isOpen, setIsOpen] = useState(false)\n\n function uploadImagePickerResult(result: ImagePickerResult) {\n if (result.canceled) {\n return\n }\n\n const filteredAssets = result.assets\n .filter(asset => {\n return asset.fileSize && asset.mimeType && asset.uri\n })\n .map(asset => {\n return {\n uri: asset.uri,\n name: asset.fileName || asset.uri.split('/').pop() || 'attachment',\n type: asset.mimeType as string,\n size: asset.fileSize as number,\n height: asset.height,\n width: asset.width,\n }\n })\n\n attachmentUploader?.handleFilesAttached(filteredAssets)\n }\n\n const openCamera = async () => {\n setIsOpen(false)\n let result = await ImagePicker.openCameraAsync()\n if (!result.canceled) {\n uploadImagePickerResult(result)\n }\n }\n\n const pickImage = async () => {\n setIsOpen(false)\n let result = await ImagePicker.openImageLibraryAsync()\n if (!result.canceled) {\n uploadImagePickerResult(result)\n }\n }\n\n if (usingGiphy || currentlyEditingMessage) {\n return null\n }\n\n return (\n <View style={styles.attachmentPicker}>\n {isOpen && (\n <View style={styles.attachmentPickerButtonsContainer}>\n <IconButton\n accessibilityLabel=\"Take a photo\"\n accessibilityHint=\"Opens your camera\"\n size=\"lg\"\n appearance=\"neutral\"\n name=\"chat.camera\"\n onPress={openCamera}\n style={styles.attachmentPickerButton}\n />\n <IconButton\n accessibilityLabel=\"Choose a photo\"\n accessibilityHint=\"Opens your photo gallery\"\n size=\"lg\"\n appearance=\"neutral\"\n name=\"churchCenter.photosIos\"\n onPress={pickImage}\n style={styles.attachmentPickerButton}\n />\n </View>\n )}\n <IconButton\n accessibilityLabel=\"File Menu\"\n accessibilityHint=\"Opens options to attach or take a photo\"\n size=\"lg\"\n appearance=\"neutral\"\n name=\"general.paperclip\"\n onPress={() => setIsOpen(!isOpen)}\n style={styles.formButton}\n />\n </View>\n )\n}\n\nfunction MessageFormCommands() {\n const { text, canGiphy, usingGiphy, setUsingGiphy } = React.useContext(MessageFormContext)\n const styles = useMessageFormStyles()\n\n if (!canGiphy) {\n return null\n }\n\n if (usingGiphy) {\n return (\n <IconButton\n accessibilityLabel=\"Exit Giphy Search\"\n accessibilityHint=\"Changes input back to a text field for sending messages\"\n size=\"lg\"\n appearance=\"neutral\"\n name=\"general.xCircle\"\n onPress={() => setUsingGiphy(false)}\n style={styles.formButton}\n />\n )\n }\n\n return (\n <IconButton\n accessibilityLabel=\"Search Giphy\"\n accessibilityHint=\"Changes input into a search field for finding Giphys\"\n size=\"lg\"\n appearance=\"neutral\"\n name={'general.bolt'}\n onPress={() => setUsingGiphy(true)}\n disabled={text.length > GIPHY_MAX_LENGTH}\n style={styles.formButton}\n />\n )\n}\n\nfunction EditingIndicator() {\n const { currentlyEditingMessage, reset } = React.useContext(MessageFormContext)\n\n if (!currentlyEditingMessage) {\n return null\n }\n\n return (\n <FormIndicatorRow\n title=\"Editing message\"\n buttonText=\"Cancel\"\n accessibilityHint=\"Exit message editing mode without saving\"\n iconName=\"accounts.editor\"\n onPress={() => reset()}\n />\n )\n}\n\nfunction ReplyIndicator() {\n const { replyRootId } = React.useContext(MessageFormContext)\n const navigation = useNavigation()\n\n if (!REPLIES_FEATURE_ENABLED || !replyRootId) return null\n\n return (\n <FormIndicatorRow\n title=\"Reply\" // TODO: Get root reply author\n buttonText=\"Exit replies\"\n accessibilityHint=\"Return to the main conversation\"\n iconName=\"registrations.undo\"\n onPress={() => navigation.goBack()}\n />\n )\n}\n\ninterface FormIndicatorRowProps {\n title: string\n buttonText: string\n accessibilityHint: string\n onPress: () => void\n iconName: IconString\n}\n\nfunction FormIndicatorRow({\n title,\n buttonText,\n accessibilityHint,\n iconName,\n onPress,\n}: FormIndicatorRowProps) {\n const styles = useMessageFormStyles()\n const scalableNumberOfLines = useScalableNumberOfLines(1)\n\n return (\n <View style={styles.formIndicatorRow}>\n <View style={styles.formIndicatorRowTitleContainer}>\n <Icon name={iconName} size={16} style={styles.formIndicatorRowIcon} />\n <Heading\n variant=\"h4\"\n style={styles.formIndicatorRowTitle}\n numberOfLines={scalableNumberOfLines}\n maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}\n >\n {title}\n </Heading>\n </View>\n <TextButton\n onPress={onPress}\n accessibilityHint={accessibilityHint}\n maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}\n >\n {buttonText}\n </TextButton>\n </View>\n )\n}\n\nconst useMessageFormStyles = () => {\n const theme = useTheme()\n const navigationTheme = useNavigationTheme()\n const buttonSize = 38\n\n const giphyBadgeBackgroundColor = useInteractionGhostBackgroundColor()\n\n return StyleSheet.create({\n container: {\n borderColor: theme.colors.borderColorDefaultDim,\n borderTopWidth: 1,\n padding: 12,\n },\n textInputContainer: {\n backgroundColor: navigationTheme.colors.card,\n flexDirection: 'row',\n alignItems: 'flex-end',\n gap: 16,\n },\n textInputBoundary: {\n overflow: 'hidden',\n borderRadius: 24,\n borderWidth: 1,\n borderColor: theme.colors.fillColorNeutral050Base,\n flex: 1,\n gap: 8,\n },\n textInputRow: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 8,\n },\n textInput: {\n paddingBottom: 8,\n // TODO: Remove iOS's extra top padding and use `textAlignVertical: \"center\"` for both platforms when services-react-native upgrades to v0.74.5 or greater.\n paddingTop: Platform.select({\n ios: 9, // Extra padding compensates for `textAlignVertical` not working in Services iOS.\n default: 8,\n }),\n textAlignVertical: Platform.select({\n ios: 'top', // Services iOS doesn't support `textAlignVertical` due to its lower React Native version of 0.72.14. (React Native 0.74.5+ seems to support this style.)\n default: 'center', // centers the text vertically for multiline TextInput.\n }),\n paddingHorizontal: 16,\n color: theme.colors.textColorDefaultPrimary,\n justifyContent: 'center',\n flex: 1,\n fontSize: 16,\n maxHeight: 200,\n },\n textInputWithGiphy: {\n paddingLeft: 0,\n },\n giphyBadge: {\n backgroundColor: giphyBadgeBackgroundColor,\n borderRadius: 24,\n paddingVertical: 4,\n paddingHorizontal: 12,\n marginLeft: 6,\n flexDirection: 'row',\n alignItems: 'center',\n gap: 4,\n },\n giphyBadgeText: {\n color: theme.colors.interaction,\n marginBottom: 1,\n },\n giphyBadgeIcon: {\n color: theme.colors.interaction,\n },\n formButton: {\n height: buttonSize,\n },\n submitPressableWrapper: {\n borderRadius: buttonSize,\n overflow: 'hidden',\n },\n submitGradientWrapper: {\n flexDirection: 'row',\n justifyContent: 'center',\n alignItems: 'center',\n borderRadius: buttonSize,\n height: buttonSize,\n width: buttonSize,\n },\n submitIcon: {\n fontSize: 16,\n color: tokens.colorNeutral100White,\n },\n submitIconDisabled: {\n color: theme.colors.iconColorDefaultDisabled,\n },\n attachmentPicker: {\n position: 'relative',\n },\n attachmentPickerButtonsContainer: {\n position: 'absolute',\n left: 0,\n bottom: 40,\n zIndex: 10,\n gap: 12,\n },\n attachmentPickerButton: {\n backgroundColor: theme.colors.fillColorNeutral070,\n borderRadius: 20,\n height: buttonSize,\n width: buttonSize,\n elevation: 3,\n ...Platform.select({\n ios: {\n borderWidth: 1,\n borderColor: theme.colors.borderColorDefaultBase,\n },\n default: null,\n }),\n },\n messageFormAttachments: {\n overflow: 'hidden',\n paddingHorizontal: 12,\n paddingTop: 12,\n gap: 8,\n },\n inputErrorMessage: {\n color: theme.colors.statusErrorText,\n fontSize: 14,\n paddingHorizontal: 16,\n paddingVertical: 4,\n },\n formIndicatorRow: {\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'space-between',\n gap: 8,\n paddingBottom: 12,\n },\n formIndicatorRowTitleContainer: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 8,\n flex: 1,\n },\n formIndicatorRowIcon: {\n color: theme.colors.iconColorDefaultSecondary,\n },\n formIndicatorRowTitle: {\n fontWeight: platformFontWeightMedium,\n textTransform: 'none',\n flexShrink: 1,\n },\n })\n}\n"]}
|
|
@@ -2,7 +2,7 @@ import { StyleSheet, View } from 'react-native';
|
|
|
2
2
|
import Svg, { Path } from 'react-native-svg';
|
|
3
3
|
import { useTheme } from '../../hooks';
|
|
4
4
|
import { CONVERSATION_MESSAGE_LIST_PADDING_HORIZONTAL, MESSAGE_AUTHOR_AVATAR_COLUMN_WIDTH, } from '../../utils/styles';
|
|
5
|
-
import { REPLIES_FEATURE_ENABLED } from '../../
|
|
5
|
+
import { REPLIES_FEATURE_ENABLED } from '../../utils';
|
|
6
6
|
const MY_REPLY_CONNECTOR_WIDTH = 38;
|
|
7
7
|
const CONNECTOR_BORDER_WIDTH = 4;
|
|
8
8
|
export function TheirReplyConnector({ message, messageBubbleHeight }) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reply_connectors.js","sour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AAE;YACtB,KAAK,EAAE,wBAAwB;YAC/B,WAAW,EAAE,WAAW;YACxB,eAAe,EAAE,sBAAsB;YACvC,iBAAiB,EAAE,sBAAsB;YACzC,sBAAsB,EAAE,EAAE;SAC3B;QACD,uBAAuB,EAAE;YACvB,WAAW,EAAE,WAAW;YACxB,eAAe,EAAE,sBAAsB;YACvC,iBAAiB,EAAE,sBAAsB;YACzC,sBAAsB,EAAE,EAAE;SAC3B;QACD,uBAAuB,EAAE;YACvB,IAAI,EAAE,CAAC;SACR;QACD,8BAA8B,EAAE;YAC9B,eAAe,EAAE,WAAW;YAC5B,KAAK,EAAE,sBAAsB;YAC7B,IAAI,EAAE,CAAC;YACP,YAAY,EAAE,CAAC,CAAC,EAAE,4EAA4E;SAC/F;QACD,8BAA8B,EAAE;YAC9B,eAAe,EAAE,WAAW;YAC5B,KAAK,EAAE,sBAAsB;YAC7B,IAAI,EAAE,CAAC;YACP,SAAS,EAAE,CAAC,CAAC,EAAE,4EAA4E;SAC5F;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { StyleSheet, View, ViewStyle } from 'react-native'\nimport Svg, { Path } from 'react-native-svg'\nimport { useTheme } from '../../hooks'\nimport { MessageResource } from '../../types'\nimport {\n CONVERSATION_MESSAGE_LIST_PADDING_HORIZONTAL,\n MESSAGE_AUTHOR_AVATAR_COLUMN_WIDTH,\n} from '../../utils/styles'\nimport { REPLIES_FEATURE_ENABLED } from '../../screens/conversation_screen'\n\nconst MY_REPLY_CONNECTOR_WIDTH = 38\nconst CONNECTOR_BORDER_WIDTH = 4\n\ninterface ReplyConnectorProps {\n message: MessageResource\n messageBubbleHeight: number\n}\n\nexport function TheirReplyConnector({ message, messageBubbleHeight }: ReplyConnectorProps) {\n const styles = useStyles()\n\n if (!REPLIES_FEATURE_ENABLED) return null\n\n // TODO: Need to remove, just adding this to remove the lint warning about message being unused\n console.log('message', message)\n\n const connectorMap: Record<string, React.ReactNode | null> = {\n shortTailCurve: <ShortTailCurveConnector height={messageBubbleHeight / 2} />,\n verticalLine: <VerticalLineConnector />,\n default: null,\n }\n\n // TODO: Currently using fake message attributes. Will need to refactor once we have the message reply logic in place.\n const getConnectorKey = () => {\n // TODO: if (message.previousMessageIsTheirReplyMessage && message.nextMessageIsSomeoneElseReplyMessage) return 'shortTailCurve'\n // TODO: if (message.isRootMessage || (message.isTheirReplyMessage && message.nextMessageIsTheirReplyMessage) || (message.isTheirReplyMessage && message.nextMessageIsSomeoneElseReplyMessage && !message.nextMessageIsMyMessage)) return 'verticalLine'\n return 'default'\n }\n\n const ConnectorComponent = connectorMap[getConnectorKey()]\n\n if (!ConnectorComponent) return null\n\n return <View style={styles.theirReplyConnectorContainer}>{ConnectorComponent}</View>\n}\n\n// TODO: Refactor how we choose the correct connector once we have the logic in place\nexport function MyReplyConnector({ message, messageBubbleHeight }: ReplyConnectorProps) {\n const styles = useStyles()\n\n if (!REPLIES_FEATURE_ENABLED) return null\n\n // TODO: Need to remove, just adding this to remove the lint warning about message being unused\n console.log('message', message)\n\n const connectorMap: Record<string, React.ReactNode | null> = {\n longTailCurve: (\n <LongTailCurveConnector\n height={messageBubbleHeight / 2}\n style={styles.myReplyConnectorPosition}\n />\n ),\n longHeadCurve: (\n <LongHeadCurveConnector\n height={messageBubbleHeight / 2}\n style={styles.myReplyConnectorPosition}\n />\n ),\n verticalLine: <VerticalLineConnector style={styles.myReplyConnectorPosition} />,\n swirl: <SwirlConnector style={styles.myReplyConnectorPosition} />,\n default: null,\n }\n\n // TODO: Currently using fake message attributes. Will need to refactor once we have the message reply logic in place.\n const getConnectorKey = () => {\n // TODO: if (message.currentMessageIsReply && (message.nextMessageIsNotReplyMessage || message.nextMessageIsDifferentReplyRootId)) return 'longTailCurve'\n // TODO: if (message.currentMessageIsReplyRoot && message.nextMessageIsMyReply) return 'longHeadCurve'\n // TODO: if (message.currentMessageIsReply && message.nextMessageIsReply) return 'verticalLine'\n // TODO: if (message.currentMessageIsReply && message.previousMessageSomeoneElseReply && (message.nextMessageIsSomeoneElseReply || message.nextMessageIsMyReply)) return 'swirl'\n return 'default'\n }\n\n const ConnectorComponent = connectorMap[getConnectorKey()]\n\n if (!ConnectorComponent) return null\n\n return <View style={styles.myReplyConnectorContainer}>{ConnectorComponent}</View>\n}\n\nfunction VerticalLineConnector({ style }: { style?: ViewStyle }) {\n const styles = useStyles()\n return <View style={[styles.verticalLineConnector, style]} />\n}\n\nfunction LongHeadCurveConnector({ height, style }: { height: number; style?: ViewStyle }) {\n const styles = useStyles()\n return <View style={[styles.longHeadCurveConnector, { height, marginTop: height }, style]} />\n}\n\nfunction LongTailCurveConnector({ height, style }: { height: number; style?: ViewStyle }) {\n const styles = useStyles()\n return <View style={[styles.longTailCurveConnector, { height }, style]} />\n}\n\nfunction ShortTailCurveConnector({ height }: { height: number }) {\n const styles = useStyles()\n return <View style={[styles.shortTailCurveConnector, { height }]} />\n}\n\nfunction SwirlConnector({ style }: { style?: ViewStyle }) {\n const styles = useStyles()\n const { colors } = useTheme()\n const borderColor = colors.borderColorDefaultBase\n\n return (\n <View style={[styles.swirlConnectorContainer, style]}>\n <View style={styles.swirlConnectorVerticalLineHead} />\n <Svg width={27} height={34} fill=\"none\">\n <Path\n stroke={borderColor}\n strokeWidth={CONNECTOR_BORDER_WIDTH}\n d=\"M2.07 34c0-6.142 1.201-12.283 3.343-17m0 0c2.305-5.075 5.699-8.5 9.857-8.5 4.86 0 8.8 3.806 8.8 8.5s-3.94 8.5-8.8 8.5c-4.158 0-7.552-3.425-9.857-8.5zm0 0C3.271 12.283 2.07 6.142 2.07 0\"\n />\n </Svg>\n <View style={styles.swirlConnectorVerticalLineTail} />\n </View>\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n const borderColor = colors.borderColorDefaultBase\n\n return StyleSheet.create({\n theirReplyConnectorContainer: {\n width: '50%',\n alignSelf: 'flex-end',\n flex: 1,\n },\n myReplyConnectorContainer: {\n width: MESSAGE_AUTHOR_AVATAR_COLUMN_WIDTH,\n position: 'absolute',\n left: CONVERSATION_MESSAGE_LIST_PADDING_HORIZONTAL,\n top: 0,\n bottom: 0,\n },\n myReplyConnectorPosition: {\n left: '50%',\n },\n verticalLineConnector: {\n flex: 1,\n borderLeftWidth: CONNECTOR_BORDER_WIDTH,\n borderLeftColor: borderColor,\n },\n longHeadCurveConnector: {\n width: MY_REPLY_CONNECTOR_WIDTH,\n borderColor: borderColor,\n borderLeftWidth: CONNECTOR_BORDER_WIDTH,\n borderTopWidth: CONNECTOR_BORDER_WIDTH,\n borderTopLeftRadius: 16,\n flex: 1,\n },\n longTailCurveConnector: {\n width: MY_REPLY_CONNECTOR_WIDTH,\n borderColor: borderColor,\n borderLeftWidth: CONNECTOR_BORDER_WIDTH,\n borderBottomWidth: CONNECTOR_BORDER_WIDTH,\n borderBottomLeftRadius: 16,\n },\n shortTailCurveConnector: {\n borderColor: borderColor,\n borderLeftWidth: CONNECTOR_BORDER_WIDTH,\n borderBottomWidth: CONNECTOR_BORDER_WIDTH,\n borderBottomLeftRadius: 16,\n },\n swirlConnectorContainer: {\n flex: 1,\n },\n swirlConnectorVerticalLineHead: {\n backgroundColor: borderColor,\n width: CONNECTOR_BORDER_WIDTH,\n flex: 1,\n marginBottom: -1, // Ensures there is no gap between the vertical line and the swirl connector\n },\n swirlConnectorVerticalLineTail: {\n backgroundColor: borderColor,\n width: CONNECTOR_BORDER_WIDTH,\n flex: 1,\n marginTop: -1, // Ensures there is no gap between the vertical line and the swirl connector\n },\n })\n}\n"]}
|
|
1
|
+
{"version":3,"file":"reply_connectors.js","sourceRoot":"","sources":["../../../src/components/conversation/reply_connectors.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAa,MAAM,cAAc,CAAA;AAC1D,OAAO,GAAG,EAAE,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEtC,OAAO,EACL,4CAA4C,EAC5C,k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AE;SAC3B;QACD,uBAAuB,EAAE;YACvB,IAAI,EAAE,CAAC;SACR;QACD,8BAA8B,EAAE;YAC9B,eAAe,EAAE,WAAW;YAC5B,KAAK,EAAE,sBAAsB;YAC7B,IAAI,EAAE,CAAC;YACP,YAAY,EAAE,CAAC,CAAC,EAAE,4EAA4E;SAC/F;QACD,8BAA8B,EAAE;YAC9B,eAAe,EAAE,WAAW;YAC5B,KAAK,EAAE,sBAAsB;YAC7B,IAAI,EAAE,CAAC;YACP,SAAS,EAAE,CAAC,CAAC,EAAE,4EAA4E;SAC5F;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { StyleSheet, View, ViewStyle } from 'react-native'\nimport Svg, { Path } from 'react-native-svg'\nimport { useTheme } from '../../hooks'\nimport { MessageResource } from '../../types'\nimport {\n CONVERSATION_MESSAGE_LIST_PADDING_HORIZONTAL,\n MESSAGE_AUTHOR_AVATAR_COLUMN_WIDTH,\n} from '../../utils/styles'\nimport { REPLIES_FEATURE_ENABLED } from '../../utils'\n\nconst MY_REPLY_CONNECTOR_WIDTH = 38\nconst CONNECTOR_BORDER_WIDTH = 4\n\ninterface ReplyConnectorProps {\n message: MessageResource\n messageBubbleHeight: number\n}\n\nexport function TheirReplyConnector({ message, messageBubbleHeight }: ReplyConnectorProps) {\n const styles = useStyles()\n\n if (!REPLIES_FEATURE_ENABLED) return null\n\n // TODO: Need to remove, just adding this to remove the lint warning about message being unused\n console.log('message', message)\n\n const connectorMap: Record<string, React.ReactNode | null> = {\n shortTailCurve: <ShortTailCurveConnector height={messageBubbleHeight / 2} />,\n verticalLine: <VerticalLineConnector />,\n default: null,\n }\n\n // TODO: Currently using fake message attributes. Will need to refactor once we have the message reply logic in place.\n const getConnectorKey = () => {\n // TODO: if (message.previousMessageIsTheirReplyMessage && message.nextMessageIsSomeoneElseReplyMessage) return 'shortTailCurve'\n // TODO: if (message.isRootMessage || (message.isTheirReplyMessage && message.nextMessageIsTheirReplyMessage) || (message.isTheirReplyMessage && message.nextMessageIsSomeoneElseReplyMessage && !message.nextMessageIsMyMessage)) return 'verticalLine'\n return 'default'\n }\n\n const ConnectorComponent = connectorMap[getConnectorKey()]\n\n if (!ConnectorComponent) return null\n\n return <View style={styles.theirReplyConnectorContainer}>{ConnectorComponent}</View>\n}\n\n// TODO: Refactor how we choose the correct connector once we have the logic in place\nexport function MyReplyConnector({ message, messageBubbleHeight }: ReplyConnectorProps) {\n const styles = useStyles()\n\n if (!REPLIES_FEATURE_ENABLED) return null\n\n // TODO: Need to remove, just adding this to remove the lint warning about message being unused\n console.log('message', message)\n\n const connectorMap: Record<string, React.ReactNode | null> = {\n longTailCurve: (\n <LongTailCurveConnector\n height={messageBubbleHeight / 2}\n style={styles.myReplyConnectorPosition}\n />\n ),\n longHeadCurve: (\n <LongHeadCurveConnector\n height={messageBubbleHeight / 2}\n style={styles.myReplyConnectorPosition}\n />\n ),\n verticalLine: <VerticalLineConnector style={styles.myReplyConnectorPosition} />,\n swirl: <SwirlConnector style={styles.myReplyConnectorPosition} />,\n default: null,\n }\n\n // TODO: Currently using fake message attributes. Will need to refactor once we have the message reply logic in place.\n const getConnectorKey = () => {\n // TODO: if (message.currentMessageIsReply && (message.nextMessageIsNotReplyMessage || message.nextMessageIsDifferentReplyRootId)) return 'longTailCurve'\n // TODO: if (message.currentMessageIsReplyRoot && message.nextMessageIsMyReply) return 'longHeadCurve'\n // TODO: if (message.currentMessageIsReply && message.nextMessageIsReply) return 'verticalLine'\n // TODO: if (message.currentMessageIsReply && message.previousMessageSomeoneElseReply && (message.nextMessageIsSomeoneElseReply || message.nextMessageIsMyReply)) return 'swirl'\n return 'default'\n }\n\n const ConnectorComponent = connectorMap[getConnectorKey()]\n\n if (!ConnectorComponent) return null\n\n return <View style={styles.myReplyConnectorContainer}>{ConnectorComponent}</View>\n}\n\nfunction VerticalLineConnector({ style }: { style?: ViewStyle }) {\n const styles = useStyles()\n return <View style={[styles.verticalLineConnector, style]} />\n}\n\nfunction LongHeadCurveConnector({ height, style }: { height: number; style?: ViewStyle }) {\n const styles = useStyles()\n return <View style={[styles.longHeadCurveConnector, { height, marginTop: height }, style]} />\n}\n\nfunction LongTailCurveConnector({ height, style }: { height: number; style?: ViewStyle }) {\n const styles = useStyles()\n return <View style={[styles.longTailCurveConnector, { height }, style]} />\n}\n\nfunction ShortTailCurveConnector({ height }: { height: number }) {\n const styles = useStyles()\n return <View style={[styles.shortTailCurveConnector, { height }]} />\n}\n\nfunction SwirlConnector({ style }: { style?: ViewStyle }) {\n const styles = useStyles()\n const { colors } = useTheme()\n const borderColor = colors.borderColorDefaultBase\n\n return (\n <View style={[styles.swirlConnectorContainer, style]}>\n <View style={styles.swirlConnectorVerticalLineHead} />\n <Svg width={27} height={34} fill=\"none\">\n <Path\n stroke={borderColor}\n strokeWidth={CONNECTOR_BORDER_WIDTH}\n d=\"M2.07 34c0-6.142 1.201-12.283 3.343-17m0 0c2.305-5.075 5.699-8.5 9.857-8.5 4.86 0 8.8 3.806 8.8 8.5s-3.94 8.5-8.8 8.5c-4.158 0-7.552-3.425-9.857-8.5zm0 0C3.271 12.283 2.07 6.142 2.07 0\"\n />\n </Svg>\n <View style={styles.swirlConnectorVerticalLineTail} />\n </View>\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n const borderColor = colors.borderColorDefaultBase\n\n return StyleSheet.create({\n theirReplyConnectorContainer: {\n width: '50%',\n alignSelf: 'flex-end',\n flex: 1,\n },\n myReplyConnectorContainer: {\n width: MESSAGE_AUTHOR_AVATAR_COLUMN_WIDTH,\n position: 'absolute',\n left: CONVERSATION_MESSAGE_LIST_PADDING_HORIZONTAL,\n top: 0,\n bottom: 0,\n },\n myReplyConnectorPosition: {\n left: '50%',\n },\n verticalLineConnector: {\n flex: 1,\n borderLeftWidth: CONNECTOR_BORDER_WIDTH,\n borderLeftColor: borderColor,\n },\n longHeadCurveConnector: {\n width: MY_REPLY_CONNECTOR_WIDTH,\n borderColor: borderColor,\n borderLeftWidth: CONNECTOR_BORDER_WIDTH,\n borderTopWidth: CONNECTOR_BORDER_WIDTH,\n borderTopLeftRadius: 16,\n flex: 1,\n },\n longTailCurveConnector: {\n width: MY_REPLY_CONNECTOR_WIDTH,\n borderColor: borderColor,\n borderLeftWidth: CONNECTOR_BORDER_WIDTH,\n borderBottomWidth: CONNECTOR_BORDER_WIDTH,\n borderBottomLeftRadius: 16,\n },\n shortTailCurveConnector: {\n borderColor: borderColor,\n borderLeftWidth: CONNECTOR_BORDER_WIDTH,\n borderBottomWidth: CONNECTOR_BORDER_WIDTH,\n borderBottomLeftRadius: 16,\n },\n swirlConnectorContainer: {\n flex: 1,\n },\n swirlConnectorVerticalLineHead: {\n backgroundColor: borderColor,\n width: CONNECTOR_BORDER_WIDTH,\n flex: 1,\n marginBottom: -1, // Ensures there is no gap between the vertical line and the swirl connector\n },\n swirlConnectorVerticalLineTail: {\n backgroundColor: borderColor,\n width: CONNECTOR_BORDER_WIDTH,\n flex: 1,\n marginTop: -1, // Ensures there is no gap between the vertical line and the swirl connector\n },\n })\n}\n"]}
|