@planningcenter/chat-react-native 3.17.3-rc.0 → 3.18.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/conversation/message.d.ts.map +1 -1
- package/build/components/conversation/message.js +19 -16
- package/build/components/conversation/message.js.map +1 -1
- package/build/components/conversation/reply_connectors.js +33 -31
- package/build/components/conversation/reply_connectors.js.map +1 -1
- package/build/components/conversation/reply_shadow_message.js +9 -5
- package/build/components/conversation/reply_shadow_message.js.map +1 -1
- package/package.json +2 -2
- package/src/components/conversation/message.tsx +25 -19
- package/src/components/conversation/reply_connectors.tsx +61 -31
- package/src/components/conversation/reply_shadow_message.tsx +10 -4
|
@@ -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;AAoB7C;;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,
|
|
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;AAoB7C;;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,qBAoPd"}
|
|
@@ -35,9 +35,25 @@ export function Message({ canDeleteNonAuthoredMessages, conversation_id, latestR
|
|
|
35
35
|
messageId: message.replyRootId || '',
|
|
36
36
|
enabled: !!message.replyRootId,
|
|
37
37
|
});
|
|
38
|
+
const metaProps = {
|
|
39
|
+
authorName: message.author.name,
|
|
40
|
+
createdAt: message.createdAt,
|
|
41
|
+
};
|
|
42
|
+
const renderAuthor = (!message.mine && message.renderAuthor) || false;
|
|
43
|
+
const showReplyCountButton = !inReplyScreen && message.replyRootId === message.id && REPLIES_FEATURE_ENABLED;
|
|
44
|
+
const isReplyRootMessage = message.replyRootId === message.id;
|
|
45
|
+
const isDeletedReplyRootMessage = isReplyRootMessage && !!message.deletedAt;
|
|
46
|
+
const messageText = isDeletedReplyRootMessage ? 'Message deleted' : text;
|
|
47
|
+
const replyCountText = pluralize(message.replyCount, 'reply');
|
|
48
|
+
const messagePendingLabel = isPersisted ? 'Saving' : 'Sending';
|
|
38
49
|
const replyRootAuthorName = message.replyRootId
|
|
39
50
|
? replyRootMessage?.author.name
|
|
40
51
|
: message.author.name;
|
|
52
|
+
const messageBottomMargin = message.lastInGroup || message.nextIsReplyShadowMessage
|
|
53
|
+
? 16
|
|
54
|
+
: hasReactions || showMessageMeta || showReplyCountButton
|
|
55
|
+
? 8
|
|
56
|
+
: 4;
|
|
41
57
|
useEffect(() => {
|
|
42
58
|
if (pending) {
|
|
43
59
|
const timer = setTimeout(() => {
|
|
@@ -97,23 +113,10 @@ export function Message({ canDeleteNonAuthoredMessages, conversation_id, latestR
|
|
|
97
113
|
reply_root_author_name: message.author.name,
|
|
98
114
|
});
|
|
99
115
|
};
|
|
100
|
-
const metaProps = {
|
|
101
|
-
authorName: message.author.name,
|
|
102
|
-
createdAt: message.createdAt,
|
|
103
|
-
};
|
|
104
|
-
const renderAuthor = (!message.mine && message.renderAuthor) || false;
|
|
105
|
-
const messagePendingLabel = isPersisted ? 'Saving' : 'Sending';
|
|
106
|
-
const showReplyCountButton = !inReplyScreen && message.replyRootId === message.id && REPLIES_FEATURE_ENABLED;
|
|
107
|
-
const replyCountText = pluralize(message.replyCount, 'reply');
|
|
108
|
-
const messageBottomMargin = message.lastInGroup || message.nextIsReplyShadowMessage
|
|
109
|
-
? 16
|
|
110
|
-
: hasReactions || showMessageMeta || showReplyCountButton
|
|
111
|
-
? 8
|
|
112
|
-
: 4;
|
|
113
116
|
return (<Pressable onLongPress={handleMessageLongPress} onPress={() => setShowMessageMetaToggle(!showMessageMetaToggle)} onPressIn={handleMessagePressIn} onPressOut={handleMessagePressOut} android_ripple={{ color: colors.androidRippleNeutral, borderless: false, foreground: true }} accessibilityHint="Long press to view message actions like reacting and copying.">
|
|
114
117
|
<Animated.View style={[styles.message, animatedBackgroundColor]}>
|
|
115
118
|
{!message.mine && (<View>
|
|
116
|
-
{renderAuthor ? (<Avatar size={'md'} sourceUri={message.author.avatar} style={styles.avatar} maxFontSizeMultiplier={1} minFontSizeMultiplier={1}/>) : (<View style={styles.avatarPlaceholder}/>)}
|
|
119
|
+
{renderAuthor ? (<Avatar size={'md'} sourceUri={message.author.avatar} style={styles.avatar} maxFontSizeMultiplier={1} minFontSizeMultiplier={1} fallbackIconName={isDeletedReplyRootMessage ? 'publishing.trash' : 'general.person'} showFallback={isDeletedReplyRootMessage}/>) : (<View style={styles.avatarPlaceholder}/>)}
|
|
117
120
|
<TheirReplyConnector message={message} messageBubbleHeight={messageBubbleHeight}/>
|
|
118
121
|
</View>)}
|
|
119
122
|
<View style={[styles.messageContent, { marginBottom: messageBottomMargin }]}>
|
|
@@ -124,8 +127,8 @@ export function Message({ canDeleteNonAuthoredMessages, conversation_id, latestR
|
|
|
124
127
|
<ErrorBoundary>
|
|
125
128
|
<MessageAttachments attachments={message.attachments} metaProps={metaProps} onMessageAttachmentLongPress={handleMessageAttachmentLongPress} onMessageLongPress={handleMessageLongPress}/>
|
|
126
129
|
</ErrorBoundary>
|
|
127
|
-
{
|
|
128
|
-
<MessageMarkdown text={
|
|
130
|
+
{messageText && (<View style={styles.messageText}>
|
|
131
|
+
<MessageMarkdown text={messageText}/>
|
|
129
132
|
</View>)}
|
|
130
133
|
</View>
|
|
131
134
|
{showReplyCountButton && (<TextButton variant="footnote" onPress={handleNavigateToReplyPress} style={styles.messageReplyCount} accessibilityHint="Navigates to reply screen for this message" accessibilityRole="link">
|
|
@@ -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,UAAU,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AACpG,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,M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AAG,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, 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, AVATAR_CONNECTOR_SPACING } from './reply_connectors'\nimport { pluralize, REPLIES_FEATURE_ENABLED } from '../../utils'\nimport { useConversationMessage } from '../../hooks/use_conversation_message'\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 const { message: replyRootMessage } = useConversationMessage({\n conversation_id,\n messageId: message.replyRootId || '',\n enabled: !!message.replyRootId,\n })\n\n const replyRootAuthorName = message.replyRootId\n ? replyRootMessage?.author.name\n : message.author.name\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 reply_root_author_name: replyRootAuthorName,\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 reply_root_author_name: message.author.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 messagePendingLabel = isPersisted ? 'Saving' : 'Sending'\n const showReplyCountButton =\n !inReplyScreen && message.replyRootId === message.id && REPLIES_FEATURE_ENABLED\n const replyCountText = pluralize(message.replyCount, 'reply')\n const messageBottomMargin =\n message.lastInGroup || message.nextIsReplyShadowMessage\n ? 16\n : hasReactions || showMessageMeta || showReplyCountButton\n ? 8\n : 4\n\n return (\n <Pressable\n onLongPress={handleMessageLongPress}\n onPress={() => setShowMessageMetaToggle(!showMessageMetaToggle)}\n onPressIn={handleMessagePressIn}\n onPressOut={handleMessagePressOut}\n android_ripple={{ color: colors.androidRippleNeutral, borderless: false, foreground: true }}\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 && (\n <Text variant=\"footnote\" style={styles.authorName}>\n {message.author.name}\n </Text>\n )}\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 {replyCountText}\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: AVATAR_CONNECTOR_SPACING,\n },\n avatarPlaceholder: {\n width: MESSAGE_AUTHOR_AVATAR_COLUMN_WIDTH, // Same width as avatar\n },\n authorName: {\n fontWeight: platformFontWeightMedium,\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"]}
|
|
1
|
+
{"version":3,"file":"message.js","sourceRoot":"","sources":["../../../src/components/conversation/message.tsx"],"names":[],"mappings":"AAAA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AAC,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, AVATAR_CONNECTOR_SPACING } from './reply_connectors'\nimport { pluralize, REPLIES_FEATURE_ENABLED } from '../../utils'\nimport { useConversationMessage } from '../../hooks/use_conversation_message'\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 const { message: replyRootMessage } = useConversationMessage({\n conversation_id,\n messageId: message.replyRootId || '',\n enabled: !!message.replyRootId,\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 showReplyCountButton =\n !inReplyScreen && message.replyRootId === message.id && REPLIES_FEATURE_ENABLED\n const isReplyRootMessage = message.replyRootId === message.id\n const isDeletedReplyRootMessage = isReplyRootMessage && !!message.deletedAt\n\n const messageText = isDeletedReplyRootMessage ? 'Message deleted' : text\n const replyCountText = pluralize(message.replyCount, 'reply')\n const messagePendingLabel = isPersisted ? 'Saving' : 'Sending'\n const replyRootAuthorName = message.replyRootId\n ? replyRootMessage?.author.name\n : message.author.name\n\n const messageBottomMargin =\n message.lastInGroup || message.nextIsReplyShadowMessage\n ? 16\n : hasReactions || showMessageMeta || showReplyCountButton\n ? 8\n : 4\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 reply_root_author_name: replyRootAuthorName,\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 reply_root_author_name: message.author.name,\n })\n }\n\n return (\n <Pressable\n onLongPress={handleMessageLongPress}\n onPress={() => setShowMessageMetaToggle(!showMessageMetaToggle)}\n onPressIn={handleMessagePressIn}\n onPressOut={handleMessagePressOut}\n android_ripple={{ color: colors.androidRippleNeutral, borderless: false, foreground: true }}\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 fallbackIconName={isDeletedReplyRootMessage ? 'publishing.trash' : 'general.person'}\n showFallback={isDeletedReplyRootMessage}\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 && (\n <Text variant=\"footnote\" style={styles.authorName}>\n {message.author.name}\n </Text>\n )}\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 {messageText && (\n <View style={styles.messageText}>\n <MessageMarkdown text={messageText} />\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 {replyCountText}\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: AVATAR_CONNECTOR_SPACING,\n },\n avatarPlaceholder: {\n width: MESSAGE_AUTHOR_AVATAR_COLUMN_WIDTH, // Same width as avatar\n },\n authorName: {\n fontWeight: platformFontWeightMedium,\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"]}
|
|
@@ -76,32 +76,56 @@ function VerticalLineConnector({ style }) {
|
|
|
76
76
|
}
|
|
77
77
|
function LongHeadCurveConnector({ height, style }) {
|
|
78
78
|
const styles = useStyles();
|
|
79
|
-
|
|
79
|
+
const { colors } = useTheme();
|
|
80
|
+
return (<View style={[styles.longHeadCurveConnector, { marginTop: height }, style]}>
|
|
81
|
+
<Svg width={MY_REPLY_CONNECTOR_WIDTH} height={18} fill="none">
|
|
82
|
+
<Path d="M 2 18 L 2 16 A 14 14 0 0 1 16 2 L 38 2" stroke={colors.borderColorDefaultBase} strokeWidth={CONNECTOR_BORDER_WIDTH}/>
|
|
83
|
+
</Svg>
|
|
84
|
+
<View style={styles.svgConnnectorVerticalLineTail}/>
|
|
85
|
+
</View>);
|
|
80
86
|
}
|
|
81
87
|
function LongTailCurveConnector({ height, style }) {
|
|
82
88
|
const styles = useStyles();
|
|
83
|
-
|
|
89
|
+
const { colors } = useTheme();
|
|
90
|
+
return (<View style={[{ height }, style]}>
|
|
91
|
+
<View style={styles.svgConnnectorVerticalLineHead}/>
|
|
92
|
+
<Svg width={MY_REPLY_CONNECTOR_WIDTH} height={18} fill="none">
|
|
93
|
+
<Path d="M 2 0 L 2 2 A 14 14 0 0 0 16 16 L 38 16" stroke={colors.borderColorDefaultBase} strokeWidth={CONNECTOR_BORDER_WIDTH}/>
|
|
94
|
+
</Svg>
|
|
95
|
+
</View>);
|
|
84
96
|
}
|
|
85
97
|
function ShortHeadCurveConnector({ height }) {
|
|
86
98
|
const styles = useStyles();
|
|
87
|
-
|
|
99
|
+
const { colors } = useTheme();
|
|
100
|
+
return (<View style={[styles.shortHeadCurveConnector, { marginTop: height }]}>
|
|
101
|
+
<Svg width={20} height={18} fill="none">
|
|
102
|
+
<Path d="M 2 18 L 2 16 A 14 14 0 0 1 16 2 L 20 2" stroke={colors.borderColorDefaultBase} strokeWidth={CONNECTOR_BORDER_WIDTH}/>
|
|
103
|
+
</Svg>
|
|
104
|
+
<View style={styles.svgConnnectorVerticalLineTail}/>
|
|
105
|
+
</View>);
|
|
88
106
|
}
|
|
89
107
|
function ShortTailCurveConnector({ height }) {
|
|
90
108
|
const styles = useStyles();
|
|
91
|
-
|
|
109
|
+
const { colors } = useTheme();
|
|
110
|
+
return (<View style={{ height }}>
|
|
111
|
+
<View style={styles.svgConnnectorVerticalLineHead}/>
|
|
112
|
+
<Svg width={20} height={18} fill="none">
|
|
113
|
+
<Path d="M 2 0 L 2 2 A 14 14 0 0 0 16 16 L 20 16" stroke={colors.borderColorDefaultBase} strokeWidth={CONNECTOR_BORDER_WIDTH}/>
|
|
114
|
+
</Svg>
|
|
115
|
+
</View>);
|
|
92
116
|
}
|
|
93
117
|
function SwirlConnector({ style, height }) {
|
|
94
118
|
const styles = useStyles();
|
|
95
119
|
const { colors } = useTheme();
|
|
96
120
|
return (<View style={[styles.swirlConnectorContainer, style]}>
|
|
97
121
|
<View style={{ height }}>
|
|
98
|
-
<View style={styles.
|
|
122
|
+
<View style={styles.svgConnnectorVerticalLineHead}/>
|
|
99
123
|
<Svg width={27} height={34} fill="none">
|
|
100
124
|
<Path stroke={colors.borderColorDefaultBase} strokeWidth={CONNECTOR_BORDER_WIDTH} 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"/>
|
|
101
125
|
</Svg>
|
|
102
|
-
<View style={styles.
|
|
126
|
+
<View style={styles.svgConnnectorVerticalLineTail}/>
|
|
103
127
|
</View>
|
|
104
|
-
<View style={styles.
|
|
128
|
+
<View style={styles.svgConnnectorVerticalLineTail}/>
|
|
105
129
|
</View>);
|
|
106
130
|
}
|
|
107
131
|
// TODO: Remove when Services React Native bumps to React Native 0.74 or higher.
|
|
@@ -147,43 +171,21 @@ const useStyles = () => {
|
|
|
147
171
|
borderLeftColor: borderColor,
|
|
148
172
|
},
|
|
149
173
|
longHeadCurveConnector: {
|
|
150
|
-
width: MY_REPLY_CONNECTOR_WIDTH,
|
|
151
|
-
borderColor: borderColor,
|
|
152
|
-
borderLeftWidth: CONNECTOR_BORDER_WIDTH,
|
|
153
|
-
borderTopWidth: CONNECTOR_BORDER_WIDTH,
|
|
154
|
-
borderTopLeftRadius: 16,
|
|
155
174
|
flex: 1,
|
|
156
175
|
},
|
|
157
|
-
longTailCurveConnector: {
|
|
158
|
-
width: MY_REPLY_CONNECTOR_WIDTH,
|
|
159
|
-
borderColor: borderColor,
|
|
160
|
-
borderLeftWidth: CONNECTOR_BORDER_WIDTH,
|
|
161
|
-
borderBottomWidth: CONNECTOR_BORDER_WIDTH,
|
|
162
|
-
borderBottomLeftRadius: 16,
|
|
163
|
-
},
|
|
164
176
|
shortHeadCurveConnector: {
|
|
165
|
-
borderColor: borderColor,
|
|
166
|
-
borderLeftWidth: CONNECTOR_BORDER_WIDTH,
|
|
167
|
-
borderTopWidth: CONNECTOR_BORDER_WIDTH,
|
|
168
|
-
borderTopLeftRadius: 16,
|
|
169
177
|
flex: 1,
|
|
170
178
|
},
|
|
171
|
-
shortTailCurveConnector: {
|
|
172
|
-
borderColor: borderColor,
|
|
173
|
-
borderLeftWidth: CONNECTOR_BORDER_WIDTH,
|
|
174
|
-
borderBottomWidth: CONNECTOR_BORDER_WIDTH,
|
|
175
|
-
borderBottomLeftRadius: 16,
|
|
176
|
-
},
|
|
177
179
|
swirlConnectorContainer: {
|
|
178
180
|
flex: 1,
|
|
179
181
|
},
|
|
180
|
-
|
|
182
|
+
svgConnnectorVerticalLineHead: {
|
|
181
183
|
backgroundColor: borderColor,
|
|
182
184
|
width: CONNECTOR_BORDER_WIDTH,
|
|
183
185
|
flex: 1,
|
|
184
186
|
marginBottom: -1, // Ensures there is no gap between the vertical line and the swirl connector
|
|
185
187
|
},
|
|
186
|
-
|
|
188
|
+
svgConnnectorVerticalLineTail: {
|
|
187
189
|
backgroundColor: borderColor,
|
|
188
190
|
width: CONNECTOR_BORDER_WIDTH,
|
|
189
191
|
flex: 1,
|
|
@@ -1 +1 @@
|
|
|
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,kCAAkC,GACnC,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAA;AAErD,MAAM,wBAAwB,GAAG,EAAE,CAAA;AACnC,MAAM,sBAAsB,GAAG,CAAC,CAAA;AAChC,MAAM,0BAA0B,GAAG,sBAAsB,GAAG,CAAC,CAAA,CAAC,sFAAsF;AACpJ,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAA;AAOzC,MAAM,UAAU,mBAAmB,CAAC,EAAE,OAAO,EAAE,mBAAmB,EAAuB;IACvF,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAC1B,MAAM,EAAE,iBAAiB,EAAE,cAAc,EAAE,YAAY,EAAE,oBAAoB,EAAE,GAAG,OAAO,CAAA;IAEzF,IAAI,CAAC,uBAAuB;QAAE,OAAO,IAAI,CAAA;IACzC,IAAI,mBAAmB,KAAK,CAAC;QAAE,OAAO,IAAI,CAAA,CAAC,uBAAuB;IAElE,MAAM,YAAY,GAA2C;QAC3D,cAAc,EAAE,CAAC,uBAAuB,CAAC,MAAM,CAAC,CAAC,mBAAmB,GAAG,CAAC,CAAC,EAAG;QAC5E,cAAc,EAAE,CAAC,uBAAuB,CAAC,MAAM,CAAC,CAAC,mBAAmB,GAAG,CAAC,CAAC,EAAG;QAC5E,YAAY,EAAE,CAAC,qBAAqB,CAAC,AAAD,EA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SACR;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;QACD,gFAAgF;QAChF,aAAa,EAAE;YACb,QAAQ,EAAE,UAAU;YACpB,IAAI,EAAE,CAAC;YACP,KAAK,EAAE,CAAC;YACR,GAAG,EAAE,CAAC;YACN,MAAM,EAAE,CAAC;SACV;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\nconst OFFSET_CONNECTOR_CONTAINER = CONNECTOR_BORDER_WIDTH / 2 // Accounts for the border width ensuring the connectors are centered under the avatar\nexport const AVATAR_CONNECTOR_SPACING = 8\n\ninterface ReplyConnectorProps {\n message: MessageResource\n messageBubbleHeight: number\n}\n\nexport function TheirReplyConnector({ message, messageBubbleHeight }: ReplyConnectorProps) {\n const styles = useStyles()\n const { nextRendersAuthor, threadPosition, renderAuthor, isReplyShadowMessage } = message\n\n if (!REPLIES_FEATURE_ENABLED) return null\n if (messageBubbleHeight === 0) return null // Prevents UI shifting\n\n const connectorMap: Record<string, React.ReactNode | null> = {\n shortTailCurve: <ShortTailCurveConnector height={messageBubbleHeight / 2} />,\n shortHeadCurve: <ShortHeadCurveConnector height={messageBubbleHeight / 2} />,\n verticalLine: <VerticalLineConnector />,\n default: null,\n }\n\n const getConnectorKey = () => {\n if (threadPosition === 'first' && !renderAuthor) return 'shortHeadCurve'\n if (threadPosition === 'last' && !renderAuthor) return 'shortTailCurve'\n if (\n (threadPosition === 'first' && renderAuthor) ||\n threadPosition === 'center' ||\n isReplyShadowMessage\n )\n return 'verticalLine'\n return 'default'\n }\n\n const ConnectorComponent = connectorMap[getConnectorKey()]\n if (!ConnectorComponent) return null\n\n const spacerStyle = nextRendersAuthor ? styles.theirReplyConnectorSpacer : null\n\n return (\n <View style={[styles.theirReplyConnectorContainer, spacerStyle]}>{ConnectorComponent}</View>\n )\n}\n\nexport function MyReplyConnector({ message, messageBubbleHeight }: ReplyConnectorProps) {\n const styles = useStyles()\n const { nextRendersAuthor, threadPosition, prevIsMyReply, nextIsMyReply, isReplyShadowMessage } =\n message\n\n if (!REPLIES_FEATURE_ENABLED) return null\n if (messageBubbleHeight === 0) return null // Prevents UI shifting\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} height={messageBubbleHeight} />,\n default: null,\n }\n\n const getConnectorKey = () => {\n if (threadPosition === 'first' || isReplyShadowMessage) return 'longHeadCurve'\n if (threadPosition === 'center' && prevIsMyReply && nextIsMyReply) return 'verticalLine'\n if (threadPosition === 'center' && (!prevIsMyReply || !nextIsMyReply)) return 'swirl'\n if (threadPosition === 'last') return 'longTailCurve'\n\n return 'default'\n }\n\n const ConnectorComponent = connectorMap[getConnectorKey()]\n if (!ConnectorComponent) return null\n\n const spacerStyle = nextRendersAuthor ? styles.myReplyConnectorSpacer : null\n\n return (\n <EnforceLeftPositionForMyReplyConnector>\n <View style={[styles.myReplyConnectorContainer, spacerStyle]}>{ConnectorComponent}</View>\n </EnforceLeftPositionForMyReplyConnector>\n )\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 ShortHeadCurveConnector({ height }: { height: number }) {\n const styles = useStyles()\n return <View style={[styles.shortHeadCurveConnector, { marginTop: height }]} />\n}\n\nfunction ShortTailCurveConnector({ height }: { height: number }) {\n const styles = useStyles()\n return <View style={[styles.shortTailCurveConnector, { height }]} />\n}\n\nfunction SwirlConnector({ style, height }: { style?: ViewStyle; height: number }) {\n const styles = useStyles()\n const { colors } = useTheme()\n\n return (\n <View style={[styles.swirlConnectorContainer, style]}>\n <View style={{ height }}>\n <View style={styles.swirlConnectorVerticalLineHead} />\n <Svg width={27} height={34} fill=\"none\">\n <Path\n stroke={colors.borderColorDefaultBase}\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 <View style={styles.swirlConnectorVerticalLineTail} />\n </View>\n )\n}\n\n// TODO: Remove when Services React Native bumps to React Native 0.74 or higher.\n// This fixes a React Native bug where using `flexDirection: 'row-reverse'` also switches the `left`/`right` absolute positioning values.\n// The wrapper ensures the MyReplyConnector is always positioned to the left of the message bubble on older versions of React Native.\n// Long term fix is described here: https://reactnative.dev/blog/2024/04/22/release-0.74#new-layout-behaviors\nfunction EnforceLeftPositionForMyReplyConnector({ children }: { children: React.ReactNode }) {\n const styles = useStyles()\n return (\n <View\n style={styles.resetPosition}\n pointerEvents=\"none\" // ensures wrapper does not block press events\n >\n {children}\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 marginRight: OFFSET_CONNECTOR_CONTAINER,\n alignSelf: 'flex-end',\n flex: 1,\n },\n theirReplyConnectorSpacer: {\n paddingBottom: AVATAR_CONNECTOR_SPACING,\n },\n myReplyConnectorContainer: {\n width: MESSAGE_AUTHOR_AVATAR_COLUMN_WIDTH,\n position: 'absolute',\n left: CONVERSATION_MESSAGE_LIST_PADDING_HORIZONTAL - OFFSET_CONNECTOR_CONTAINER,\n top: 0,\n bottom: 0,\n },\n myReplyConnectorPosition: {\n left: '50%',\n },\n myReplyConnectorSpacer: {\n bottom: AVATAR_CONNECTOR_SPACING,\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 shortHeadCurveConnector: {\n borderColor: borderColor,\n borderLeftWidth: CONNECTOR_BORDER_WIDTH,\n borderTopWidth: CONNECTOR_BORDER_WIDTH,\n borderTopLeftRadius: 16,\n flex: 1,\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 // TODO: Remove when Services React Native bumps to React Native 0.74 or higher.\n resetPosition: {\n position: 'absolute',\n left: 0,\n right: 0,\n top: 0,\n bottom: 0,\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,kCAAkC,GACnC,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAA;AAErD,MAAM,wBAAwB,GAAG,EAAE,CAAA;AACnC,MAAM,sBAAsB,GAAG,CAAC,CAAA;AAChC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R,GAAG,EAAE,CAAC;YACN,MAAM,EAAE,CAAC;SACV;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\nconst OFFSET_CONNECTOR_CONTAINER = CONNECTOR_BORDER_WIDTH / 2 // Accounts for the border width ensuring the connectors are centered under the avatar\nexport const AVATAR_CONNECTOR_SPACING = 8\n\ninterface ReplyConnectorProps {\n message: MessageResource\n messageBubbleHeight: number\n}\n\nexport function TheirReplyConnector({ message, messageBubbleHeight }: ReplyConnectorProps) {\n const styles = useStyles()\n const { nextRendersAuthor, threadPosition, renderAuthor, isReplyShadowMessage } = message\n\n if (!REPLIES_FEATURE_ENABLED) return null\n if (messageBubbleHeight === 0) return null // Prevents UI shifting\n\n const connectorMap: Record<string, React.ReactNode | null> = {\n shortTailCurve: <ShortTailCurveConnector height={messageBubbleHeight / 2} />,\n shortHeadCurve: <ShortHeadCurveConnector height={messageBubbleHeight / 2} />,\n verticalLine: <VerticalLineConnector />,\n default: null,\n }\n\n const getConnectorKey = () => {\n if (threadPosition === 'first' && !renderAuthor) return 'shortHeadCurve'\n if (threadPosition === 'last' && !renderAuthor) return 'shortTailCurve'\n if (\n (threadPosition === 'first' && renderAuthor) ||\n threadPosition === 'center' ||\n isReplyShadowMessage\n )\n return 'verticalLine'\n return 'default'\n }\n\n const ConnectorComponent = connectorMap[getConnectorKey()]\n if (!ConnectorComponent) return null\n\n const spacerStyle = nextRendersAuthor ? styles.theirReplyConnectorSpacer : null\n\n return (\n <View style={[styles.theirReplyConnectorContainer, spacerStyle]}>{ConnectorComponent}</View>\n )\n}\n\nexport function MyReplyConnector({ message, messageBubbleHeight }: ReplyConnectorProps) {\n const styles = useStyles()\n const { nextRendersAuthor, threadPosition, prevIsMyReply, nextIsMyReply, isReplyShadowMessage } =\n message\n\n if (!REPLIES_FEATURE_ENABLED) return null\n if (messageBubbleHeight === 0) return null // Prevents UI shifting\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} height={messageBubbleHeight} />,\n default: null,\n }\n\n const getConnectorKey = () => {\n if (threadPosition === 'first' || isReplyShadowMessage) return 'longHeadCurve'\n if (threadPosition === 'center' && prevIsMyReply && nextIsMyReply) return 'verticalLine'\n if (threadPosition === 'center' && (!prevIsMyReply || !nextIsMyReply)) return 'swirl'\n if (threadPosition === 'last') return 'longTailCurve'\n\n return 'default'\n }\n\n const ConnectorComponent = connectorMap[getConnectorKey()]\n if (!ConnectorComponent) return null\n\n const spacerStyle = nextRendersAuthor ? styles.myReplyConnectorSpacer : null\n\n return (\n <EnforceLeftPositionForMyReplyConnector>\n <View style={[styles.myReplyConnectorContainer, spacerStyle]}>{ConnectorComponent}</View>\n </EnforceLeftPositionForMyReplyConnector>\n )\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 const { colors } = useTheme()\n\n return (\n <View style={[styles.longHeadCurveConnector, { marginTop: height }, style]}>\n <Svg width={MY_REPLY_CONNECTOR_WIDTH} height={18} fill=\"none\">\n <Path\n d=\"M 2 18 L 2 16 A 14 14 0 0 1 16 2 L 38 2\"\n stroke={colors.borderColorDefaultBase}\n strokeWidth={CONNECTOR_BORDER_WIDTH}\n />\n </Svg>\n <View style={styles.svgConnnectorVerticalLineTail} />\n </View>\n )\n}\n\nfunction LongTailCurveConnector({ height, style }: { height: number; style?: ViewStyle }) {\n const styles = useStyles()\n const { colors } = useTheme()\n\n return (\n <View style={[{ height }, style]}>\n <View style={styles.svgConnnectorVerticalLineHead} />\n <Svg width={MY_REPLY_CONNECTOR_WIDTH} height={18} fill=\"none\">\n <Path\n d=\"M 2 0 L 2 2 A 14 14 0 0 0 16 16 L 38 16\"\n stroke={colors.borderColorDefaultBase}\n strokeWidth={CONNECTOR_BORDER_WIDTH}\n />\n </Svg>\n </View>\n )\n}\n\nfunction ShortHeadCurveConnector({ height }: { height: number }) {\n const styles = useStyles()\n const { colors } = useTheme()\n\n return (\n <View style={[styles.shortHeadCurveConnector, { marginTop: height }]}>\n <Svg width={20} height={18} fill=\"none\">\n <Path\n d=\"M 2 18 L 2 16 A 14 14 0 0 1 16 2 L 20 2\"\n stroke={colors.borderColorDefaultBase}\n strokeWidth={CONNECTOR_BORDER_WIDTH}\n />\n </Svg>\n <View style={styles.svgConnnectorVerticalLineTail} />\n </View>\n )\n}\n\nfunction ShortTailCurveConnector({ height }: { height: number }) {\n const styles = useStyles()\n const { colors } = useTheme()\n\n return (\n <View style={{ height }}>\n <View style={styles.svgConnnectorVerticalLineHead} />\n <Svg width={20} height={18} fill=\"none\">\n <Path\n d=\"M 2 0 L 2 2 A 14 14 0 0 0 16 16 L 20 16\"\n stroke={colors.borderColorDefaultBase}\n strokeWidth={CONNECTOR_BORDER_WIDTH}\n />\n </Svg>\n </View>\n )\n}\n\nfunction SwirlConnector({ style, height }: { style?: ViewStyle; height: number }) {\n const styles = useStyles()\n const { colors } = useTheme()\n\n return (\n <View style={[styles.swirlConnectorContainer, style]}>\n <View style={{ height }}>\n <View style={styles.svgConnnectorVerticalLineHead} />\n <Svg width={27} height={34} fill=\"none\">\n <Path\n stroke={colors.borderColorDefaultBase}\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.svgConnnectorVerticalLineTail} />\n </View>\n <View style={styles.svgConnnectorVerticalLineTail} />\n </View>\n )\n}\n\n// TODO: Remove when Services React Native bumps to React Native 0.74 or higher.\n// This fixes a React Native bug where using `flexDirection: 'row-reverse'` also switches the `left`/`right` absolute positioning values.\n// The wrapper ensures the MyReplyConnector is always positioned to the left of the message bubble on older versions of React Native.\n// Long term fix is described here: https://reactnative.dev/blog/2024/04/22/release-0.74#new-layout-behaviors\nfunction EnforceLeftPositionForMyReplyConnector({ children }: { children: React.ReactNode }) {\n const styles = useStyles()\n return (\n <View\n style={styles.resetPosition}\n pointerEvents=\"none\" // ensures wrapper does not block press events\n >\n {children}\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 marginRight: OFFSET_CONNECTOR_CONTAINER,\n alignSelf: 'flex-end',\n flex: 1,\n },\n theirReplyConnectorSpacer: {\n paddingBottom: AVATAR_CONNECTOR_SPACING,\n },\n myReplyConnectorContainer: {\n width: MESSAGE_AUTHOR_AVATAR_COLUMN_WIDTH,\n position: 'absolute',\n left: CONVERSATION_MESSAGE_LIST_PADDING_HORIZONTAL - OFFSET_CONNECTOR_CONTAINER,\n top: 0,\n bottom: 0,\n },\n myReplyConnectorPosition: {\n left: '50%',\n },\n myReplyConnectorSpacer: {\n bottom: AVATAR_CONNECTOR_SPACING,\n },\n verticalLineConnector: {\n flex: 1,\n borderLeftWidth: CONNECTOR_BORDER_WIDTH,\n borderLeftColor: borderColor,\n },\n longHeadCurveConnector: {\n flex: 1,\n },\n shortHeadCurveConnector: {\n flex: 1,\n },\n swirlConnectorContainer: {\n flex: 1,\n },\n svgConnnectorVerticalLineHead: {\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 svgConnnectorVerticalLineTail: {\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 // TODO: Remove when Services React Native bumps to React Native 0.74 or higher.\n resetPosition: {\n position: 'absolute',\n left: 0,\n right: 0,\n top: 0,\n bottom: 0,\n },\n })\n}\n"]}
|
|
@@ -15,7 +15,7 @@ export function ReplyShadowMessage({ conversation_id, inReplyScreen, messageId,
|
|
|
15
15
|
if (isLoading)
|
|
16
16
|
return <ShadowMessageFallback text="Loading..."/>;
|
|
17
17
|
if (isError || !message)
|
|
18
|
-
return <ShadowMessageFallback text="Message
|
|
18
|
+
return <ShadowMessageFallback text="Message deleted"/>;
|
|
19
19
|
const enrichedMessage = {
|
|
20
20
|
...message,
|
|
21
21
|
isReplyShadowMessage,
|
|
@@ -24,7 +24,7 @@ export function ReplyShadowMessage({ conversation_id, inReplyScreen, messageId,
|
|
|
24
24
|
return <ShadowMessageContent conversation_id={conversation_id} {...enrichedMessage}/>;
|
|
25
25
|
}
|
|
26
26
|
function ShadowMessageContent({ conversation_id, ...message }) {
|
|
27
|
-
const { text } = message;
|
|
27
|
+
const { text, deletedAt } = message;
|
|
28
28
|
const styles = useStyles(message);
|
|
29
29
|
const { colors } = useTheme();
|
|
30
30
|
const navigation = useNavigation();
|
|
@@ -32,6 +32,8 @@ function ShadowMessageContent({ conversation_id, ...message }) {
|
|
|
32
32
|
const { animatedBackgroundColor, handleMessagePressIn, handleMessagePressOut } = useAnimatedMessageBackgroundColor();
|
|
33
33
|
const scalableNumberOfLines = useScalableNumberOfLines(2);
|
|
34
34
|
const replyCountText = pluralize(message.replyCount, 'reply');
|
|
35
|
+
const isDeleted = !!deletedAt;
|
|
36
|
+
const messageText = isDeleted ? 'Message deleted' : text;
|
|
35
37
|
const handleNavigateToReplies = () => {
|
|
36
38
|
navigation.navigate('ConversationReply', {
|
|
37
39
|
conversation_id,
|
|
@@ -42,8 +44,8 @@ function ShadowMessageContent({ conversation_id, ...message }) {
|
|
|
42
44
|
return (<Pressable android_ripple={{ color: colors.androidRippleNeutral }} onPress={handleNavigateToReplies} onPressIn={handleMessagePressIn} onPressOut={handleMessagePressOut} accessibilityHint="Navigate to reply screen for this message" accessibilityRole="link">
|
|
43
45
|
<Animated.View style={[styles.message, animatedBackgroundColor]}>
|
|
44
46
|
{!message.mine && (<View>
|
|
45
|
-
<View style={styles.avatarWrapper}>
|
|
46
|
-
<Avatar size="xs" sourceUri={message.author.avatar} style={styles.avatar} maxFontSizeMultiplier={1}/>
|
|
47
|
+
<View style={[styles.avatarWrapper, !isDeleted && styles.avatarOpacity]}>
|
|
48
|
+
<Avatar size="xs" sourceUri={message.author.avatar} style={styles.avatar} maxFontSizeMultiplier={1} fallbackIconName={isDeleted ? 'publishing.trash' : 'general.person'} showFallback={isDeleted}/>
|
|
47
49
|
</View>
|
|
48
50
|
<TheirReplyConnector message={message} messageBubbleHeight={messageBubbleHeight}/>
|
|
49
51
|
</View>)}
|
|
@@ -51,7 +53,7 @@ function ShadowMessageContent({ conversation_id, ...message }) {
|
|
|
51
53
|
<View style={styles.messageBubble} onLayout={e => setMessageBubbleHeight(e.nativeEvent.layout.height)}>
|
|
52
54
|
<MessageAttachmentImagery attachments={message.attachments}/>
|
|
53
55
|
{text && (<Text variant="footnote" style={styles.messageText} numberOfLines={scalableNumberOfLines}>
|
|
54
|
-
{
|
|
56
|
+
{messageText}
|
|
55
57
|
</Text>)}
|
|
56
58
|
</View>
|
|
57
59
|
<View style={styles.messageMeta}>
|
|
@@ -148,6 +150,8 @@ const useStyles = ({ mine, imageWidth = 32, imageHeight = 32 } = {}) => {
|
|
|
148
150
|
},
|
|
149
151
|
avatar: {
|
|
150
152
|
marginBottom: 8,
|
|
153
|
+
},
|
|
154
|
+
avatarOpacity: {
|
|
151
155
|
opacity: 0.5,
|
|
152
156
|
},
|
|
153
157
|
messageBubble: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reply_shadow_message.js","sourceRoot":"","sources":["../../../src/components/conversation/reply_shadow_message.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,mBAAmB,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC/E,OAAO,EAAE,MAAM,EAAE,IAAI,EAAa,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AACjE,OAAO,EACL,iCAAiC,EACjC,YAAY,EACZ,wBAAwB,EACxB,QAAQ,GACT,MAAM,aAAa,CAAA;AAQpB,OAAO,EACL,4CAA4C,EAC5C,wBAAwB,EACxB,kCAAkC,EAClC,wBAAwB,GACzB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,QAAQ,MAAM,yBAAyB,CAAA;AAC9C,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAC1E,OAAO,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAA;AAU7E,MAAM,UAAU,kBAAkB,CAAC,EACjC,eAAe,EACf,aAAa,EACb,SAAS,EACT,oBAAoB,EACpB,iBAAiB,GACO;IACxB,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,sBAAsB,CAAC,EAAE,eAAe,EAAE,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AQ,EAAE,EAAE;SACb;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import React from 'react'\nimport { Pressable, StyleSheet, useWindowDimensions, View } from 'react-native'\nimport { Avatar, Icon, IconProps, Image, Text } from '../display'\nimport {\n useAnimatedMessageBackgroundColor,\n useFontScale,\n useScalableNumberOfLines,\n useTheme,\n} from '../../hooks'\nimport { MessageResource } from '../../types'\nimport {\n DenormalizedAttachmentResource,\n DenormalizedGiphyAttachmentResource,\n DenormalizedExpandedLinkAttachmentResource,\n DenormalizedMessageAttachmentResource,\n} from '../../types/resources/denormalized_attachment_resource'\nimport {\n CONVERSATION_MESSAGE_LIST_PADDING_HORIZONTAL,\n MAX_FONT_SIZE_MULTIPLIER,\n MESSAGE_AUTHOR_AVATAR_COLUMN_WIDTH,\n platformFontWeightMedium,\n} from '../../utils/styles'\nimport Animated from 'react-native-reanimated'\nimport { TheirReplyConnector, MyReplyConnector } from './reply_connectors'\nimport { assertKeysAreNumbers, pluralize } from '../../utils'\nimport { useNavigation } from '@react-navigation/native'\nimport { useConversationMessage } from '../../hooks/use_conversation_message'\n\ninterface ReplyShadowMessageProps extends MessageResource {\n messageId: string\n conversation_id: number\n inReplyScreen?: boolean\n isReplyShadowMessage: boolean\n nextRendersAuthor: boolean\n}\n\nexport function ReplyShadowMessage({\n conversation_id,\n inReplyScreen,\n messageId,\n isReplyShadowMessage,\n nextRendersAuthor,\n}: ReplyShadowMessageProps) {\n const { message, isError, isLoading } = useConversationMessage({ conversation_id, messageId })\n\n if (inReplyScreen) return null\n if (isLoading) return <ShadowMessageFallback text=\"Loading...\" />\n if (isError || !message) return <ShadowMessageFallback text=\"Message not found\" />\n\n const enrichedMessage = {\n ...message,\n isReplyShadowMessage,\n nextRendersAuthor,\n }\n\n return <ShadowMessageContent conversation_id={conversation_id} {...enrichedMessage} />\n}\n\ninterface ShadowMessageContentProps extends MessageResource {\n conversation_id: number\n}\n\nfunction ShadowMessageContent({ conversation_id, ...message }: ShadowMessageContentProps) {\n const { text } = message\n const styles = useStyles(message)\n const { colors } = useTheme()\n const navigation = useNavigation()\n\n const [messageBubbleHeight, setMessageBubbleHeight] = React.useState(0)\n const { animatedBackgroundColor, handleMessagePressIn, handleMessagePressOut } =\n useAnimatedMessageBackgroundColor()\n const scalableNumberOfLines = useScalableNumberOfLines(2)\n const replyCountText = pluralize(message.replyCount, 'reply')\n\n const handleNavigateToReplies = () => {\n navigation.navigate('ConversationReply', {\n conversation_id,\n reply_root_id: message.replyRootId,\n reply_root_author_name: message.author.name,\n })\n }\n\n return (\n <Pressable\n android_ripple={{ color: colors.androidRippleNeutral }}\n onPress={handleNavigateToReplies}\n onPressIn={handleMessagePressIn}\n onPressOut={handleMessagePressOut}\n accessibilityHint=\"Navigate to reply screen for this message\"\n accessibilityRole=\"link\"\n >\n <Animated.View style={[styles.message, animatedBackgroundColor]}>\n {!message.mine && (\n <View>\n <View style={styles.avatarWrapper}>\n <Avatar\n size=\"xs\"\n sourceUri={message.author.avatar}\n style={styles.avatar}\n maxFontSizeMultiplier={1}\n />\n </View>\n <TheirReplyConnector message={message} messageBubbleHeight={messageBubbleHeight} />\n </View>\n )}\n <View style={styles.messageContent}>\n <View\n style={styles.messageBubble}\n onLayout={e => setMessageBubbleHeight(e.nativeEvent.layout.height)}\n >\n <MessageAttachmentImagery attachments={message.attachments} />\n {text && (\n <Text\n variant=\"footnote\"\n style={styles.messageText}\n numberOfLines={scalableNumberOfLines}\n >\n {text}\n </Text>\n )}\n </View>\n <View style={styles.messageMeta}>\n <Text variant=\"footnote\" style={styles.replyCountText}>\n {replyCountText}\n </Text>\n </View>\n </View>\n {message.mine && (\n <MyReplyConnector message={message} messageBubbleHeight={messageBubbleHeight} />\n )}\n </Animated.View>\n </Pressable>\n )\n}\n\nfunction MessageAttachmentImagery({\n attachments,\n}: {\n attachments: DenormalizedAttachmentResource[]\n}) {\n if (!attachments || attachments.length === 0) return null\n\n const attachment = attachments[0]\n\n if (attachment.type === 'giphy') {\n return <GiphyImage attachment={attachment} />\n }\n if (attachment.type === 'ExpandedLink') {\n return <ExpandedLinkImage attachment={attachment} />\n }\n if (attachment.type === 'MessageAttachment') {\n const contentType = attachment.attributes?.contentType\n const basicType = contentType?.split('/')[0]\n\n switch (basicType) {\n case 'image':\n return <MessageAttachmentImage attachment={attachment} />\n case 'video':\n return <MessageAttachmentIcon iconName=\"general.outlinedVideoFile\" />\n case 'audio':\n return <MessageAttachmentIcon iconName=\"general.outlinedMusicFile\" />\n case 'application':\n return <MessageAttachmentIcon iconName=\"general.outlinedGenericFile\" />\n default:\n return null\n }\n }\n\n return null\n}\n\nfunction GiphyImage({ attachment }: { attachment: DenormalizedGiphyAttachmentResource }) {\n const { title, giphy } = attachment\n const { url } = giphy.fixedWidth\n const { width, height } = assertKeysAreNumbers(giphy.fixedWidth)\n const styles = useStyles({ imageWidth: width, imageHeight: height })\n\n return (\n <Image\n source={{ uri: url }}\n wrapperStyle={styles.imageWrapper}\n style={styles.image}\n alt={title}\n loaderSize={16}\n />\n )\n}\n\nfunction ExpandedLinkImage({\n attachment,\n}: {\n attachment: DenormalizedExpandedLinkAttachmentResource\n}) {\n const { title = '', imageUrl, imageHeight, imageWidth } = attachment.attributes\n const styles = useStyles({ imageWidth, imageHeight })\n\n return (\n <Image\n source={{ uri: imageUrl }}\n wrapperStyle={styles.imageWrapper}\n style={styles.image}\n alt={title}\n loaderSize={16}\n />\n )\n}\n\nfunction MessageAttachmentImage({\n attachment,\n}: {\n attachment: DenormalizedMessageAttachmentResource\n}) {\n const { url, urlMedium, filename, metadata = {} } = attachment.attributes\n const styles = useStyles({ imageWidth: metadata.width, imageHeight: metadata.height })\n\n return (\n <Image\n source={{ uri: urlMedium || url }}\n style={styles.image}\n wrapperStyle={styles.imageWrapper}\n alt={filename}\n loaderSize={16}\n />\n )\n}\n\nfunction MessageAttachmentIcon({ iconName }: { iconName: IconProps['name'] }) {\n const styles = useStyles()\n return (\n <Icon\n name={iconName}\n style={styles.attachmentIcon}\n maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER}\n />\n )\n}\n\n// TODO: The mine prop is not used yet, but in the future we will be adding a way to find the `mine` value for this fallback.\nfunction ShadowMessageFallback({ text, mine }: { text: string; mine?: boolean }) {\n const styles = useStyles({ mine })\n\n return (\n <View style={styles.message}>\n <View style={styles.messageContent}>\n <View style={styles.messageBubble}>\n <Text variant=\"footnote\" style={styles.messageText}>\n {text}\n </Text>\n </View>\n </View>\n </View>\n )\n}\n\ninterface StylesProps {\n imageWidth?: number\n imageHeight?: number\n mine?: boolean\n}\n\nconst useStyles = ({ mine, imageWidth = 32, imageHeight = 32 }: StylesProps = {}) => {\n const { colors } = useTheme()\n const fontScale = useFontScale({ maxFontSizeMultiplier: MAX_FONT_SIZE_MULTIPLIER })\n const { width } = useWindowDimensions()\n const tabletWidth = width >= 744 // Smallest iPad Mini's width\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 marginBottom: 12,\n },\n avatarWrapper: {\n width: MESSAGE_AUTHOR_AVATAR_COLUMN_WIDTH,\n alignItems: 'center',\n },\n avatar: {\n marginBottom: 8,\n opacity: 0.5,\n },\n messageBubble: {\n flexDirection: 'row',\n alignSelf: mine ? 'flex-end' : 'flex-start',\n alignItems: 'center',\n gap: 8,\n borderColor: colors.borderColorDefaultBase,\n borderWidth: 1,\n borderRadius: 8,\n maxWidth: tabletWidth ? 360 : '80%',\n paddingVertical: 6,\n paddingHorizontal: 8,\n },\n messageText: {\n color: colors.textColorDefaultPlaceholder,\n flexShrink: 1,\n },\n messageMeta: {\n flexDirection: 'row',\n justifyContent: mine ? 'flex-end' : 'flex-start',\n },\n replyCountText: {\n color: colors.interaction,\n fontWeight: platformFontWeightMedium,\n },\n imageWrapper: {\n width: 32 * fontScale,\n aspectRatio: imageWidth / imageHeight,\n opacity: 0.5,\n },\n image: {\n borderRadius: 4,\n },\n attachmentIcon: {\n color: colors.iconColorDefaultDim,\n fontSize: 16,\n },\n })\n}\n"]}
|
|
1
|
+
{"version":3,"file":"reply_shadow_message.js","sourceRoot":"","sources":["../../../src/components/conversation/reply_shadow_message.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,mBAAmB,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC/E,OAAO,EAAE,MAAM,EAAE,IAAI,EAAa,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AACjE,OAAO,EACL,iCAAiC,EACjC,YAAY,EACZ,wBAAwB,EACxB,QAAQ,GACT,MAAM,aAAa,CAAA;AAQpB,OAAO,EACL,4CAA4C,EAC5C,wBAAwB,EACxB,kCAAkC,EAClC,wBAAwB,GACzB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,QAAQ,MAAM,yBAAyB,CAAA;AAC9C,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAC1E,OAAO,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAA;AAU7E,MAAM,UAAU,kBAAkB,CAAC,EACjC,eAAe,EACf,aAAa,EACb,SAAS,EACT,oBAAoB,EACpB,iBAAiB,GACO;IACxB,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,sBAAsB,CAAC,EAAE,eAAe,EAAE,SAAS,EAAE,CAAC,CAAA;IAE9F,IAAI,aAAa;QAAE,OAAO,IAAI,CAAA;IAC9B,IAAI,SAAS;QAAE,OAAO,CAAC,qBAAqB,CAAC,IAAI,CAAC,YAAY,EAAG,CAAA;IACjE,IAAI,OAAO,IAA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AG,SAAS;YACrB,WAAW,EAAE,UAAU,GAAG,WAAW;YACrC,OAAO,EAAE,GAAG;SACb;QACD,KAAK,EAAE;YACL,YAAY,EAAE,CAAC;SAChB;QACD,cAAc,EAAE;YACd,KAAK,EAAE,MAAM,CAAC,mBAAmB;YACjC,QAAQ,EAAE,EAAE;SACb;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import React from 'react'\nimport { Pressable, StyleSheet, useWindowDimensions, View } from 'react-native'\nimport { Avatar, Icon, IconProps, Image, Text } from '../display'\nimport {\n useAnimatedMessageBackgroundColor,\n useFontScale,\n useScalableNumberOfLines,\n useTheme,\n} from '../../hooks'\nimport { MessageResource } from '../../types'\nimport {\n DenormalizedAttachmentResource,\n DenormalizedGiphyAttachmentResource,\n DenormalizedExpandedLinkAttachmentResource,\n DenormalizedMessageAttachmentResource,\n} from '../../types/resources/denormalized_attachment_resource'\nimport {\n CONVERSATION_MESSAGE_LIST_PADDING_HORIZONTAL,\n MAX_FONT_SIZE_MULTIPLIER,\n MESSAGE_AUTHOR_AVATAR_COLUMN_WIDTH,\n platformFontWeightMedium,\n} from '../../utils/styles'\nimport Animated from 'react-native-reanimated'\nimport { TheirReplyConnector, MyReplyConnector } from './reply_connectors'\nimport { assertKeysAreNumbers, pluralize } from '../../utils'\nimport { useNavigation } from '@react-navigation/native'\nimport { useConversationMessage } from '../../hooks/use_conversation_message'\n\ninterface ReplyShadowMessageProps extends MessageResource {\n messageId: string\n conversation_id: number\n inReplyScreen?: boolean\n isReplyShadowMessage: boolean\n nextRendersAuthor: boolean\n}\n\nexport function ReplyShadowMessage({\n conversation_id,\n inReplyScreen,\n messageId,\n isReplyShadowMessage,\n nextRendersAuthor,\n}: ReplyShadowMessageProps) {\n const { message, isError, isLoading } = useConversationMessage({ conversation_id, messageId })\n\n if (inReplyScreen) return null\n if (isLoading) return <ShadowMessageFallback text=\"Loading...\" />\n if (isError || !message) return <ShadowMessageFallback text=\"Message deleted\" />\n\n const enrichedMessage = {\n ...message,\n isReplyShadowMessage,\n nextRendersAuthor,\n }\n\n return <ShadowMessageContent conversation_id={conversation_id} {...enrichedMessage} />\n}\n\ninterface ShadowMessageContentProps extends MessageResource {\n conversation_id: number\n}\n\nfunction ShadowMessageContent({ conversation_id, ...message }: ShadowMessageContentProps) {\n const { text, deletedAt } = message\n const styles = useStyles(message)\n const { colors } = useTheme()\n const navigation = useNavigation()\n\n const [messageBubbleHeight, setMessageBubbleHeight] = React.useState(0)\n const { animatedBackgroundColor, handleMessagePressIn, handleMessagePressOut } =\n useAnimatedMessageBackgroundColor()\n const scalableNumberOfLines = useScalableNumberOfLines(2)\n const replyCountText = pluralize(message.replyCount, 'reply')\n const isDeleted = !!deletedAt\n const messageText = isDeleted ? 'Message deleted' : text\n\n const handleNavigateToReplies = () => {\n navigation.navigate('ConversationReply', {\n conversation_id,\n reply_root_id: message.replyRootId,\n reply_root_author_name: message.author.name,\n })\n }\n\n return (\n <Pressable\n android_ripple={{ color: colors.androidRippleNeutral }}\n onPress={handleNavigateToReplies}\n onPressIn={handleMessagePressIn}\n onPressOut={handleMessagePressOut}\n accessibilityHint=\"Navigate to reply screen for this message\"\n accessibilityRole=\"link\"\n >\n <Animated.View style={[styles.message, animatedBackgroundColor]}>\n {!message.mine && (\n <View>\n <View style={[styles.avatarWrapper, !isDeleted && styles.avatarOpacity]}>\n <Avatar\n size=\"xs\"\n sourceUri={message.author.avatar}\n style={styles.avatar}\n maxFontSizeMultiplier={1}\n fallbackIconName={isDeleted ? 'publishing.trash' : 'general.person'}\n showFallback={isDeleted}\n />\n </View>\n <TheirReplyConnector message={message} messageBubbleHeight={messageBubbleHeight} />\n </View>\n )}\n <View style={styles.messageContent}>\n <View\n style={styles.messageBubble}\n onLayout={e => setMessageBubbleHeight(e.nativeEvent.layout.height)}\n >\n <MessageAttachmentImagery attachments={message.attachments} />\n {text && (\n <Text\n variant=\"footnote\"\n style={styles.messageText}\n numberOfLines={scalableNumberOfLines}\n >\n {messageText}\n </Text>\n )}\n </View>\n <View style={styles.messageMeta}>\n <Text variant=\"footnote\" style={styles.replyCountText}>\n {replyCountText}\n </Text>\n </View>\n </View>\n {message.mine && (\n <MyReplyConnector message={message} messageBubbleHeight={messageBubbleHeight} />\n )}\n </Animated.View>\n </Pressable>\n )\n}\n\nfunction MessageAttachmentImagery({\n attachments,\n}: {\n attachments: DenormalizedAttachmentResource[]\n}) {\n if (!attachments || attachments.length === 0) return null\n\n const attachment = attachments[0]\n\n if (attachment.type === 'giphy') {\n return <GiphyImage attachment={attachment} />\n }\n if (attachment.type === 'ExpandedLink') {\n return <ExpandedLinkImage attachment={attachment} />\n }\n if (attachment.type === 'MessageAttachment') {\n const contentType = attachment.attributes?.contentType\n const basicType = contentType?.split('/')[0]\n\n switch (basicType) {\n case 'image':\n return <MessageAttachmentImage attachment={attachment} />\n case 'video':\n return <MessageAttachmentIcon iconName=\"general.outlinedVideoFile\" />\n case 'audio':\n return <MessageAttachmentIcon iconName=\"general.outlinedMusicFile\" />\n case 'application':\n return <MessageAttachmentIcon iconName=\"general.outlinedGenericFile\" />\n default:\n return null\n }\n }\n\n return null\n}\n\nfunction GiphyImage({ attachment }: { attachment: DenormalizedGiphyAttachmentResource }) {\n const { title, giphy } = attachment\n const { url } = giphy.fixedWidth\n const { width, height } = assertKeysAreNumbers(giphy.fixedWidth)\n const styles = useStyles({ imageWidth: width, imageHeight: height })\n\n return (\n <Image\n source={{ uri: url }}\n wrapperStyle={styles.imageWrapper}\n style={styles.image}\n alt={title}\n loaderSize={16}\n />\n )\n}\n\nfunction ExpandedLinkImage({\n attachment,\n}: {\n attachment: DenormalizedExpandedLinkAttachmentResource\n}) {\n const { title = '', imageUrl, imageHeight, imageWidth } = attachment.attributes\n const styles = useStyles({ imageWidth, imageHeight })\n\n return (\n <Image\n source={{ uri: imageUrl }}\n wrapperStyle={styles.imageWrapper}\n style={styles.image}\n alt={title}\n loaderSize={16}\n />\n )\n}\n\nfunction MessageAttachmentImage({\n attachment,\n}: {\n attachment: DenormalizedMessageAttachmentResource\n}) {\n const { url, urlMedium, filename, metadata = {} } = attachment.attributes\n const styles = useStyles({ imageWidth: metadata.width, imageHeight: metadata.height })\n\n return (\n <Image\n source={{ uri: urlMedium || url }}\n style={styles.image}\n wrapperStyle={styles.imageWrapper}\n alt={filename}\n loaderSize={16}\n />\n )\n}\n\nfunction MessageAttachmentIcon({ iconName }: { iconName: IconProps['name'] }) {\n const styles = useStyles()\n return (\n <Icon\n name={iconName}\n style={styles.attachmentIcon}\n maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER}\n />\n )\n}\n\n// TODO: The mine prop is not used yet, but in the future we will be adding a way to find the `mine` value for this fallback.\nfunction ShadowMessageFallback({ text, mine }: { text: string; mine?: boolean }) {\n const styles = useStyles({ mine })\n\n return (\n <View style={styles.message}>\n <View style={styles.messageContent}>\n <View style={styles.messageBubble}>\n <Text variant=\"footnote\" style={styles.messageText}>\n {text}\n </Text>\n </View>\n </View>\n </View>\n )\n}\n\ninterface StylesProps {\n imageWidth?: number\n imageHeight?: number\n mine?: boolean\n}\n\nconst useStyles = ({ mine, imageWidth = 32, imageHeight = 32 }: StylesProps = {}) => {\n const { colors } = useTheme()\n const fontScale = useFontScale({ maxFontSizeMultiplier: MAX_FONT_SIZE_MULTIPLIER })\n const { width } = useWindowDimensions()\n const tabletWidth = width >= 744 // Smallest iPad Mini's width\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 marginBottom: 12,\n },\n avatarWrapper: {\n width: MESSAGE_AUTHOR_AVATAR_COLUMN_WIDTH,\n alignItems: 'center',\n },\n avatar: {\n marginBottom: 8,\n },\n avatarOpacity: {\n opacity: 0.5,\n },\n messageBubble: {\n flexDirection: 'row',\n alignSelf: mine ? 'flex-end' : 'flex-start',\n alignItems: 'center',\n gap: 8,\n borderColor: colors.borderColorDefaultBase,\n borderWidth: 1,\n borderRadius: 8,\n maxWidth: tabletWidth ? 360 : '80%',\n paddingVertical: 6,\n paddingHorizontal: 8,\n },\n messageText: {\n color: colors.textColorDefaultPlaceholder,\n flexShrink: 1,\n },\n messageMeta: {\n flexDirection: 'row',\n justifyContent: mine ? 'flex-end' : 'flex-start',\n },\n replyCountText: {\n color: colors.interaction,\n fontWeight: platformFontWeightMedium,\n },\n imageWrapper: {\n width: 32 * fontScale,\n aspectRatio: imageWidth / imageHeight,\n opacity: 0.5,\n },\n image: {\n borderRadius: 4,\n },\n attachmentIcon: {\n color: colors.iconColorDefaultDim,\n fontSize: 16,\n },\n })\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@planningcenter/chat-react-native",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.18.0-rc.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"react-native-url-polyfill": "^2.0.0",
|
|
60
60
|
"typescript": "<5.6.0"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "287575911f3f115e39925babf52624759860167a"
|
|
63
63
|
}
|
|
@@ -66,10 +66,31 @@ export function Message({
|
|
|
66
66
|
enabled: !!message.replyRootId,
|
|
67
67
|
})
|
|
68
68
|
|
|
69
|
+
const metaProps = {
|
|
70
|
+
authorName: message.author.name,
|
|
71
|
+
createdAt: message.createdAt,
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const renderAuthor = (!message.mine && message.renderAuthor) || false
|
|
75
|
+
const showReplyCountButton =
|
|
76
|
+
!inReplyScreen && message.replyRootId === message.id && REPLIES_FEATURE_ENABLED
|
|
77
|
+
const isReplyRootMessage = message.replyRootId === message.id
|
|
78
|
+
const isDeletedReplyRootMessage = isReplyRootMessage && !!message.deletedAt
|
|
79
|
+
|
|
80
|
+
const messageText = isDeletedReplyRootMessage ? 'Message deleted' : text
|
|
81
|
+
const replyCountText = pluralize(message.replyCount, 'reply')
|
|
82
|
+
const messagePendingLabel = isPersisted ? 'Saving' : 'Sending'
|
|
69
83
|
const replyRootAuthorName = message.replyRootId
|
|
70
84
|
? replyRootMessage?.author.name
|
|
71
85
|
: message.author.name
|
|
72
86
|
|
|
87
|
+
const messageBottomMargin =
|
|
88
|
+
message.lastInGroup || message.nextIsReplyShadowMessage
|
|
89
|
+
? 16
|
|
90
|
+
: hasReactions || showMessageMeta || showReplyCountButton
|
|
91
|
+
? 8
|
|
92
|
+
: 4
|
|
93
|
+
|
|
73
94
|
useEffect(() => {
|
|
74
95
|
if (pending) {
|
|
75
96
|
const timer = setTimeout(() => {
|
|
@@ -135,23 +156,6 @@ export function Message({
|
|
|
135
156
|
})
|
|
136
157
|
}
|
|
137
158
|
|
|
138
|
-
const metaProps = {
|
|
139
|
-
authorName: message.author.name,
|
|
140
|
-
createdAt: message.createdAt,
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
const renderAuthor = (!message.mine && message.renderAuthor) || false
|
|
144
|
-
const messagePendingLabel = isPersisted ? 'Saving' : 'Sending'
|
|
145
|
-
const showReplyCountButton =
|
|
146
|
-
!inReplyScreen && message.replyRootId === message.id && REPLIES_FEATURE_ENABLED
|
|
147
|
-
const replyCountText = pluralize(message.replyCount, 'reply')
|
|
148
|
-
const messageBottomMargin =
|
|
149
|
-
message.lastInGroup || message.nextIsReplyShadowMessage
|
|
150
|
-
? 16
|
|
151
|
-
: hasReactions || showMessageMeta || showReplyCountButton
|
|
152
|
-
? 8
|
|
153
|
-
: 4
|
|
154
|
-
|
|
155
159
|
return (
|
|
156
160
|
<Pressable
|
|
157
161
|
onLongPress={handleMessageLongPress}
|
|
@@ -171,6 +175,8 @@ export function Message({
|
|
|
171
175
|
style={styles.avatar}
|
|
172
176
|
maxFontSizeMultiplier={1}
|
|
173
177
|
minFontSizeMultiplier={1}
|
|
178
|
+
fallbackIconName={isDeletedReplyRootMessage ? 'publishing.trash' : 'general.person'}
|
|
179
|
+
showFallback={isDeletedReplyRootMessage}
|
|
174
180
|
/>
|
|
175
181
|
) : (
|
|
176
182
|
<View style={styles.avatarPlaceholder} />
|
|
@@ -196,9 +202,9 @@ export function Message({
|
|
|
196
202
|
onMessageLongPress={handleMessageLongPress}
|
|
197
203
|
/>
|
|
198
204
|
</ErrorBoundary>
|
|
199
|
-
{
|
|
205
|
+
{messageText && (
|
|
200
206
|
<View style={styles.messageText}>
|
|
201
|
-
<MessageMarkdown text={
|
|
207
|
+
<MessageMarkdown text={messageText} />
|
|
202
208
|
</View>
|
|
203
209
|
)}
|
|
204
210
|
</View>
|
|
@@ -108,22 +108,74 @@ function VerticalLineConnector({ style }: { style?: ViewStyle }) {
|
|
|
108
108
|
|
|
109
109
|
function LongHeadCurveConnector({ height, style }: { height: number; style?: ViewStyle }) {
|
|
110
110
|
const styles = useStyles()
|
|
111
|
-
|
|
111
|
+
const { colors } = useTheme()
|
|
112
|
+
|
|
113
|
+
return (
|
|
114
|
+
<View style={[styles.longHeadCurveConnector, { marginTop: height }, style]}>
|
|
115
|
+
<Svg width={MY_REPLY_CONNECTOR_WIDTH} height={18} fill="none">
|
|
116
|
+
<Path
|
|
117
|
+
d="M 2 18 L 2 16 A 14 14 0 0 1 16 2 L 38 2"
|
|
118
|
+
stroke={colors.borderColorDefaultBase}
|
|
119
|
+
strokeWidth={CONNECTOR_BORDER_WIDTH}
|
|
120
|
+
/>
|
|
121
|
+
</Svg>
|
|
122
|
+
<View style={styles.svgConnnectorVerticalLineTail} />
|
|
123
|
+
</View>
|
|
124
|
+
)
|
|
112
125
|
}
|
|
113
126
|
|
|
114
127
|
function LongTailCurveConnector({ height, style }: { height: number; style?: ViewStyle }) {
|
|
115
128
|
const styles = useStyles()
|
|
116
|
-
|
|
129
|
+
const { colors } = useTheme()
|
|
130
|
+
|
|
131
|
+
return (
|
|
132
|
+
<View style={[{ height }, style]}>
|
|
133
|
+
<View style={styles.svgConnnectorVerticalLineHead} />
|
|
134
|
+
<Svg width={MY_REPLY_CONNECTOR_WIDTH} height={18} fill="none">
|
|
135
|
+
<Path
|
|
136
|
+
d="M 2 0 L 2 2 A 14 14 0 0 0 16 16 L 38 16"
|
|
137
|
+
stroke={colors.borderColorDefaultBase}
|
|
138
|
+
strokeWidth={CONNECTOR_BORDER_WIDTH}
|
|
139
|
+
/>
|
|
140
|
+
</Svg>
|
|
141
|
+
</View>
|
|
142
|
+
)
|
|
117
143
|
}
|
|
118
144
|
|
|
119
145
|
function ShortHeadCurveConnector({ height }: { height: number }) {
|
|
120
146
|
const styles = useStyles()
|
|
121
|
-
|
|
147
|
+
const { colors } = useTheme()
|
|
148
|
+
|
|
149
|
+
return (
|
|
150
|
+
<View style={[styles.shortHeadCurveConnector, { marginTop: height }]}>
|
|
151
|
+
<Svg width={20} height={18} fill="none">
|
|
152
|
+
<Path
|
|
153
|
+
d="M 2 18 L 2 16 A 14 14 0 0 1 16 2 L 20 2"
|
|
154
|
+
stroke={colors.borderColorDefaultBase}
|
|
155
|
+
strokeWidth={CONNECTOR_BORDER_WIDTH}
|
|
156
|
+
/>
|
|
157
|
+
</Svg>
|
|
158
|
+
<View style={styles.svgConnnectorVerticalLineTail} />
|
|
159
|
+
</View>
|
|
160
|
+
)
|
|
122
161
|
}
|
|
123
162
|
|
|
124
163
|
function ShortTailCurveConnector({ height }: { height: number }) {
|
|
125
164
|
const styles = useStyles()
|
|
126
|
-
|
|
165
|
+
const { colors } = useTheme()
|
|
166
|
+
|
|
167
|
+
return (
|
|
168
|
+
<View style={{ height }}>
|
|
169
|
+
<View style={styles.svgConnnectorVerticalLineHead} />
|
|
170
|
+
<Svg width={20} height={18} fill="none">
|
|
171
|
+
<Path
|
|
172
|
+
d="M 2 0 L 2 2 A 14 14 0 0 0 16 16 L 20 16"
|
|
173
|
+
stroke={colors.borderColorDefaultBase}
|
|
174
|
+
strokeWidth={CONNECTOR_BORDER_WIDTH}
|
|
175
|
+
/>
|
|
176
|
+
</Svg>
|
|
177
|
+
</View>
|
|
178
|
+
)
|
|
127
179
|
}
|
|
128
180
|
|
|
129
181
|
function SwirlConnector({ style, height }: { style?: ViewStyle; height: number }) {
|
|
@@ -133,7 +185,7 @@ function SwirlConnector({ style, height }: { style?: ViewStyle; height: number }
|
|
|
133
185
|
return (
|
|
134
186
|
<View style={[styles.swirlConnectorContainer, style]}>
|
|
135
187
|
<View style={{ height }}>
|
|
136
|
-
<View style={styles.
|
|
188
|
+
<View style={styles.svgConnnectorVerticalLineHead} />
|
|
137
189
|
<Svg width={27} height={34} fill="none">
|
|
138
190
|
<Path
|
|
139
191
|
stroke={colors.borderColorDefaultBase}
|
|
@@ -141,9 +193,9 @@ function SwirlConnector({ style, height }: { style?: ViewStyle; height: number }
|
|
|
141
193
|
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"
|
|
142
194
|
/>
|
|
143
195
|
</Svg>
|
|
144
|
-
<View style={styles.
|
|
196
|
+
<View style={styles.svgConnnectorVerticalLineTail} />
|
|
145
197
|
</View>
|
|
146
|
-
<View style={styles.
|
|
198
|
+
<View style={styles.svgConnnectorVerticalLineTail} />
|
|
147
199
|
</View>
|
|
148
200
|
)
|
|
149
201
|
}
|
|
@@ -197,43 +249,21 @@ const useStyles = () => {
|
|
|
197
249
|
borderLeftColor: borderColor,
|
|
198
250
|
},
|
|
199
251
|
longHeadCurveConnector: {
|
|
200
|
-
width: MY_REPLY_CONNECTOR_WIDTH,
|
|
201
|
-
borderColor: borderColor,
|
|
202
|
-
borderLeftWidth: CONNECTOR_BORDER_WIDTH,
|
|
203
|
-
borderTopWidth: CONNECTOR_BORDER_WIDTH,
|
|
204
|
-
borderTopLeftRadius: 16,
|
|
205
252
|
flex: 1,
|
|
206
253
|
},
|
|
207
|
-
longTailCurveConnector: {
|
|
208
|
-
width: MY_REPLY_CONNECTOR_WIDTH,
|
|
209
|
-
borderColor: borderColor,
|
|
210
|
-
borderLeftWidth: CONNECTOR_BORDER_WIDTH,
|
|
211
|
-
borderBottomWidth: CONNECTOR_BORDER_WIDTH,
|
|
212
|
-
borderBottomLeftRadius: 16,
|
|
213
|
-
},
|
|
214
254
|
shortHeadCurveConnector: {
|
|
215
|
-
borderColor: borderColor,
|
|
216
|
-
borderLeftWidth: CONNECTOR_BORDER_WIDTH,
|
|
217
|
-
borderTopWidth: CONNECTOR_BORDER_WIDTH,
|
|
218
|
-
borderTopLeftRadius: 16,
|
|
219
255
|
flex: 1,
|
|
220
256
|
},
|
|
221
|
-
shortTailCurveConnector: {
|
|
222
|
-
borderColor: borderColor,
|
|
223
|
-
borderLeftWidth: CONNECTOR_BORDER_WIDTH,
|
|
224
|
-
borderBottomWidth: CONNECTOR_BORDER_WIDTH,
|
|
225
|
-
borderBottomLeftRadius: 16,
|
|
226
|
-
},
|
|
227
257
|
swirlConnectorContainer: {
|
|
228
258
|
flex: 1,
|
|
229
259
|
},
|
|
230
|
-
|
|
260
|
+
svgConnnectorVerticalLineHead: {
|
|
231
261
|
backgroundColor: borderColor,
|
|
232
262
|
width: CONNECTOR_BORDER_WIDTH,
|
|
233
263
|
flex: 1,
|
|
234
264
|
marginBottom: -1, // Ensures there is no gap between the vertical line and the swirl connector
|
|
235
265
|
},
|
|
236
|
-
|
|
266
|
+
svgConnnectorVerticalLineTail: {
|
|
237
267
|
backgroundColor: borderColor,
|
|
238
268
|
width: CONNECTOR_BORDER_WIDTH,
|
|
239
269
|
flex: 1,
|
|
@@ -45,7 +45,7 @@ export function ReplyShadowMessage({
|
|
|
45
45
|
|
|
46
46
|
if (inReplyScreen) return null
|
|
47
47
|
if (isLoading) return <ShadowMessageFallback text="Loading..." />
|
|
48
|
-
if (isError || !message) return <ShadowMessageFallback text="Message
|
|
48
|
+
if (isError || !message) return <ShadowMessageFallback text="Message deleted" />
|
|
49
49
|
|
|
50
50
|
const enrichedMessage = {
|
|
51
51
|
...message,
|
|
@@ -61,7 +61,7 @@ interface ShadowMessageContentProps extends MessageResource {
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
function ShadowMessageContent({ conversation_id, ...message }: ShadowMessageContentProps) {
|
|
64
|
-
const { text } = message
|
|
64
|
+
const { text, deletedAt } = message
|
|
65
65
|
const styles = useStyles(message)
|
|
66
66
|
const { colors } = useTheme()
|
|
67
67
|
const navigation = useNavigation()
|
|
@@ -71,6 +71,8 @@ function ShadowMessageContent({ conversation_id, ...message }: ShadowMessageCont
|
|
|
71
71
|
useAnimatedMessageBackgroundColor()
|
|
72
72
|
const scalableNumberOfLines = useScalableNumberOfLines(2)
|
|
73
73
|
const replyCountText = pluralize(message.replyCount, 'reply')
|
|
74
|
+
const isDeleted = !!deletedAt
|
|
75
|
+
const messageText = isDeleted ? 'Message deleted' : text
|
|
74
76
|
|
|
75
77
|
const handleNavigateToReplies = () => {
|
|
76
78
|
navigation.navigate('ConversationReply', {
|
|
@@ -92,12 +94,14 @@ function ShadowMessageContent({ conversation_id, ...message }: ShadowMessageCont
|
|
|
92
94
|
<Animated.View style={[styles.message, animatedBackgroundColor]}>
|
|
93
95
|
{!message.mine && (
|
|
94
96
|
<View>
|
|
95
|
-
<View style={styles.avatarWrapper}>
|
|
97
|
+
<View style={[styles.avatarWrapper, !isDeleted && styles.avatarOpacity]}>
|
|
96
98
|
<Avatar
|
|
97
99
|
size="xs"
|
|
98
100
|
sourceUri={message.author.avatar}
|
|
99
101
|
style={styles.avatar}
|
|
100
102
|
maxFontSizeMultiplier={1}
|
|
103
|
+
fallbackIconName={isDeleted ? 'publishing.trash' : 'general.person'}
|
|
104
|
+
showFallback={isDeleted}
|
|
101
105
|
/>
|
|
102
106
|
</View>
|
|
103
107
|
<TheirReplyConnector message={message} messageBubbleHeight={messageBubbleHeight} />
|
|
@@ -115,7 +119,7 @@ function ShadowMessageContent({ conversation_id, ...message }: ShadowMessageCont
|
|
|
115
119
|
style={styles.messageText}
|
|
116
120
|
numberOfLines={scalableNumberOfLines}
|
|
117
121
|
>
|
|
118
|
-
{
|
|
122
|
+
{messageText}
|
|
119
123
|
</Text>
|
|
120
124
|
)}
|
|
121
125
|
</View>
|
|
@@ -281,6 +285,8 @@ const useStyles = ({ mine, imageWidth = 32, imageHeight = 32 }: StylesProps = {}
|
|
|
281
285
|
},
|
|
282
286
|
avatar: {
|
|
283
287
|
marginBottom: 8,
|
|
288
|
+
},
|
|
289
|
+
avatarOpacity: {
|
|
284
290
|
opacity: 0.5,
|
|
285
291
|
},
|
|
286
292
|
messageBubble: {
|