@planningcenter/chat-react-native 3.18.0-rc.8 → 3.18.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.
Files changed (37) hide show
  1. package/build/components/conversation/message.d.ts.map +1 -1
  2. package/build/components/conversation/message.js +28 -12
  3. package/build/components/conversation/message.js.map +1 -1
  4. package/build/components/conversation/messages_disabled_banners.d.ts +3 -0
  5. package/build/components/conversation/messages_disabled_banners.d.ts.map +1 -0
  6. package/build/components/conversation/messages_disabled_banners.js +53 -0
  7. package/build/components/conversation/messages_disabled_banners.js.map +1 -0
  8. package/build/components/conversation/reply_shadow_message.d.ts.map +1 -1
  9. package/build/components/conversation/reply_shadow_message.js +8 -3
  10. package/build/components/conversation/reply_shadow_message.js.map +1 -1
  11. package/build/hooks/use_conversation_messages.d.ts.map +1 -1
  12. package/build/hooks/use_conversation_messages.js +2 -1
  13. package/build/hooks/use_conversation_messages.js.map +1 -1
  14. package/build/screens/age_check/age_check_required_screen.js +1 -1
  15. package/build/screens/age_check/age_check_required_screen.js.map +1 -1
  16. package/build/screens/age_check/components/age_check_select_birthdate_modal.js +2 -2
  17. package/build/screens/age_check/components/age_check_select_birthdate_modal.js.map +1 -1
  18. package/build/screens/conversation_details_screen.d.ts.map +1 -1
  19. package/build/screens/conversation_details_screen.js +6 -2
  20. package/build/screens/conversation_details_screen.js.map +1 -1
  21. package/build/screens/conversation_screen.d.ts.map +1 -1
  22. package/build/screens/conversation_screen.js +21 -11
  23. package/build/screens/conversation_screen.js.map +1 -1
  24. package/package.json +2 -2
  25. package/src/components/conversation/message.tsx +40 -11
  26. package/src/components/conversation/messages_disabled_banners.tsx +69 -0
  27. package/src/components/conversation/reply_shadow_message.tsx +9 -2
  28. package/src/hooks/use_conversation_messages.ts +3 -1
  29. package/src/screens/age_check/age_check_required_screen.tsx +1 -1
  30. package/src/screens/age_check/components/age_check_select_birthdate_modal.tsx +2 -0
  31. package/src/screens/conversation_details_screen.tsx +6 -2
  32. package/src/screens/conversation_screen.tsx +26 -13
  33. package/build/components/conversation/disabled_replies_banners.d.ts +0 -3
  34. package/build/components/conversation/disabled_replies_banners.d.ts.map +0 -1
  35. package/build/components/conversation/disabled_replies_banners.js +0 -41
  36. package/build/components/conversation/disabled_replies_banners.js.map +0 -1
  37. package/src/components/conversation/disabled_replies_banners.tsx +0 -58
@@ -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;AAqB7C;;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;IACvB,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB;AAED,wBAAgB,OAAO,CAAC,EACtB,4BAA4B,EAC5B,eAAe,EACf,wBAAwB,EACxB,aAAa,EACb,cAAc,EACd,GAAG,OAAO,EACX,EAAE,YAAY,qBAmQd"}
1
+ {"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/message.tsx"],"names":[],"mappings":"AACA,OAAO,KAAoB,MAAM,OAAO,CAAA;AAexC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAsB7C;;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;IACvB,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB;AAED,wBAAgB,OAAO,CAAC,EACtB,4BAA4B,EAC5B,eAAe,EACf,wBAAwB,EACxB,aAAa,EACb,cAAc,EACd,GAAG,OAAO,EACX,EAAE,YAAY,qBAyRd"}
@@ -1,6 +1,6 @@
1
1
  import { useNavigation } from '@react-navigation/native';
2
2
  import React, { useEffect } from 'react';
3
- import { Pressable, StyleSheet, useWindowDimensions, View } from 'react-native';
3
+ import { Pressable, StyleSheet, useWindowDimensions, View, } from 'react-native';
4
4
  import { MessageReaction } from '../../components/conversation/message_reaction';
5
5
  import { Avatar, Icon, Spinner, Text, TextButton, TextInlineButton } from '../../components/display';
6
6
  import { useAnimatedMessageBackgroundColor, useInteractionGhostBackgroundColor, useTheme, } from '../../hooks';
@@ -16,9 +16,10 @@ import { Haptic } from '../../utils/native_adapters';
16
16
  import { TheirReplyConnector, MyReplyConnector, AVATAR_CONNECTOR_SPACING } from './reply_connectors';
17
17
  import { pluralize } from '../../utils';
18
18
  import { useConversationMessage } from '../../hooks/use_conversation_message';
19
+ import { some } from 'lodash';
19
20
  import { isNewMessage } from '../../utils/cache/messages_cache';
20
21
  export function Message({ canDeleteNonAuthoredMessages, conversation_id, latestReadMessageSortKey, inReplyScreen, repliesEnabled, ...message }) {
21
- const { text, reactionCounts, pending, error } = message;
22
+ const { text, reactionCounts, pending, error, attachments, author } = message;
22
23
  const styles = useMessageStyles(message);
23
24
  const navigation = useNavigation();
24
25
  const { colors } = useTheme();
@@ -37,23 +38,27 @@ export function Message({ canDeleteNonAuthoredMessages, conversation_id, latestR
37
38
  enabled: !!message.replyRootId,
38
39
  });
39
40
  const metaProps = {
40
- authorName: message.author.name,
41
+ authorName: author.name,
41
42
  createdAt: message.createdAt,
42
43
  };
43
44
  const renderAuthor = (!message.mine && message.renderAuthor) || false;
44
45
  const showReplyCountButton = !inReplyScreen && message.replyRootId === message.id && repliesEnabled;
45
46
  const isReplyRootMessage = message.replyRootId === message.id;
46
47
  const isDeletedReplyRootMessage = isReplyRootMessage && !!message.deletedAt;
48
+ const replyToReplyRootMessage = repliesEnabled && !isReplyRootMessage && !!message.replyRootId;
47
49
  const replyCountText = pluralize(message.replyCount, 'reply');
48
50
  const messagePendingLabel = isPersisted ? 'Saving' : 'Sending';
49
- const replyRootAuthorName = message.replyRootId
50
- ? replyRootMessage?.author.name
51
- : message.author.name;
51
+ const replyRootAuthorName = message.replyRootId ? replyRootMessage?.author.name : author.name;
52
+ const messageText = isDeletedReplyRootMessage ? 'Message deleted' : text;
52
53
  const messageBottomMargin = message.lastInGroup || message.nextIsReplyShadowMessage
53
54
  ? 16
54
55
  : hasReactions || showMessageMeta || showReplyCountButton
55
56
  ? 8
56
57
  : 4;
58
+ const messageIsReplyLabel = replyToReplyRootMessage ? 'Reply' : '';
59
+ const attachmentLabel = some(attachments) ? pluralize(attachments.length, 'attachment') : '';
60
+ const replyCountLabel = isReplyRootMessage ? replyCountText : '';
61
+ const accessibilityLabel = `${author?.name || ''} ${messageIsReplyLabel} ${attachmentLabel} ${messageText || ''} ${timestamp} ${replyCountLabel}`;
57
62
  useEffect(() => {
58
63
  if (pending) {
59
64
  const timer = setTimeout(() => {
@@ -113,25 +118,36 @@ export function Message({ canDeleteNonAuthoredMessages, conversation_id, latestR
113
118
  navigation.navigate('ConversationReply', {
114
119
  conversation_id,
115
120
  reply_root_id: message.id,
116
- reply_root_author_name: message.author.name,
121
+ reply_root_author_name: author.name,
117
122
  });
118
123
  };
119
- return (<Pressable onLongPress={handleMessageLongPress} onPress={handleMessagePress} onPressIn={handleMessagePressIn} onPressOut={handleMessagePressOut} android_ripple={{ color: colors.androidRippleNeutral, borderless: false, foreground: true }} accessibilityHint="Long press to view message actions like reacting and copying." disabled={isDeletedReplyRootMessage}>
124
+ const accessibilityActions = [
125
+ {
126
+ name: 'navigateToReplies',
127
+ label: 'Navigate to replies',
128
+ },
129
+ ];
130
+ const handleAccessibilityAction = (event) => {
131
+ if (event.nativeEvent.actionName === 'navigateToReplies') {
132
+ handleNavigateToReplyPress();
133
+ }
134
+ };
135
+ return (<Pressable onLongPress={handleMessageLongPress} onPress={handleMessagePress} onPressIn={handleMessagePressIn} onPressOut={handleMessagePressOut} android_ripple={{ color: colors.androidRippleNeutral, borderless: false, foreground: true }} accessibilityRole="button" accessibilityLabel={accessibilityLabel} accessibilityHint="Long press to view message actions like reacting and copying." accessibilityActions={isReplyRootMessage ? accessibilityActions : undefined} onAccessibilityAction={isReplyRootMessage ? handleAccessibilityAction : undefined} disabled={isDeletedReplyRootMessage}>
120
136
  <Animated.View style={[styles.message, animatedBackgroundColor]}>
121
137
  {!message.mine && (<View>
122
- {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}/>)}
138
+ {renderAuthor ? (<Avatar size={'md'} sourceUri={author.avatar} style={styles.avatar} maxFontSizeMultiplier={1} minFontSizeMultiplier={1} fallbackIconName={isDeletedReplyRootMessage ? 'publishing.trash' : 'general.person'} showFallback={isDeletedReplyRootMessage}/>) : (<View style={styles.avatarPlaceholder}/>)}
123
139
  {repliesEnabled && (<TheirReplyConnector message={message} messageBubbleHeight={messageBubbleHeight}/>)}
124
140
  </View>)}
125
141
  <View style={[styles.messageContent, { marginBottom: messageBottomMargin }]}>
126
142
  {renderAuthor && !isDeletedReplyRootMessage && (<Text variant="footnote" style={styles.authorName}>
127
- {message.author.name}
143
+ {author.name}
128
144
  </Text>)}
129
145
  <View style={styles.messageBubble} onLayout={e => setMessageBubbleHeight(e.nativeEvent.layout.height)}>
130
146
  {isDeletedReplyRootMessage ? (<View style={styles.messageText}>
131
- <Text style={styles.replyRootDeletedText}>Message deleted</Text>
147
+ <Text style={styles.replyRootDeletedText}>{messageText}</Text>
132
148
  </View>) : (<>
133
149
  <ErrorBoundary>
134
- <MessageAttachments attachments={message.attachments} metaProps={metaProps} onMessageAttachmentLongPress={handleMessageAttachmentLongPress} onMessageLongPress={handleMessageLongPress}/>
150
+ <MessageAttachments attachments={attachments} metaProps={metaProps} onMessageAttachmentLongPress={handleMessageAttachmentLongPress} onMessageLongPress={handleMessageLongPress}/>
135
151
  </ErrorBoundary>
136
152
  {text && (<View style={styles.messageText}>
137
153
  <MessageMarkdown text={text}/>
@@ -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,MAAM,oCAAoC,CAAA;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAC7D,OAAO,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAA;AACnF,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAA;AACpD,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,oBAA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YACpB,GAAG,EAAE,CAAC;YACN,cAAc,EAAE,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY;SACjD;QACD,iBAAiB,EAAE;YACjB,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY;SAC5C;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;QACD,oBAAoB,EAAE;YACpB,KAAK,EAAE,MAAM,CAAC,yBAAyB;YACvC,SAAS,EAAE,QAAQ;SACpB;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 { 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 } from '../../utils'\nimport { useConversationMessage } from '../../hooks/use_conversation_message'\nimport { isNewMessage } from '../../utils/cache/messages_cache'\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 repliesEnabled?: boolean\n}\n\nexport function Message({\n canDeleteNonAuthoredMessages,\n conversation_id,\n latestReadMessageSortKey,\n inReplyScreen,\n repliesEnabled,\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 && repliesEnabled\n const isReplyRootMessage = message.replyRootId === message.id\n const isDeletedReplyRootMessage = isReplyRootMessage && !!message.deletedAt\n\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 handleMessagePress = () => {\n setShowMessageMetaToggle(!showMessageMetaToggle)\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\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={handleMessagePress}\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 disabled={isDeletedReplyRootMessage}\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 {repliesEnabled && (\n <TheirReplyConnector message={message} messageBubbleHeight={messageBubbleHeight} />\n )}\n </View>\n )}\n <View style={[styles.messageContent, { marginBottom: messageBottomMargin }]}>\n {renderAuthor && !isDeletedReplyRootMessage && (\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 {isDeletedReplyRootMessage ? (\n <View style={styles.messageText}>\n <Text style={styles.replyRootDeletedText}>Message deleted</Text>\n </View>\n ) : (\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 </>\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 && !isDeletedReplyRootMessage && (\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 && !isDeletedReplyRootMessage && (\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 {repliesEnabled && 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 replyRootDeletedText: {\n color: colors.textColorDefaultSecondary,\n fontStyle: 'italic',\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,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,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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;QACD,oBAAoB,EAAE;YACpB,KAAK,EAAE,MAAM,CAAC,yBAAyB;YACvC,SAAS,EAAE,QAAQ;SACpB;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { useNavigation } from '@react-navigation/native'\nimport React, { useEffect } from 'react'\nimport {\n AccessibilityActionEvent,\n Pressable,\n StyleSheet,\n useWindowDimensions,\n View,\n} 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 { 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 } from '../../utils'\nimport { useConversationMessage } from '../../hooks/use_conversation_message'\nimport { some } from 'lodash'\nimport { isNewMessage } from '../../utils/cache/messages_cache'\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 repliesEnabled?: boolean\n}\n\nexport function Message({\n canDeleteNonAuthoredMessages,\n conversation_id,\n latestReadMessageSortKey,\n inReplyScreen,\n repliesEnabled,\n ...message\n}: MessageProps) {\n const { text, reactionCounts, pending, error, attachments, author } = 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: 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 && repliesEnabled\n const isReplyRootMessage = message.replyRootId === message.id\n const isDeletedReplyRootMessage = isReplyRootMessage && !!message.deletedAt\n const replyToReplyRootMessage = repliesEnabled && !isReplyRootMessage && !!message.replyRootId\n\n const replyCountText = pluralize(message.replyCount, 'reply')\n const messagePendingLabel = isPersisted ? 'Saving' : 'Sending'\n const replyRootAuthorName = message.replyRootId ? replyRootMessage?.author.name : author.name\n const messageText = isDeletedReplyRootMessage ? 'Message deleted' : text\n\n const messageBottomMargin =\n message.lastInGroup || message.nextIsReplyShadowMessage\n ? 16\n : hasReactions || showMessageMeta || showReplyCountButton\n ? 8\n : 4\n\n const messageIsReplyLabel = replyToReplyRootMessage ? 'Reply' : ''\n const attachmentLabel = some(attachments) ? pluralize(attachments.length, 'attachment') : ''\n const replyCountLabel = isReplyRootMessage ? replyCountText : ''\n const accessibilityLabel = `${author?.name || ''} ${messageIsReplyLabel} ${attachmentLabel} ${messageText || ''} ${timestamp} ${replyCountLabel}`\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 handleMessagePress = () => {\n setShowMessageMetaToggle(!showMessageMetaToggle)\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\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: author.name,\n })\n }\n\n const accessibilityActions = [\n {\n name: 'navigateToReplies',\n label: 'Navigate to replies',\n },\n ]\n\n const handleAccessibilityAction = (event: AccessibilityActionEvent) => {\n if (event.nativeEvent.actionName === 'navigateToReplies') {\n handleNavigateToReplyPress()\n }\n }\n\n return (\n <Pressable\n onLongPress={handleMessageLongPress}\n onPress={handleMessagePress}\n onPressIn={handleMessagePressIn}\n onPressOut={handleMessagePressOut}\n android_ripple={{ color: colors.androidRippleNeutral, borderless: false, foreground: true }}\n accessibilityRole=\"button\"\n accessibilityLabel={accessibilityLabel}\n accessibilityHint=\"Long press to view message actions like reacting and copying.\"\n accessibilityActions={isReplyRootMessage ? accessibilityActions : undefined}\n onAccessibilityAction={isReplyRootMessage ? handleAccessibilityAction : undefined}\n disabled={isDeletedReplyRootMessage}\n >\n <Animated.View style={[styles.message, animatedBackgroundColor]}>\n {!message.mine && (\n <View>\n {renderAuthor ? (\n <Avatar\n size={'md'}\n sourceUri={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 {repliesEnabled && (\n <TheirReplyConnector message={message} messageBubbleHeight={messageBubbleHeight} />\n )}\n </View>\n )}\n <View style={[styles.messageContent, { marginBottom: messageBottomMargin }]}>\n {renderAuthor && !isDeletedReplyRootMessage && (\n <Text variant=\"footnote\" style={styles.authorName}>\n {author.name}\n </Text>\n )}\n <View\n style={styles.messageBubble}\n onLayout={e => setMessageBubbleHeight(e.nativeEvent.layout.height)}\n >\n {isDeletedReplyRootMessage ? (\n <View style={styles.messageText}>\n <Text style={styles.replyRootDeletedText}>{messageText}</Text>\n </View>\n ) : (\n <>\n <ErrorBoundary>\n <MessageAttachments\n attachments={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 </>\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 && !isDeletedReplyRootMessage && (\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 && !isDeletedReplyRootMessage && (\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 {repliesEnabled && 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 replyRootDeletedText: {\n color: colors.textColorDefaultSecondary,\n fontStyle: 'italic',\n },\n })\n}\n"]}
@@ -0,0 +1,3 @@
1
+ export declare const LeaderMessagesDisabledBanner: () => import("react").JSX.Element;
2
+ export declare const MemberMessagesDisabledBanner: () => import("react").JSX.Element;
3
+ //# sourceMappingURL=messages_disabled_banners.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messages_disabled_banners.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/messages_disabled_banners.tsx"],"names":[],"mappings":"AAOA,eAAO,MAAM,4BAA4B,mCASxC,CAAA;AAED,eAAO,MAAM,4BAA4B,mCAUxC,CAAA"}
@@ -0,0 +1,53 @@
1
+ import { StyleSheet, View } from 'react-native';
2
+ import { useTheme } from '../../hooks';
3
+ import { Text } from '../display';
4
+ import { useSafeAreaInsets } from 'react-native-safe-area-context';
5
+ import { useFeatures } from '../../hooks/use_features';
6
+ import { availableFeatures } from '../../hooks/use_features';
7
+ export const LeaderMessagesDisabledBanner = () => {
8
+ const { featureEnabled } = useFeatures();
9
+ const repliesEnabled = featureEnabled(availableFeatures.threaded_replies);
10
+ const description = repliesEnabled
11
+ ? 'Only leaders can send messages in this conversation.'
12
+ : 'Replies are frozen for everyone else.';
13
+ return <MessagesDisabledBanner description={description}/>;
14
+ };
15
+ export const MemberMessagesDisabledBanner = () => {
16
+ const styles = useStyles();
17
+ const { featureEnabled } = useFeatures();
18
+ const repliesEnabled = featureEnabled(availableFeatures.threaded_replies);
19
+ const description = repliesEnabled
20
+ ? 'Only leaders can send messages, but you can still add reactions.'
21
+ : 'Replies have been disabled by a leader, but you can still add reactions.';
22
+ return <MessagesDisabledBanner description={description} style={styles.memberBanner}/>;
23
+ };
24
+ const MessagesDisabledBanner = ({ description, style }) => {
25
+ const styles = useStyles();
26
+ return (<View style={[styles.baseBanner, style]}>
27
+ <Text style={styles.text} variant="tertiary">
28
+ {description}
29
+ </Text>
30
+ </View>);
31
+ };
32
+ const useStyles = () => {
33
+ const { colors } = useTheme();
34
+ const { bottom } = useSafeAreaInsets();
35
+ return StyleSheet.create({
36
+ baseBanner: {
37
+ paddingHorizontal: 16,
38
+ paddingVertical: 4,
39
+ backgroundColor: colors.statusNeutralComposedBackground,
40
+ borderTopWidth: 1,
41
+ borderTopColor: colors.borderColorDefaultBase,
42
+ },
43
+ text: {
44
+ textAlign: 'center',
45
+ },
46
+ memberBanner: {
47
+ paddingTop: 16,
48
+ paddingBottom: 16 + bottom,
49
+ marginBottom: -bottom,
50
+ },
51
+ });
52
+ };
53
+ //# sourceMappingURL=messages_disabled_banners.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messages_disabled_banners.js","sourceRoot":"","sources":["../../../src/components/conversation/messages_disabled_banners.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAkB,MAAM,cAAc,CAAA;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AACjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAE5D,MAAM,CAAC,MAAM,4BAA4B,GAAG,GAAG,EAAE;IAC/C,MAAM,EAAE,cAAc,EAAE,GAAG,WAAW,EAAE,CAAA;IACxC,MAAM,cAAc,GAAG,cAAc,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAAA;IAEzE,MAAM,WAAW,GAAG,cAAc;QAChC,CAAC,CAAC,sDAAsD;QACxD,CAAC,CAAC,uCAAuC,CAAA;IAE3C,OAAO,CAAC,sBAAsB,CAAC,WAAW,CAAC,CAAC,WAAW,CAAC,EAAG,CAAA;AAC7D,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,4BAA4B,GAAG,GAAG,EAAE;IAC/C,MAA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EAAE;YACZ,UAAU,EAAE,EAAE;YACd,aAAa,EAAE,EAAE,GAAG,MAAM;YAC1B,YAAY,EAAE,CAAC,MAAM;SACtB;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { StyleSheet, View, type ViewStyle } from 'react-native'\nimport { useTheme } from '../../hooks'\nimport { Text } from '../display'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\nimport { useFeatures } from '../../hooks/use_features'\nimport { availableFeatures } from '../../hooks/use_features'\n\nexport const LeaderMessagesDisabledBanner = () => {\n const { featureEnabled } = useFeatures()\n const repliesEnabled = featureEnabled(availableFeatures.threaded_replies)\n\n const description = repliesEnabled\n ? 'Only leaders can send messages in this conversation.'\n : 'Replies are frozen for everyone else.'\n\n return <MessagesDisabledBanner description={description} />\n}\n\nexport const MemberMessagesDisabledBanner = () => {\n const styles = useStyles()\n const { featureEnabled } = useFeatures()\n const repliesEnabled = featureEnabled(availableFeatures.threaded_replies)\n\n const description = repliesEnabled\n ? 'Only leaders can send messages, but you can still add reactions.'\n : 'Replies have been disabled by a leader, but you can still add reactions.'\n\n return <MessagesDisabledBanner description={description} style={styles.memberBanner} />\n}\n\ninterface MessagesDisabledBannerProps {\n description: string\n style?: ViewStyle\n}\n\nconst MessagesDisabledBanner = ({ description, style }: MessagesDisabledBannerProps) => {\n const styles = useStyles()\n\n return (\n <View style={[styles.baseBanner, style]}>\n <Text style={styles.text} variant=\"tertiary\">\n {description}\n </Text>\n </View>\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n const { bottom } = useSafeAreaInsets()\n\n return StyleSheet.create({\n baseBanner: {\n paddingHorizontal: 16,\n paddingVertical: 4,\n backgroundColor: colors.statusNeutralComposedBackground,\n borderTopWidth: 1,\n borderTopColor: colors.borderColorDefaultBase,\n },\n text: {\n textAlign: 'center',\n },\n memberBanner: {\n paddingTop: 16,\n paddingBottom: 16 + bottom,\n marginBottom: -bottom,\n },\n })\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"reply_shadow_message.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/reply_shadow_message.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AASzB,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAmB7C,UAAU,uBAAwB,SAAQ,eAAe;IACvD,SAAS,EAAE,MAAM,CAAA;IACjB,eAAe,EAAE,MAAM,CAAA;IACvB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,oBAAoB,EAAE,OAAO,CAAA;IAC7B,iBAAiB,EAAE,OAAO,CAAA;CAC3B;AAED,wBAAgB,kBAAkB,CAAC,EACjC,eAAe,EACf,aAAa,EACb,SAAS,EACT,oBAAoB,EACpB,iBAAiB,GAClB,EAAE,uBAAuB,4BAczB"}
1
+ {"version":3,"file":"reply_shadow_message.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/reply_shadow_message.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AASzB,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAqB7C,UAAU,uBAAwB,SAAQ,eAAe;IACvD,SAAS,EAAE,MAAM,CAAA;IACjB,eAAe,EAAE,MAAM,CAAA;IACvB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,oBAAoB,EAAE,OAAO,CAAA;IAC7B,iBAAiB,EAAE,OAAO,CAAA;CAC3B;AAED,wBAAgB,kBAAkB,CAAC,EACjC,eAAe,EACf,aAAa,EACb,SAAS,EACT,oBAAoB,EACpB,iBAAiB,GAClB,EAAE,uBAAuB,4BAczB"}
@@ -8,6 +8,8 @@ import { TheirReplyConnector, MyReplyConnector } from './reply_connectors';
8
8
  import { assertKeysAreNumbers, pluralize } from '../../utils';
9
9
  import { useNavigation } from '@react-navigation/native';
10
10
  import { useConversationMessage } from '../../hooks/use_conversation_message';
11
+ import { useLiveRelativeTime } from '../../hooks/use_live_relative_time';
12
+ import { some } from 'lodash';
11
13
  export function ReplyShadowMessage({ conversation_id, inReplyScreen, messageId, isReplyShadowMessage, nextRendersAuthor, }) {
12
14
  const { message, isError, isLoading } = useConversationMessage({ conversation_id, messageId });
13
15
  if (inReplyScreen)
@@ -24,10 +26,11 @@ export function ReplyShadowMessage({ conversation_id, inReplyScreen, messageId,
24
26
  return <ShadowMessageContent conversation_id={conversation_id} {...enrichedMessage}/>;
25
27
  }
26
28
  function ShadowMessageContent({ conversation_id, ...message }) {
27
- const { text, deletedAt } = message;
29
+ const { text, deletedAt, author, attachments } = message;
28
30
  const styles = useStyles(message);
29
31
  const { colors } = useTheme();
30
32
  const navigation = useNavigation();
33
+ const timestamp = useLiveRelativeTime(message.createdAt);
31
34
  const [messageBubbleHeight, setMessageBubbleHeight] = React.useState(0);
32
35
  const { animatedBackgroundColor, handleMessagePressIn, handleMessagePressOut } = useAnimatedMessageBackgroundColor();
33
36
  const scalableNumberOfLines = useScalableNumberOfLines(2);
@@ -41,7 +44,9 @@ function ShadowMessageContent({ conversation_id, ...message }) {
41
44
  reply_root_author_name: message.author.name,
42
45
  });
43
46
  };
44
- return (<Pressable android_ripple={{ color: colors.androidRippleNeutral }} onPress={handleNavigateToReplies} onPressIn={handleMessagePressIn} onPressOut={handleMessagePressOut} accessibilityHint="Navigate to reply screen for this message" accessibilityRole="link">
47
+ const attachmentLabel = some(attachments) ? pluralize(attachments.length, 'attachment') : '';
48
+ const accessibilityLabel = `${author?.name || ''} Reply Preview ${attachmentLabel} ${messageText || ''} ${timestamp} ${replyCountText}`;
49
+ return (<Pressable android_ripple={{ color: colors.androidRippleNeutral }} onPress={handleNavigateToReplies} onPressIn={handleMessagePressIn} onPressOut={handleMessagePressOut} accessibilityLabel={accessibilityLabel} accessibilityHint="Navigate to reply screen for this message" accessibilityRole="link">
45
50
  <Animated.View style={[styles.message, animatedBackgroundColor]}>
46
51
  {!message.mine && (<View>
47
52
  <View style={[styles.avatarWrapper, !isDeleted && styles.avatarOpacity]}>
@@ -51,7 +56,7 @@ function ShadowMessageContent({ conversation_id, ...message }) {
51
56
  </View>)}
52
57
  <View style={styles.messageContent}>
53
58
  <View style={styles.messageBubble} onLayout={e => setMessageBubbleHeight(e.nativeEvent.layout.height)}>
54
- <MessageAttachmentImagery attachments={message.attachments}/>
59
+ <MessageAttachmentImagery attachments={attachments}/>
55
60
  {text && (<Text variant="footnote" style={styles.messageText} numberOfLines={scalableNumberOfLines}>
56
61
  {messageText}
57
62
  </Text>)}
@@ -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,E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IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY;SACjD;QACD,cAAc,EAAE;YACd,KAAK,EAAE,MAAM,CAAC,WAAW;YACzB,UAAU,EAAE,wBAAwB;SACrC;QACD,YAAY,EAAE;YACZ,KAAK,EAAE,EAAE,GAAG,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"]}
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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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'\nimport { useLiveRelativeTime } from '../../hooks/use_live_relative_time'\nimport { some } from 'lodash'\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, author, attachments } = message\n const styles = useStyles(message)\n const { colors } = useTheme()\n const navigation = useNavigation()\n const timestamp = useLiveRelativeTime(message.createdAt)\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 const attachmentLabel = some(attachments) ? pluralize(attachments.length, 'attachment') : ''\n const accessibilityLabel = `${author?.name || ''} Reply Preview ${attachmentLabel} ${messageText || ''} ${timestamp} ${replyCountText}`\n\n return (\n <Pressable\n android_ripple={{ color: colors.androidRippleNeutral }}\n onPress={handleNavigateToReplies}\n onPressIn={handleMessagePressIn}\n onPressOut={handleMessagePressOut}\n accessibilityLabel={accessibilityLabel}\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={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"]}
@@ -1 +1 @@
1
- {"version":3,"file":"use_conversation_messages.d.ts","sourceRoot":"","sources":["../../src/hooks/use_conversation_messages.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAC1C,OAAO,EAAE,wBAAwB,EAAwB,MAAM,oBAAoB,CAAA;AAGnF,eAAO,MAAM,uBAAuB,uCACE;IAAE,eAAe,EAAE,MAAM,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,SACvF,wBAAwB;;;;;;CAkBhC,CAAA"}
1
+ {"version":3,"file":"use_conversation_messages.d.ts","sourceRoot":"","sources":["../../src/hooks/use_conversation_messages.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAC1C,OAAO,EAAE,wBAAwB,EAAwB,MAAM,oBAAoB,CAAA;AAGnF,eAAO,MAAM,uBAAuB,uCACE;IAAE,eAAe,EAAE,MAAM,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,SACvF,wBAAwB;;;;;;CAoBhC,CAAA"}
@@ -5,7 +5,8 @@ export const useConversationMessages = ({ conversation_id, reply_root_id }, opts
5
5
  const { data, refetch, isRefetching, fetchNextPage } = useSuspensePaginator(getMessagesRequestArgs({ conversation_id, reply_root_id }), opts);
6
6
  const queryKey = getMessagesQueryKey({ conversation_id, reply_root_id });
7
7
  const messages = useMemo(() => data
8
- .filter(message => !message.deletedAt && (message.attachments?.length || message.text?.length))
8
+ .filter(message => (!message.deletedAt || message.replyRootId) &&
9
+ (message.attachments?.length || message.text?.length))
9
10
  .sort((a, b) => -a.id.localeCompare(b.id)), [data]);
10
11
  return { messages, refetch, isRefetching, fetchNextPage, queryKey };
11
12
  };
@@ -1 +1 @@
1
- {"version":3,"file":"use_conversation_messages.js","sourceRoot":"","sources":["../../src/hooks/use_conversation_messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAE/B,OAAO,EAA4B,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AACnF,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAA;AAE3F,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACrC,EAAE,eAAe,EAAE,aAAa,EAA8D,EAC9F,IAA+B,EAC/B,EAAE;IACF,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,GAAG,oBAAoB,CACzE,sBAAsB,CAAC,EAAE,eAAe,EAAE,aAAa,EAAE,CAAC,EAC1D,IAAI,CACL,CAAA;IACD,MAAM,QAAQ,GAAG,mBAAmB,CAAC,EAAE,eAAe,EAAE,aAAa,EAAE,CAAC,CAAA;IACxE,MAAM,QAAQ,GAAG,OAAO,CACtB,GAAG,EAAE,CACH,IAAI;SACD,MAAM,CACL,OAAO,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,MAAM,IAAI,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CACvF;SACA,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAC9C,CAAC,IAAI,CAAC,CACP,CAAA;IAED,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAA;AACrE,CAAC,CAAA","sourcesContent":["import { useMemo } from 'react'\nimport { MessageResource } from '../types'\nimport { SuspensePaginatorOptions, useSuspensePaginator } from './use_suspense_api'\nimport { getMessagesQueryKey, getMessagesRequestArgs } from '../utils/request/get_messages'\n\nexport const useConversationMessages = (\n { conversation_id, reply_root_id }: { conversation_id: number; reply_root_id?: string | null },\n opts?: SuspensePaginatorOptions\n) => {\n const { data, refetch, isRefetching, fetchNextPage } = useSuspensePaginator<MessageResource>(\n getMessagesRequestArgs({ conversation_id, reply_root_id }),\n opts\n )\n const queryKey = getMessagesQueryKey({ conversation_id, reply_root_id })\n const messages = useMemo(\n () =>\n data\n .filter(\n message => !message.deletedAt && (message.attachments?.length || message.text?.length)\n )\n .sort((a, b) => -a.id.localeCompare(b.id)),\n [data]\n )\n\n return { messages, refetch, isRefetching, fetchNextPage, queryKey }\n}\n"]}
1
+ {"version":3,"file":"use_conversation_messages.js","sourceRoot":"","sources":["../../src/hooks/use_conversation_messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAE/B,OAAO,EAA4B,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AACnF,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAA;AAE3F,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACrC,EAAE,eAAe,EAAE,aAAa,EAA8D,EAC9F,IAA+B,EAC/B,EAAE;IACF,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,GAAG,oBAAoB,CACzE,sBAAsB,CAAC,EAAE,eAAe,EAAE,aAAa,EAAE,CAAC,EAC1D,IAAI,CACL,CAAA;IACD,MAAM,QAAQ,GAAG,mBAAmB,CAAC,EAAE,eAAe,EAAE,aAAa,EAAE,CAAC,CAAA;IACxE,MAAM,QAAQ,GAAG,OAAO,CACtB,GAAG,EAAE,CACH,IAAI;SACD,MAAM,CACL,OAAO,CAAC,EAAE,CACR,CAAC,CAAC,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,WAAW,CAAC;QAC3C,CAAC,OAAO,CAAC,WAAW,EAAE,MAAM,IAAI,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CACxD;SACA,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAC9C,CAAC,IAAI,CAAC,CACP,CAAA;IAED,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAA;AACrE,CAAC,CAAA","sourcesContent":["import { useMemo } from 'react'\nimport { MessageResource } from '../types'\nimport { SuspensePaginatorOptions, useSuspensePaginator } from './use_suspense_api'\nimport { getMessagesQueryKey, getMessagesRequestArgs } from '../utils/request/get_messages'\n\nexport const useConversationMessages = (\n { conversation_id, reply_root_id }: { conversation_id: number; reply_root_id?: string | null },\n opts?: SuspensePaginatorOptions\n) => {\n const { data, refetch, isRefetching, fetchNextPage } = useSuspensePaginator<MessageResource>(\n getMessagesRequestArgs({ conversation_id, reply_root_id }),\n opts\n )\n const queryKey = getMessagesQueryKey({ conversation_id, reply_root_id })\n const messages = useMemo(\n () =>\n data\n .filter(\n message =>\n (!message.deletedAt || message.replyRootId) &&\n (message.attachments?.length || message.text?.length)\n )\n .sort((a, b) => -a.id.localeCompare(b.id)),\n [data]\n )\n\n return { messages, refetch, isRefetching, fetchNextPage, queryKey }\n}\n"]}
@@ -25,7 +25,7 @@ export function AgeCheckRequiredScreen() {
25
25
  const { submitAgeCheck, isPending, isSuccess } = useSubmitAgeCheck();
26
26
  const styles = useStyles();
27
27
  const birthdateStamp = birthdate
28
- ? formatDate(birthdate, { style: 'standard', year: true })
28
+ ? formatDate(birthdate, { style: 'standard', year: true, timeZone: 'UTC' })
29
29
  : 'Missing';
30
30
  const age = birthdate ? calculateAge(birthdate) : null;
31
31
  const confirmationText = birthdate !== null
@@ -1 +1 @@
1
- {"version":3,"file":"age_check_required_screen.js","sourceRoot":"","sources":["../../../src/screens/age_check/age_check_required_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACvC,OAAO,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,8BAA8B,CAAA;AACjE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAA;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAA;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAA;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAA;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAA;AACxD,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAC3E,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAC1C,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAA;AAC3D,OAAO,EAAE,4BAA4B,EAAE,MAAM,+CAA+C,CAAA;AAE5F,SAAS,YAAY,CAAC,SAAe;IACnC,MAAM,KAAK,GAAG,IAAI,IAAI,EAAE,CAAA;IACxB,MAAM,GAAG,GAAG,KAAK,CAAC,WAAW,EAAE,GAAG,SAAS,CAAC,WAAW,EAAE,CAAA;IACzD,MAAM,sBAAsB,GAC1B,KAAK,CAAC,QAAQ,EAAE,G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MAAM,EAAE;YACN,GAAG,EAAE,CAAC;SACP;QACD,OAAO,EAAE;YACP,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,GAAG,EAAE,CAAC;SACP;QACD,WAAW,EAAE;YACX,KAAK,EAAE,MAAM,CAAC,eAAe;SAC9B;QACD,IAAI,EAAE;YACJ,eAAe,EAAE,MAAM,CAAC,eAAe;YACvC,YAAY,EAAE,CAAC;YACf,OAAO,EAAE,EAAE;YACX,GAAG,EAAE,CAAC;SACP;QACD,KAAK,EAAE;YACL,GAAG,EAAE,CAAC;SACP;QACD,cAAc,EAAE;YACd,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,GAAG,EAAE,CAAC;SACP;QACD,UAAU,EAAE;YACV,IAAI,EAAE,CAAC;SACR;QACD,aAAa,EAAE;YACb,SAAS,EAAE,QAAQ;YACnB,SAAS,EAAE,CAAC;SACb;QACD,IAAI,EAAE;YACJ,UAAU,EAAE,sBAAsB;SACnC;QACD,cAAc,EAAE;YACd,UAAU,EAAE,sBAAsB;SACnC;QACD,aAAa,EAAE;YACb,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,GAAG,EAAE,CAAC;SACP;QACD,UAAU,EAAE;YACV,SAAS,EAAE,UAAU;SACtB;QACD,gBAAgB,EAAE;YAChB,IAAI,EAAE,CAAC;SACR;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import React, { useState } from 'react'\nimport { date as formatDate } from '@planningcenter/datetime-fmt'\nimport { StyleSheet, View } from 'react-native'\nimport { Button } from '../../components/display/button'\nimport { Text } from '../../components/display/text'\nimport { Icon } from '../../components/display/icon'\nimport { Avatar } from '../../components/display/avatar'\nimport { Banner } from '../../components/display/banner'\nimport { useCurrentPerson, useTheme, useSubmitAgeCheck } from '../../hooks'\nimport { Heading } from '../../components'\nimport { platformFontWeightBold } from '../../utils/styles'\nimport { AgeCheckSelectBirthdateModal } from './components/age_check_select_birthdate_modal'\n\nfunction calculateAge(birthdate: Date) {\n const today = new Date()\n const age = today.getFullYear() - birthdate.getFullYear()\n const hasHadBirthdayThisYear =\n today.getMonth() > birthdate.getMonth() ||\n (today.getMonth() === birthdate.getMonth() && today.getDate() >= birthdate.getDate())\n return hasHadBirthdayThisYear ? age : age - 1\n}\n\nexport function AgeCheckRequiredScreen() {\n const person = useCurrentPerson()\n\n const [birthdate, setBirthdate] = useState<Date | null>(null)\n const [draftBirthdate, setDraftBirthdate] = useState<Date | null>(null)\n const [isBirthdateModalOpen, setBirthdateModalOpen] = useState(false)\n const { submitAgeCheck, isPending, isSuccess } = useSubmitAgeCheck()\n const styles = useStyles()\n\n const birthdateStamp = birthdate\n ? formatDate(birthdate, { style: 'standard', year: true })\n : 'Missing'\n\n const age = birthdate ? calculateAge(birthdate) : null\n\n const confirmationText =\n birthdate !== null\n ? `Your birthdate is ${birthdateStamp} and you are ${age} years old. Is that correct?`\n : ''\n\n const openBirthdateModal = () => {\n setDraftBirthdate(birthdate || new Date())\n setBirthdateModalOpen(true)\n }\n\n const closeBirthdateModal = () => {\n setBirthdateModalOpen(false)\n }\n\n const handleSubmitAgeConfirmation = () => {\n if (!birthdate) return\n submitAgeCheck(birthdate)\n }\n\n return (\n <View style={styles.container}>\n <View style={styles.header}>\n <View style={styles.heading}>\n <Icon name=\"general.exclamationTriangle\" size={20} style={styles.warningIcon} />\n <Heading variant=\"h2\">Your age is required to use chat</Heading>\n </View>\n <Text>To help protect those who may be underage, we need to verify your birthdate.</Text>\n </View>\n <View style={styles.cards}>\n <View style={styles.card}>\n <Heading variant=\"h3\">My profile</Heading>\n <View style={styles.profileContent}>\n <Avatar sourceUri={person.avatar || ''} size=\"lg\" showFallback={!person.avatar} />\n <View style={styles.personInfo}>\n <Text style={styles.name} numberOfLines={1}>\n {person.name}\n </Text>\n <View style={styles.birthdateInfo}>\n <Text variant=\"tertiary\" style={styles.birthdateLabel}>\n Birthdate:\n </Text>\n <Text variant=\"tertiary\">{birthdateStamp}</Text>\n </View>\n </View>\n {birthdate && (\n <Button\n title=\"Edit\"\n accessibilityHint=\"Choose a new birthdate for your profile\"\n size=\"sm\"\n variant=\"outline\"\n style={styles.editButton}\n onPress={openBirthdateModal}\n />\n )}\n </View>\n {!birthdate && (\n <Button\n title=\"Add birthdate\"\n accessibilityHint=\"Choose a birthdate for your profile\"\n size=\"lg\"\n style={styles.primaryButton}\n onPress={openBirthdateModal}\n />\n )}\n </View>\n {birthdate && (\n <View style={styles.card}>\n <Heading variant=\"h3\">Age confirmation</Heading>\n {age !== null && age < 13 ? (\n <Banner appearance=\"warning\" description={confirmationText} />\n ) : (\n <Text>{confirmationText}</Text>\n )}\n <Button\n title=\"Yes, update my profile\"\n size=\"lg\"\n style={styles.primaryButton}\n onPress={handleSubmitAgeConfirmation}\n disabled={isPending || isSuccess}\n />\n </View>\n )}\n </View>\n <Text variant=\"tertiary\">\n Your birthdate will be added to your profile, but it is only visible to church\n administrators. It will not be shared with other church members, unless you give permission.\n </Text>\n\n <AgeCheckSelectBirthdateModal\n onChange={setDraftBirthdate}\n onDismiss={closeBirthdateModal}\n onRequestClose={closeBirthdateModal}\n onSubmit={setBirthdate}\n value={draftBirthdate || new Date()}\n visible={isBirthdateModalOpen}\n />\n </View>\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n return StyleSheet.create({\n container: {\n flex: 1,\n backgroundColor: colors.surfaceColor080,\n padding: 16,\n gap: 16,\n },\n header: {\n gap: 8,\n },\n heading: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 8,\n },\n warningIcon: {\n color: colors.statusErrorIcon,\n },\n card: {\n backgroundColor: colors.surfaceColor100,\n borderRadius: 8,\n padding: 16,\n gap: 8,\n },\n cards: {\n gap: 8,\n },\n profileContent: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 8,\n },\n personInfo: {\n flex: 1,\n },\n primaryButton: {\n alignSelf: 'center',\n marginTop: 8,\n },\n name: {\n fontWeight: platformFontWeightBold,\n },\n birthdateLabel: {\n fontWeight: platformFontWeightBold,\n },\n birthdateInfo: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 4,\n },\n editButton: {\n alignSelf: 'flex-end',\n },\n formSheetContent: {\n flex: 1,\n },\n })\n}\n"]}
1
+ {"version":3,"file":"age_check_required_screen.js","sourceRoot":"","sources":["../../../src/screens/age_check/age_check_required_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACvC,OAAO,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,8BAA8B,CAAA;AACjE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAA;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAA;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAA;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAA;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAA;AACxD,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAC3E,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAC1C,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAA;AAC3D,OAAO,EAAE,4BAA4B,EAAE,MAAM,+CAA+C,CAAA;AAE5F,SAAS,YAAY,CAAC,SAAe;IACnC,MAAM,KAAK,GAAG,IAAI,IAAI,EAAE,CAAA;IACxB,MAAM,GAAG,GAAG,KAAK,CAAC,WAAW,EAAE,GAAG,SAAS,CAAC,WAAW,EAAE,CAAA;IACzD,MAAM,sBAAsB,GAC1B,KAAK,CAAC,QAAQ,EAAE,GAAG,SAAS,CAAC,QAAQ,EAAE;QACvC,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,SAAS,CAAC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P,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,GAAG,EAAE,CAAC;SACP;QACD,WAAW,EAAE;YACX,KAAK,EAAE,MAAM,CAAC,eAAe;SAC9B;QACD,IAAI,EAAE;YACJ,eAAe,EAAE,MAAM,CAAC,eAAe;YACvC,YAAY,EAAE,CAAC;YACf,OAAO,EAAE,EAAE;YACX,GAAG,EAAE,CAAC;SACP;QACD,KAAK,EAAE;YACL,GAAG,EAAE,CAAC;SACP;QACD,cAAc,EAAE;YACd,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,GAAG,EAAE,CAAC;SACP;QACD,UAAU,EAAE;YACV,IAAI,EAAE,CAAC;SACR;QACD,aAAa,EAAE;YACb,SAAS,EAAE,QAAQ;YACnB,SAAS,EAAE,CAAC;SACb;QACD,IAAI,EAAE;YACJ,UAAU,EAAE,sBAAsB;SACnC;QACD,cAAc,EAAE;YACd,UAAU,EAAE,sBAAsB;SACnC;QACD,aAAa,EAAE;YACb,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,GAAG,EAAE,CAAC;SACP;QACD,UAAU,EAAE;YACV,SAAS,EAAE,UAAU;SACtB;QACD,gBAAgB,EAAE;YAChB,IAAI,EAAE,CAAC;SACR;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import React, { useState } from 'react'\nimport { date as formatDate } from '@planningcenter/datetime-fmt'\nimport { StyleSheet, View } from 'react-native'\nimport { Button } from '../../components/display/button'\nimport { Text } from '../../components/display/text'\nimport { Icon } from '../../components/display/icon'\nimport { Avatar } from '../../components/display/avatar'\nimport { Banner } from '../../components/display/banner'\nimport { useCurrentPerson, useTheme, useSubmitAgeCheck } from '../../hooks'\nimport { Heading } from '../../components'\nimport { platformFontWeightBold } from '../../utils/styles'\nimport { AgeCheckSelectBirthdateModal } from './components/age_check_select_birthdate_modal'\n\nfunction calculateAge(birthdate: Date) {\n const today = new Date()\n const age = today.getFullYear() - birthdate.getFullYear()\n const hasHadBirthdayThisYear =\n today.getMonth() > birthdate.getMonth() ||\n (today.getMonth() === birthdate.getMonth() && today.getDate() >= birthdate.getDate())\n return hasHadBirthdayThisYear ? age : age - 1\n}\n\nexport function AgeCheckRequiredScreen() {\n const person = useCurrentPerson()\n\n const [birthdate, setBirthdate] = useState<Date | null>(null)\n const [draftBirthdate, setDraftBirthdate] = useState<Date | null>(null)\n const [isBirthdateModalOpen, setBirthdateModalOpen] = useState(false)\n const { submitAgeCheck, isPending, isSuccess } = useSubmitAgeCheck()\n const styles = useStyles()\n\n const birthdateStamp = birthdate\n ? formatDate(birthdate, { style: 'standard', year: true, timeZone: 'UTC' })\n : 'Missing'\n\n const age = birthdate ? calculateAge(birthdate) : null\n\n const confirmationText =\n birthdate !== null\n ? `Your birthdate is ${birthdateStamp} and you are ${age} years old. Is that correct?`\n : ''\n\n const openBirthdateModal = () => {\n setDraftBirthdate(birthdate || new Date())\n setBirthdateModalOpen(true)\n }\n\n const closeBirthdateModal = () => {\n setBirthdateModalOpen(false)\n }\n\n const handleSubmitAgeConfirmation = () => {\n if (!birthdate) return\n submitAgeCheck(birthdate)\n }\n\n return (\n <View style={styles.container}>\n <View style={styles.header}>\n <View style={styles.heading}>\n <Icon name=\"general.exclamationTriangle\" size={20} style={styles.warningIcon} />\n <Heading variant=\"h2\">Your age is required to use chat</Heading>\n </View>\n <Text>To help protect those who may be underage, we need to verify your birthdate.</Text>\n </View>\n <View style={styles.cards}>\n <View style={styles.card}>\n <Heading variant=\"h3\">My profile</Heading>\n <View style={styles.profileContent}>\n <Avatar sourceUri={person.avatar || ''} size=\"lg\" showFallback={!person.avatar} />\n <View style={styles.personInfo}>\n <Text style={styles.name} numberOfLines={1}>\n {person.name}\n </Text>\n <View style={styles.birthdateInfo}>\n <Text variant=\"tertiary\" style={styles.birthdateLabel}>\n Birthdate:\n </Text>\n <Text variant=\"tertiary\">{birthdateStamp}</Text>\n </View>\n </View>\n {birthdate && (\n <Button\n title=\"Edit\"\n accessibilityHint=\"Choose a new birthdate for your profile\"\n size=\"sm\"\n variant=\"outline\"\n style={styles.editButton}\n onPress={openBirthdateModal}\n />\n )}\n </View>\n {!birthdate && (\n <Button\n title=\"Add birthdate\"\n accessibilityHint=\"Choose a birthdate for your profile\"\n size=\"lg\"\n style={styles.primaryButton}\n onPress={openBirthdateModal}\n />\n )}\n </View>\n {birthdate && (\n <View style={styles.card}>\n <Heading variant=\"h3\">Age confirmation</Heading>\n {age !== null && age < 13 ? (\n <Banner appearance=\"warning\" description={confirmationText} />\n ) : (\n <Text>{confirmationText}</Text>\n )}\n <Button\n title=\"Yes, update my profile\"\n size=\"lg\"\n style={styles.primaryButton}\n onPress={handleSubmitAgeConfirmation}\n disabled={isPending || isSuccess}\n />\n </View>\n )}\n </View>\n <Text variant=\"tertiary\">\n Your birthdate will be added to your profile, but it is only visible to church\n administrators. It will not be shared with other church members, unless you give permission.\n </Text>\n\n <AgeCheckSelectBirthdateModal\n onChange={setDraftBirthdate}\n onDismiss={closeBirthdateModal}\n onRequestClose={closeBirthdateModal}\n onSubmit={setBirthdate}\n value={draftBirthdate || new Date()}\n visible={isBirthdateModalOpen}\n />\n </View>\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n return StyleSheet.create({\n container: {\n flex: 1,\n backgroundColor: colors.surfaceColor080,\n padding: 16,\n gap: 16,\n },\n header: {\n gap: 8,\n },\n heading: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 8,\n },\n warningIcon: {\n color: colors.statusErrorIcon,\n },\n card: {\n backgroundColor: colors.surfaceColor100,\n borderRadius: 8,\n padding: 16,\n gap: 8,\n },\n cards: {\n gap: 8,\n },\n profileContent: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 8,\n },\n personInfo: {\n flex: 1,\n },\n primaryButton: {\n alignSelf: 'center',\n marginTop: 8,\n },\n name: {\n fontWeight: platformFontWeightBold,\n },\n birthdateLabel: {\n fontWeight: platformFontWeightBold,\n },\n birthdateInfo: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 4,\n },\n editButton: {\n alignSelf: 'flex-end',\n },\n formSheetContent: {\n flex: 1,\n },\n })\n}\n"]}
@@ -38,7 +38,7 @@ function IOSBirthdateModal({ onChange, onDismiss, onRequestClose, onSubmit, valu
38
38
  Birthdate
39
39
  </Text>
40
40
  <View style={styles.pickerContainer}>
41
- <DateTimePicker accessibilityLabelledBy="birthdateLabel" testID="age-check-date-picker" mode="date" display="spinner" value={selected} maximumDate={today} onChange={handleChange}/>
41
+ <DateTimePicker timeZoneName="UTC" accessibilityLabelledBy="birthdateLabel" testID="age-check-date-picker" mode="date" display="spinner" value={selected} maximumDate={today} onChange={handleChange}/>
42
42
  </View>
43
43
  </View>
44
44
  </View>
@@ -56,7 +56,7 @@ function AndroidBirthdatePicker({ onRequestClose, onSubmit, value, visible, }) {
56
56
  }
57
57
  onRequestClose();
58
58
  };
59
- return (<DateTimePicker testID="age-check-date-picker-android" mode="date" display="spinner" value={selected} maximumDate={today} onChange={handleAndroidDateChange}/>);
59
+ return (<DateTimePicker timeZoneName="UTC" testID="age-check-date-picker-android" mode="date" display="spinner" value={selected} maximumDate={today} onChange={handleAndroidDateChange}/>);
60
60
  }
61
61
  const useStyles = () => {
62
62
  const { colors } = useTheme();