@planningcenter/chat-react-native 3.26.1-qa-564.0 → 3.26.1-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/hooks/use_live_relative_time.js +2 -2
- package/build/hooks/use_live_relative_time.js.map +1 -1
- package/build/navigation/index.d.ts +1 -1
- package/build/screens/conversation_screen.js +5 -5
- package/build/screens/conversation_screen.js.map +1 -1
- package/build/screens/message_report/components/message_preview.d.ts.map +1 -1
- package/build/screens/message_report/components/message_preview.js +12 -8
- package/build/screens/message_report/components/message_preview.js.map +1 -1
- package/build/screens/message_report_screen.d.ts +1 -1
- package/build/screens/message_report_screen.d.ts.map +1 -1
- package/build/screens/message_report_screen.js +11 -6
- package/build/screens/message_report_screen.js.map +1 -1
- package/build/utils/date.js +8 -8
- package/build/utils/date.js.map +1 -1
- package/build/utils/dayjs.d.ts +3 -0
- package/build/utils/dayjs.d.ts.map +1 -0
- package/build/utils/dayjs.js +7 -0
- package/build/utils/dayjs.js.map +1 -0
- package/package.json +4 -5
- package/src/hooks/use_live_relative_time.ts +2 -2
- package/src/screens/conversation_screen.tsx +5 -5
- package/src/screens/message_report/components/message_preview.tsx +16 -8
- package/src/screens/message_report_screen.tsx +16 -6
- package/src/types/datetime-fmt.d.ts +1 -1
- package/src/utils/date.ts +8 -8
- package/src/utils/dayjs.ts +8 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useEffect, useState } from 'react';
|
|
2
|
-
import
|
|
2
|
+
import dayjs from '../utils/dayjs';
|
|
3
3
|
import { relativeTime } from '../utils/date';
|
|
4
4
|
const MINUTE = 60;
|
|
5
5
|
const HOUR = MINUTE * 60;
|
|
@@ -8,7 +8,7 @@ export function useLiveRelativeTime(date) {
|
|
|
8
8
|
const [timeNow, setTimeNow] = useState(Date.now());
|
|
9
9
|
useEffect(() => {
|
|
10
10
|
const tick = () => {
|
|
11
|
-
const then =
|
|
11
|
+
const then = dayjs(date).valueOf();
|
|
12
12
|
const seconds = Math.round(Math.abs(timeNow - then) / 1000);
|
|
13
13
|
const periodInMinutes = seconds < HOUR ? 1 : seconds < DAY ? 60 : 0;
|
|
14
14
|
if (periodInMinutes) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use_live_relative_time.js","sourceRoot":"","sources":["../../src/hooks/use_live_relative_time.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC3C,OAAO,
|
|
1
|
+
{"version":3,"file":"use_live_relative_time.js","sourceRoot":"","sources":["../../src/hooks/use_live_relative_time.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC3C,OAAO,KAAK,MAAM,gBAAgB,CAAA;AAClC,OAAO,EAAE,YAAY,EAAkB,MAAM,eAAe,CAAA;AAE5D,MAAM,MAAM,GAAG,EAAE,CAAA;AACjB,MAAM,IAAI,GAAG,MAAM,GAAG,EAAE,CAAA;AACxB,MAAM,GAAG,GAAG,IAAI,GAAG,EAAE,CAAA;AAErB,MAAM,UAAU,mBAAmB,CAAC,IAAe;IACjD,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAA;IAElD,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,IAAI,GAAG,GAAG,EAAE;YAChB,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,CAAA;YAClC,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,CAAA;YAE3D,MAAM,eAAe,GAAG,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;YAEnE,IAAI,eAAe,EAAE,CAAC;gBACpB,OAAO,UAAU,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,EAAE,eAAe,GAAG,KAAK,CAAC,CAAA;YAC1E,CAAC;YAED,OAAO,CAAC,CAAA;QACV,CAAC,CAAA;QACD,MAAM,SAAS,GAAG,IAAI,EAAE,CAAA;QACxB,OAAO,GAAG,EAAE;YACV,IAAI,SAAS,EAAE,CAAC;gBACd,YAAY,CAAC,SAAS,CAAC,CAAA;YACzB,CAAC;QACH,CAAC,CAAA;IACH,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAA;IAEnB,SAAS,CAAC,GAAG,EAAE;QACb,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAA;IACxB,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAA;IAEV,OAAO,YAAY,CAAC,IAAI,CAAC,CAAA;AAC3B,CAAC","sourcesContent":["import { useEffect, useState } from 'react'\nimport dayjs from '../utils/dayjs'\nimport { relativeTime, type DateProps } from '../utils/date'\n\nconst MINUTE = 60\nconst HOUR = MINUTE * 60\nconst DAY = HOUR * 24\n\nexport function useLiveRelativeTime(date: DateProps) {\n const [timeNow, setTimeNow] = useState(Date.now())\n\n useEffect(() => {\n const tick = () => {\n const then = dayjs(date).valueOf()\n const seconds = Math.round(Math.abs(timeNow - then) / 1000)\n\n const periodInMinutes = seconds < HOUR ? 1 : seconds < DAY ? 60 : 0\n\n if (periodInMinutes) {\n return setTimeout(() => setTimeNow(Date.now()), periodInMinutes * 60000)\n }\n\n return 0\n }\n const timeoutId = tick()\n return () => {\n if (timeoutId) {\n clearTimeout(timeoutId)\n }\n }\n }, [date, timeNow])\n\n useEffect(() => {\n setTimeNow(Date.now())\n }, [date])\n\n return relativeTime(date)\n}\n"]}
|
|
@@ -337,7 +337,7 @@ export declare const ChatStack: import("@react-navigation/native").TypedNavigato
|
|
|
337
337
|
};
|
|
338
338
|
readonly MessageReport: {
|
|
339
339
|
readonly screen: typeof MessageReportScreen;
|
|
340
|
-
readonly options: ({ navigation, }: import("@react-navigation/native-stack").NativeStackScreenProps<any>) => import("@react-navigation/native-stack").NativeStackNavigationOptions;
|
|
340
|
+
readonly options: ({ navigation, route, }: import("@react-navigation/native-stack").NativeStackScreenProps<any>) => import("@react-navigation/native-stack").NativeStackNavigationOptions;
|
|
341
341
|
};
|
|
342
342
|
readonly AttachmentActions: {
|
|
343
343
|
readonly screen: typeof AttachmentActionsScreen;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { date as formatDate } from '@planningcenter/datetime-fmt';
|
|
2
2
|
import { HeaderTitle, PlatformPressable } from '@react-navigation/elements';
|
|
3
3
|
import { CommonActions, useNavigation, useTheme as useNavigationTheme, useRoute, } from '@react-navigation/native';
|
|
4
|
-
import
|
|
4
|
+
import dayjs from '../utils/dayjs';
|
|
5
5
|
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
6
6
|
import { FlatList, Platform, StyleSheet, View } from 'react-native';
|
|
7
7
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
@@ -173,7 +173,7 @@ export const groupMessages = ({ ms, inReplyScreen, repliesEnabled = false, }) =>
|
|
|
173
173
|
ms.forEach((message, i) => {
|
|
174
174
|
const prevMessage = ms[i + 1];
|
|
175
175
|
const nextMessage = ms[i - 1];
|
|
176
|
-
const date =
|
|
176
|
+
const date = dayjs(message.createdAt).format('YYYY-MM-DD');
|
|
177
177
|
const inThread = message.replyRootId !== null;
|
|
178
178
|
const nextMessageInThread = nextMessage?.replyRootId !== null;
|
|
179
179
|
const threadRoot = message.replyRootId === message.id;
|
|
@@ -186,8 +186,8 @@ export const groupMessages = ({ ms, inReplyScreen, repliesEnabled = false, }) =>
|
|
|
186
186
|
new Date(message.createdAt).getTime() - new Date(prevMessage.createdAt).getTime() > 60000 * 5;
|
|
187
187
|
const nextMessageMoreThan5Minutes = nextMessage &&
|
|
188
188
|
new Date(nextMessage.createdAt).getTime() - new Date(message.createdAt).getTime() > 60000 * 5;
|
|
189
|
-
const prevMessageIsDateSeparator = prevMessage && date !==
|
|
190
|
-
const nextMessageIsDateSeparator = nextMessage && date !==
|
|
189
|
+
const prevMessageIsDateSeparator = prevMessage && date !== dayjs(prevMessage.createdAt).format('YYYY-MM-DD');
|
|
190
|
+
const nextMessageIsDateSeparator = nextMessage && date !== dayjs(nextMessage.createdAt).format('YYYY-MM-DD');
|
|
191
191
|
const insertReplyShadowMessage = message.replyRootId &&
|
|
192
192
|
!threadRoot &&
|
|
193
193
|
(prevMessageDifferentThread || prevMessageIsDateSeparator);
|
|
@@ -243,7 +243,7 @@ export const groupMessages = ({ ms, inReplyScreen, repliesEnabled = false, }) =>
|
|
|
243
243
|
nextRendersAuthor: message?.renderAuthor,
|
|
244
244
|
});
|
|
245
245
|
}
|
|
246
|
-
if (!prevMessage || date !==
|
|
246
|
+
if (!prevMessage || date !== dayjs(prevMessage.createdAt).format('YYYY-MM-DD')) {
|
|
247
247
|
enrichedMessages.push({ type: 'DateSeparator', id: `day-divider-${message.id}`, date });
|
|
248
248
|
}
|
|
249
249
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation_screen.js","sourceRoot":"","sources":["../../src/screens/conversation_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,8BAA8B,CAAA;AACjE,OAAO,EAAE,WAAW,EAAoB,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC7F,OAAO,EACL,aAAa,EAGb,aAAa,EACb,QAAQ,IAAI,kBAAkB,EAC9B,QAAQ,GACT,MAAM,0BAA0B,CAAA;AACjC,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACvE,OAAO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ACR,MAAM,EAAE;oBACN,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,EAAE,EAAE,mBAAmB,EAAE,MAAM,EAAE,mBAAmB,EAAE,EAAE;oBACvF,GAAG,MAAM;iBACV;gBACD,KAAK,EAAE,KAAK,CAAC,KAAK,GAAG,CAAC;aACvB,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,mBAAmB,CAAC,CAAC,CAAA;AAC/C,CAAC,CAAA","sourcesContent":["import { date as formatDate } from '@planningcenter/datetime-fmt'\nimport { HeaderTitle, HeaderTitleProps, PlatformPressable } from '@react-navigation/elements'\nimport {\n CommonActions,\n RouteProp,\n StaticScreenProps,\n useNavigation,\n useTheme as useNavigationTheme,\n useRoute,\n} from '@react-navigation/native'\nimport moment from 'moment'\nimport React, { useCallback, useEffect, useRef, useState } from 'react'\nimport { FlatList, Platform, StyleSheet, View } from 'react-native'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\nimport { Badge, Icon, Text } from '../components'\nimport {\n LeaderMessagesDisabledBanner,\n MemberMessagesDisabledBanner,\n} from '../components/conversation/messages_disabled_banners'\nimport { EmptyConversationBlankState } from '../components/conversation/empty_conversation_blank_state'\nimport BlankState from '../components/primitive/blank_state_primitive'\nimport { Message } from '../components/conversation/message'\nimport { MessageForm } from '../components/conversation/message_form'\nimport { TypingIndicator } from '../components/conversation/typing_indicator'\nimport { KeyboardView } from '../components/display/keyboard_view'\nimport { useTheme } from '../hooks'\nimport {\n normalizeAnalyticsMetadata,\n usePublishProductAnalyticsEvent,\n} from '../hooks/use_product_analytics'\nimport { useConversation } from '../hooks/use_conversation'\nimport { useConversationMessages } from '../hooks/use_conversation_messages'\nimport { useConversationMessagesJoltEvents } from '../hooks/use_conversation_messages_jolt_events'\nimport { MessageResource } from '../types'\nimport { ConversationBadgeResource } from '../types/resources/conversation_badge'\nimport { getRelativeDateStatus } from '../utils/date'\nimport { useMarkLatestMessageRead } from '../hooks/use_mark_latest_message_read'\nimport { CONVERSATION_MESSAGE_LIST_PADDING_HORIZONTAL } from '../utils/styles'\nimport { useConversationJoltEvents } from '../hooks/use_conversation_jolt_events'\nimport { JumpToBottomButton } from '../components/conversation/jump_to_bottom_button'\nimport { ReplyShadowMessage } from '../components/conversation/reply_shadow_message'\nimport { availableFeatures, useFeatures } from '../hooks/use_features'\nimport { ConversationContextProvider } from '../contexts/conversation_context'\n\nexport type ConversationRouteProps = {\n conversation_id: number\n reply_root_id?: string | null\n reply_root_author_name?: string\n chat_group_graph_id?: string\n clear_input?: boolean\n editing_message_id?: number | null\n title?: string\n subtitle?: string\n badge?: ConversationBadgeResource\n deleted?: boolean\n muted?: boolean\n}\n\nexport type ConversationScreenProps = StaticScreenProps<ConversationRouteProps>\n\nexport function ConversationScreen({ route }: ConversationScreenProps) {\n const { conversation_id, reply_root_id } = route.params\n\n const { data: conversation } = useConversation({ conversation_id })\n\n usePublishProductAnalyticsEvent('chat.mobile.conversations.show.opened', {\n reply_root_id,\n ...normalizeAnalyticsMetadata(conversation),\n })\n\n return (\n <ConversationContextProvider\n conversationId={conversation_id}\n currentPageReplyRootId={reply_root_id ?? null}\n >\n <ConversationScreenContent route={route} />\n </ConversationContextProvider>\n )\n}\n\nfunction ConversationScreenContent({ route }: ConversationScreenProps) {\n const styles = useStyles()\n const navigation = useNavigation()\n const { conversation_id, editing_message_id, reply_root_id, reply_root_author_name } =\n route.params\n const { data: conversation } = useConversation(route.params)\n const { messages, refetch, isRefetching, fetchNextPage } = useConversationMessages({\n conversation_id,\n reply_root_id,\n })\n useConversationJoltEvents({ conversationId: conversation_id })\n useConversationMessagesJoltEvents({ conversationId: conversation_id })\n useEnsureConversationsRouteExists()\n useMarkLatestMessageRead({ conversation, messages })\n const { featureEnabled } = useFeatures()\n const repliesEnabled = featureEnabled(availableFeatures.threaded_replies)\n const messagesWithSeparators = groupMessages({\n ms: messages,\n inReplyScreen: !!reply_root_id,\n repliesEnabled,\n })\n const noMessages = messagesWithSeparators.length === 0\n\n const { repliesDisabled, memberAbility, badges, title } = conversation\n const canReply = memberAbility?.canReply\n const showLeaderDisabledReplyBanner = canReply && repliesDisabled\n const canDeleteNonAuthoredMessages = memberAbility?.canDeleteNonAuthoredMessages ?? false\n const currentlyEditingMessage = messages.find(m => String(m.id) === String(editing_message_id))\n const replyRootAuthorFirstName = reply_root_author_name?.split(' ')[0]\n const replyHeaderTitle = replyRootAuthorFirstName\n ? `Reply to ${replyRootAuthorFirstName}`\n : 'Reply'\n // Prefer the membership for optimistic updates.\n const muted = conversation.conversationMembership?.muted ?? conversation.muted\n\n const listRef = useRef<FlatList>(null)\n const [showJumpToBottomButton, setShowJumpToBottomButton] = useState(false)\n\n const trackScroll = (event: any) => {\n const offsetY = event.nativeEvent.contentOffset.y\n setShowJumpToBottomButton(offsetY > 200)\n }\n\n const handleReturnToBottom = useCallback(() => {\n listRef.current?.scrollToOffset({\n offset: 0,\n })\n }, [])\n\n useEffect(() => {\n if (reply_root_id) {\n navigation.setParams({\n title: replyHeaderTitle,\n })\n } else {\n navigation.setParams({\n title: title,\n badge: badges?.[0],\n deleted: conversation?.deleted,\n muted,\n })\n }\n }, [navigation, title, badges, conversation?.deleted, reply_root_id, replyHeaderTitle, muted])\n\n if (!conversation || conversation.deleted) {\n return (\n <View style={styles.container}>\n <BlankState.Root>\n <BlankState.Imagery name=\"general.outlinedTextMessage\" />\n <BlankState.Content>\n <BlankState.Heading>This conversation has been deleted</BlankState.Heading>\n </BlankState.Content>\n <BlankState.Button\n onPress={navigation.goBack}\n title=\"Back to conversations\"\n accessibilityHint=\"Navigates back to the conversations list\"\n accessibilityRole=\"link\"\n />\n </BlankState.Root>\n </View>\n )\n }\n\n return (\n <View style={styles.container}>\n <KeyboardView>\n {noMessages ? (\n <EmptyConversationBlankState />\n ) : (\n <FlatList\n inverted\n ref={listRef}\n contentContainerStyle={styles.listContainer}\n refreshing={isRefetching}\n onRefresh={refetch}\n data={messagesWithSeparators}\n keyExtractor={item => item.id}\n onScroll={trackScroll}\n scrollEventThrottle={10}\n renderItem={({ item }) => {\n if (item.type === 'DateSeparator') {\n return <InlineDateSeparator {...item} />\n }\n\n if (item.type === 'ReplyShadowMessage') {\n return (\n <ReplyShadowMessage\n {...item}\n conversation_id={conversation_id}\n inReplyScreen={!!reply_root_id}\n />\n )\n }\n\n return (\n <Message\n {...item}\n canDeleteNonAuthoredMessages={canDeleteNonAuthoredMessages}\n conversation_id={conversation_id}\n latestReadMessageSortKey={conversation?.latestReadMessageSortKey}\n inReplyScreen={!!reply_root_id}\n repliesEnabled={repliesEnabled}\n />\n )\n }}\n onEndReached={() => fetchNextPage()}\n ListHeaderComponent={<View style={styles.listHeader} />}\n />\n )}\n <JumpToBottomButton onPress={handleReturnToBottom} visible={showJumpToBottomButton} />\n {!noMessages && <TypingIndicator />}\n {showLeaderDisabledReplyBanner && <LeaderMessagesDisabledBanner />}\n {canReply ? (\n <MessageForm.Root\n replyRootAuthorFirstName={replyRootAuthorFirstName}\n conversation={conversation}\n replyRootId={reply_root_id}\n currentlyEditingMessage={currentlyEditingMessage}\n // We use a separate key so that it remounts component when switching between new\n // and edit message. This simplifies internal state handling.\n key={\n currentlyEditingMessage\n ? `edit-message-form-${currentlyEditingMessage.id}`\n : 'new-message-form'\n }\n >\n <MessageForm.AttachmentPicker />\n <MessageForm.Commands />\n <MessageForm.TextInput />\n <MessageForm.SubmitButton />\n </MessageForm.Root>\n ) : (\n <MemberMessagesDisabledBanner />\n )}\n </KeyboardView>\n </View>\n )\n}\n\nexport type DateSeparator = { type: 'DateSeparator'; id: string; date: string }\n\nfunction InlineDateSeparator({ date }: DateSeparator) {\n const styles = useDateSeparatorStyles()\n const { isThisYear } = getRelativeDateStatus(date)\n const showYear = !isThisYear\n const dateStamp = formatDate(date, { style: 'long', year: showYear })\n\n return (\n <View style={styles.container}>\n <View style={styles.separator} />\n <Text variant=\"footnote\" style={styles.dateText}>\n {dateStamp}\n </Text>\n <View style={styles.separator} />\n </View>\n )\n}\n\nconst useDateSeparatorStyles = () => {\n const theme = useTheme()\n return StyleSheet.create({\n container: {\n alignItems: 'center',\n flexDirection: 'row',\n paddingHorizontal: CONVERSATION_MESSAGE_LIST_PADDING_HORIZONTAL,\n paddingVertical: 16,\n },\n separator: {\n flex: 1,\n height: 1,\n borderTopWidth: 1,\n borderTopColor: theme.colors.borderColorDefaultBase,\n },\n dateText: {\n paddingHorizontal: 8,\n },\n })\n}\n\ntype ReplyShadowMessage = {\n type: 'ReplyShadowMessage'\n id: string\n messageId: string\n isReplyShadowMessage: boolean\n nextRendersAuthor: boolean\n}\n\ninterface GroupMessagesProps {\n ms: MessageResource[]\n inReplyScreen?: boolean\n repliesEnabled?: boolean\n}\n\nexport const groupMessages = ({\n ms,\n inReplyScreen,\n repliesEnabled = false,\n}: GroupMessagesProps) => {\n let enrichedMessages: (MessageResource | DateSeparator | ReplyShadowMessage)[] = []\n let encounteredOneOfMyMessages = false\n\n ms.forEach((message, i) => {\n const prevMessage = ms[i + 1]\n const nextMessage = ms[i - 1]\n const date = moment(message.createdAt).format('YYYY-MM-DD')\n const inThread = message.replyRootId !== null\n const nextMessageInThread = nextMessage?.replyRootId !== null\n const threadRoot = message.replyRootId === message.id\n const nextMessageThreadRoot = nextMessage?.replyRootId === nextMessage?.id\n const prevMessageDifferentThread = message.replyRootId !== prevMessage?.replyRootId\n const nextMessageDifferentThread = message.replyRootId !== nextMessage?.replyRootId\n const prevMessageDifferentAuthor = message.author?.id !== prevMessage?.author?.id\n const nextMessageDifferentAuthor = message.author?.id !== nextMessage?.author?.id\n const prevMessageMoreThan5Minutes =\n prevMessage &&\n new Date(message.createdAt).getTime() - new Date(prevMessage.createdAt).getTime() > 60000 * 5\n const nextMessageMoreThan5Minutes =\n nextMessage &&\n new Date(nextMessage.createdAt).getTime() - new Date(message.createdAt).getTime() > 60000 * 5\n const prevMessageIsDateSeparator =\n prevMessage && date !== moment(prevMessage.createdAt).format('YYYY-MM-DD')\n const nextMessageIsDateSeparator =\n nextMessage && date !== moment(nextMessage.createdAt).format('YYYY-MM-DD')\n const insertReplyShadowMessage =\n message.replyRootId &&\n !threadRoot &&\n (prevMessageDifferentThread || prevMessageIsDateSeparator)\n const lastInGroup =\n !nextMessage ||\n nextMessageDifferentAuthor ||\n nextMessageMoreThan5Minutes ||\n nextMessageDifferentThread ||\n nextMessageIsDateSeparator\n const renderAuthor =\n !message.mine &&\n (!prevMessage ||\n prevMessageDifferentAuthor ||\n prevMessageMoreThan5Minutes ||\n prevMessageDifferentThread ||\n prevMessageIsDateSeparator)\n const nextIsReplyShadowMessage =\n repliesEnabled &&\n nextMessageInThread &&\n !nextMessageThreadRoot &&\n (nextMessageDifferentThread || nextMessageIsDateSeparator)\n\n if (message.mine && !encounteredOneOfMyMessages) {\n encounteredOneOfMyMessages = true\n message.myLatestInConversation = true\n } else {\n message.myLatestInConversation = false\n }\n message.lastInGroup = lastInGroup\n message.renderAuthor = renderAuthor\n message.threadPosition = null\n message.nextRendersAuthor = nextMessage?.renderAuthor\n message.isReplyShadowMessage = false\n message.nextIsReplyShadowMessage = nextIsReplyShadowMessage\n\n if (!inReplyScreen && inThread) {\n message.prevIsMyReply = prevMessage?.mine\n message.nextIsMyReply = nextMessage?.mine\n\n const firstInThread = threadRoot\n const lastInThread = nextMessageDifferentThread || nextMessageIsDateSeparator\n\n if (firstInThread && lastInThread)\n message.threadPosition = null // ensures we don't render a connector for root replies that aren't immediately followed up a reply\n else if (firstInThread) message.threadPosition = 'first'\n else if (lastInThread) message.threadPosition = 'last'\n else message.threadPosition = 'center'\n }\n\n enrichedMessages.push(message)\n\n if (insertReplyShadowMessage && repliesEnabled) {\n enrichedMessages.push({\n type: 'ReplyShadowMessage',\n id: `${message.id}-${message.replyRootId}`,\n messageId: message.replyRootId!,\n isReplyShadowMessage: true,\n nextRendersAuthor: message?.renderAuthor,\n })\n }\n\n if (!prevMessage || date !== moment(prevMessage.createdAt).format('YYYY-MM-DD')) {\n enrichedMessages.push({ type: 'DateSeparator', id: `day-divider-${message.id}`, date })\n }\n })\n\n return enrichedMessages\n}\ninterface ConversationScreenTitleProps extends HeaderTitleProps {\n conversation_id: number\n badge?: ConversationBadgeResource\n deleted?: boolean\n muted?: boolean\n}\n\nexport const ConversationScreenTitle = ({\n conversation_id,\n badge,\n children,\n style,\n deleted,\n muted,\n}: ConversationScreenTitleProps) => {\n const styles = usePressableHeaderStyle()\n const navigation = useNavigation()\n const resourceType = badge?.pcoResourceType || ''\n const productName = badge?.appName\n const name = badge?.text || undefined\n\n return (\n <PlatformPressable\n accessibilityHint=\"Opens details about members and settings\"\n style={styles.container}\n onPress={() => {\n if (deleted) return\n\n navigation.navigate('ConversationDetails', { conversation_id })\n }}\n >\n <View style={styles.titleWrapper}>\n <View style={styles.titleTextContainer}>\n <HeaderTitle maxFontSizeMultiplier={1} style={style}>\n {children}\n </HeaderTitle>\n </View>\n {muted && <Icon name=\"general.bellMuted\" size={12} />}\n {!deleted && <Icon name=\"general.downChevron\" size={12} />}\n </View>\n <Badge\n variant=\"metaSubtle\"\n productLogoName={productName}\n label={resourceType}\n metaLabel={name}\n style={styles.badge}\n maxFontSizeMultiplier={1}\n />\n </PlatformPressable>\n )\n}\n\nconst usePressableHeaderStyle = () => {\n return StyleSheet.create({\n container: {\n alignItems: Platform.select({ android: 'flex-start', default: 'center' }),\n marginRight: Platform.select({ ios: 20, default: 16 }),\n flex: 1,\n },\n titleWrapper: {\n alignItems: 'center',\n columnGap: 4,\n flexDirection: 'row',\n flexShrink: 1,\n },\n titleTextContainer: {\n flexShrink: 1,\n minWidth: 0,\n },\n badge: {\n alignSelf: Platform.select({ android: 'flex-start', default: 'center' }),\n marginTop: 2,\n },\n })\n}\n\nconst useStyles = () => {\n const navigationTheme = useNavigationTheme()\n const { bottom } = useSafeAreaInsets()\n\n return StyleSheet.create({\n container: {\n flex: 1,\n justifyContent: 'center',\n backgroundColor: navigationTheme.colors.card,\n paddingBottom: bottom,\n },\n listContainer: {\n paddingVertical: 12,\n },\n listHeader: {\n // Just whitespace to provide space where the typing indicator can be\n height: 16,\n },\n })\n}\n\n/**\n * useEnsureConversationsRouteExists\n */\nconst useEnsureConversationsRouteExists = () => {\n const navigation = useNavigation()\n const { params } = useRoute<RouteProp<ConversationScreenProps['route']>>()\n\n useEffect(() => {\n const navigationState = navigation.getState()\n const routes = navigationState?.routes || []\n const conversationsRoute = routes.find(r => r.name === 'Conversations')\n\n if (conversationsRoute) return\n\n navigation.dispatch(state => {\n return CommonActions.reset({\n ...state,\n routes: [\n { name: 'Conversations', params: { chat_group_graph_id: params?.chat_group_graph_id } },\n ...routes,\n ],\n index: state.index + 1,\n })\n })\n }, [navigation, params?.chat_group_graph_id])\n}\n"]}
|
|
1
|
+
{"version":3,"file":"conversation_screen.js","sourceRoot":"","sources":["../../src/screens/conversation_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,8BAA8B,CAAA;AACjE,OAAO,EAAE,WAAW,EAAoB,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC7F,OAAO,EACL,aAAa,EAGb,aAAa,EACb,QAAQ,IAAI,kBAAkB,EAC9B,QAAQ,GACT,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,MAAM,gBAAgB,CAAA;AAClC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACvE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAClE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EACL,4BAA4B,EAC5B,4BAA4B,GAC7B,MAAM,sDAAsD,CAAA;AAC7D,OAAO,EAAE,2BAA2B,EAAE,MAAM,2DAA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,CAAC,CAAA","sourcesContent":["import { date as formatDate } from '@planningcenter/datetime-fmt'\nimport { HeaderTitle, HeaderTitleProps, PlatformPressable } from '@react-navigation/elements'\nimport {\n CommonActions,\n RouteProp,\n StaticScreenProps,\n useNavigation,\n useTheme as useNavigationTheme,\n useRoute,\n} from '@react-navigation/native'\nimport dayjs from '../utils/dayjs'\nimport React, { useCallback, useEffect, useRef, useState } from 'react'\nimport { FlatList, Platform, StyleSheet, View } from 'react-native'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\nimport { Badge, Icon, Text } from '../components'\nimport {\n LeaderMessagesDisabledBanner,\n MemberMessagesDisabledBanner,\n} from '../components/conversation/messages_disabled_banners'\nimport { EmptyConversationBlankState } from '../components/conversation/empty_conversation_blank_state'\nimport BlankState from '../components/primitive/blank_state_primitive'\nimport { Message } from '../components/conversation/message'\nimport { MessageForm } from '../components/conversation/message_form'\nimport { TypingIndicator } from '../components/conversation/typing_indicator'\nimport { KeyboardView } from '../components/display/keyboard_view'\nimport { useTheme } from '../hooks'\nimport {\n normalizeAnalyticsMetadata,\n usePublishProductAnalyticsEvent,\n} from '../hooks/use_product_analytics'\nimport { useConversation } from '../hooks/use_conversation'\nimport { useConversationMessages } from '../hooks/use_conversation_messages'\nimport { useConversationMessagesJoltEvents } from '../hooks/use_conversation_messages_jolt_events'\nimport { MessageResource } from '../types'\nimport { ConversationBadgeResource } from '../types/resources/conversation_badge'\nimport { getRelativeDateStatus } from '../utils/date'\nimport { useMarkLatestMessageRead } from '../hooks/use_mark_latest_message_read'\nimport { CONVERSATION_MESSAGE_LIST_PADDING_HORIZONTAL } from '../utils/styles'\nimport { useConversationJoltEvents } from '../hooks/use_conversation_jolt_events'\nimport { JumpToBottomButton } from '../components/conversation/jump_to_bottom_button'\nimport { ReplyShadowMessage } from '../components/conversation/reply_shadow_message'\nimport { availableFeatures, useFeatures } from '../hooks/use_features'\nimport { ConversationContextProvider } from '../contexts/conversation_context'\n\nexport type ConversationRouteProps = {\n conversation_id: number\n reply_root_id?: string | null\n reply_root_author_name?: string\n chat_group_graph_id?: string\n clear_input?: boolean\n editing_message_id?: number | null\n title?: string\n subtitle?: string\n badge?: ConversationBadgeResource\n deleted?: boolean\n muted?: boolean\n}\n\nexport type ConversationScreenProps = StaticScreenProps<ConversationRouteProps>\n\nexport function ConversationScreen({ route }: ConversationScreenProps) {\n const { conversation_id, reply_root_id } = route.params\n\n const { data: conversation } = useConversation({ conversation_id })\n\n usePublishProductAnalyticsEvent('chat.mobile.conversations.show.opened', {\n reply_root_id,\n ...normalizeAnalyticsMetadata(conversation),\n })\n\n return (\n <ConversationContextProvider\n conversationId={conversation_id}\n currentPageReplyRootId={reply_root_id ?? null}\n >\n <ConversationScreenContent route={route} />\n </ConversationContextProvider>\n )\n}\n\nfunction ConversationScreenContent({ route }: ConversationScreenProps) {\n const styles = useStyles()\n const navigation = useNavigation()\n const { conversation_id, editing_message_id, reply_root_id, reply_root_author_name } =\n route.params\n const { data: conversation } = useConversation(route.params)\n const { messages, refetch, isRefetching, fetchNextPage } = useConversationMessages({\n conversation_id,\n reply_root_id,\n })\n useConversationJoltEvents({ conversationId: conversation_id })\n useConversationMessagesJoltEvents({ conversationId: conversation_id })\n useEnsureConversationsRouteExists()\n useMarkLatestMessageRead({ conversation, messages })\n const { featureEnabled } = useFeatures()\n const repliesEnabled = featureEnabled(availableFeatures.threaded_replies)\n const messagesWithSeparators = groupMessages({\n ms: messages,\n inReplyScreen: !!reply_root_id,\n repliesEnabled,\n })\n const noMessages = messagesWithSeparators.length === 0\n\n const { repliesDisabled, memberAbility, badges, title } = conversation\n const canReply = memberAbility?.canReply\n const showLeaderDisabledReplyBanner = canReply && repliesDisabled\n const canDeleteNonAuthoredMessages = memberAbility?.canDeleteNonAuthoredMessages ?? false\n const currentlyEditingMessage = messages.find(m => String(m.id) === String(editing_message_id))\n const replyRootAuthorFirstName = reply_root_author_name?.split(' ')[0]\n const replyHeaderTitle = replyRootAuthorFirstName\n ? `Reply to ${replyRootAuthorFirstName}`\n : 'Reply'\n // Prefer the membership for optimistic updates.\n const muted = conversation.conversationMembership?.muted ?? conversation.muted\n\n const listRef = useRef<FlatList>(null)\n const [showJumpToBottomButton, setShowJumpToBottomButton] = useState(false)\n\n const trackScroll = (event: any) => {\n const offsetY = event.nativeEvent.contentOffset.y\n setShowJumpToBottomButton(offsetY > 200)\n }\n\n const handleReturnToBottom = useCallback(() => {\n listRef.current?.scrollToOffset({\n offset: 0,\n })\n }, [])\n\n useEffect(() => {\n if (reply_root_id) {\n navigation.setParams({\n title: replyHeaderTitle,\n })\n } else {\n navigation.setParams({\n title: title,\n badge: badges?.[0],\n deleted: conversation?.deleted,\n muted,\n })\n }\n }, [navigation, title, badges, conversation?.deleted, reply_root_id, replyHeaderTitle, muted])\n\n if (!conversation || conversation.deleted) {\n return (\n <View style={styles.container}>\n <BlankState.Root>\n <BlankState.Imagery name=\"general.outlinedTextMessage\" />\n <BlankState.Content>\n <BlankState.Heading>This conversation has been deleted</BlankState.Heading>\n </BlankState.Content>\n <BlankState.Button\n onPress={navigation.goBack}\n title=\"Back to conversations\"\n accessibilityHint=\"Navigates back to the conversations list\"\n accessibilityRole=\"link\"\n />\n </BlankState.Root>\n </View>\n )\n }\n\n return (\n <View style={styles.container}>\n <KeyboardView>\n {noMessages ? (\n <EmptyConversationBlankState />\n ) : (\n <FlatList\n inverted\n ref={listRef}\n contentContainerStyle={styles.listContainer}\n refreshing={isRefetching}\n onRefresh={refetch}\n data={messagesWithSeparators}\n keyExtractor={item => item.id}\n onScroll={trackScroll}\n scrollEventThrottle={10}\n renderItem={({ item }) => {\n if (item.type === 'DateSeparator') {\n return <InlineDateSeparator {...item} />\n }\n\n if (item.type === 'ReplyShadowMessage') {\n return (\n <ReplyShadowMessage\n {...item}\n conversation_id={conversation_id}\n inReplyScreen={!!reply_root_id}\n />\n )\n }\n\n return (\n <Message\n {...item}\n canDeleteNonAuthoredMessages={canDeleteNonAuthoredMessages}\n conversation_id={conversation_id}\n latestReadMessageSortKey={conversation?.latestReadMessageSortKey}\n inReplyScreen={!!reply_root_id}\n repliesEnabled={repliesEnabled}\n />\n )\n }}\n onEndReached={() => fetchNextPage()}\n ListHeaderComponent={<View style={styles.listHeader} />}\n />\n )}\n <JumpToBottomButton onPress={handleReturnToBottom} visible={showJumpToBottomButton} />\n {!noMessages && <TypingIndicator />}\n {showLeaderDisabledReplyBanner && <LeaderMessagesDisabledBanner />}\n {canReply ? (\n <MessageForm.Root\n replyRootAuthorFirstName={replyRootAuthorFirstName}\n conversation={conversation}\n replyRootId={reply_root_id}\n currentlyEditingMessage={currentlyEditingMessage}\n // We use a separate key so that it remounts component when switching between new\n // and edit message. This simplifies internal state handling.\n key={\n currentlyEditingMessage\n ? `edit-message-form-${currentlyEditingMessage.id}`\n : 'new-message-form'\n }\n >\n <MessageForm.AttachmentPicker />\n <MessageForm.Commands />\n <MessageForm.TextInput />\n <MessageForm.SubmitButton />\n </MessageForm.Root>\n ) : (\n <MemberMessagesDisabledBanner />\n )}\n </KeyboardView>\n </View>\n )\n}\n\nexport type DateSeparator = { type: 'DateSeparator'; id: string; date: string }\n\nfunction InlineDateSeparator({ date }: DateSeparator) {\n const styles = useDateSeparatorStyles()\n const { isThisYear } = getRelativeDateStatus(date)\n const showYear = !isThisYear\n const dateStamp = formatDate(date, { style: 'long', year: showYear })\n\n return (\n <View style={styles.container}>\n <View style={styles.separator} />\n <Text variant=\"footnote\" style={styles.dateText}>\n {dateStamp}\n </Text>\n <View style={styles.separator} />\n </View>\n )\n}\n\nconst useDateSeparatorStyles = () => {\n const theme = useTheme()\n return StyleSheet.create({\n container: {\n alignItems: 'center',\n flexDirection: 'row',\n paddingHorizontal: CONVERSATION_MESSAGE_LIST_PADDING_HORIZONTAL,\n paddingVertical: 16,\n },\n separator: {\n flex: 1,\n height: 1,\n borderTopWidth: 1,\n borderTopColor: theme.colors.borderColorDefaultBase,\n },\n dateText: {\n paddingHorizontal: 8,\n },\n })\n}\n\ntype ReplyShadowMessage = {\n type: 'ReplyShadowMessage'\n id: string\n messageId: string\n isReplyShadowMessage: boolean\n nextRendersAuthor: boolean\n}\n\ninterface GroupMessagesProps {\n ms: MessageResource[]\n inReplyScreen?: boolean\n repliesEnabled?: boolean\n}\n\nexport const groupMessages = ({\n ms,\n inReplyScreen,\n repliesEnabled = false,\n}: GroupMessagesProps) => {\n let enrichedMessages: (MessageResource | DateSeparator | ReplyShadowMessage)[] = []\n let encounteredOneOfMyMessages = false\n\n ms.forEach((message, i) => {\n const prevMessage = ms[i + 1]\n const nextMessage = ms[i - 1]\n const date = dayjs(message.createdAt).format('YYYY-MM-DD')\n const inThread = message.replyRootId !== null\n const nextMessageInThread = nextMessage?.replyRootId !== null\n const threadRoot = message.replyRootId === message.id\n const nextMessageThreadRoot = nextMessage?.replyRootId === nextMessage?.id\n const prevMessageDifferentThread = message.replyRootId !== prevMessage?.replyRootId\n const nextMessageDifferentThread = message.replyRootId !== nextMessage?.replyRootId\n const prevMessageDifferentAuthor = message.author?.id !== prevMessage?.author?.id\n const nextMessageDifferentAuthor = message.author?.id !== nextMessage?.author?.id\n const prevMessageMoreThan5Minutes =\n prevMessage &&\n new Date(message.createdAt).getTime() - new Date(prevMessage.createdAt).getTime() > 60000 * 5\n const nextMessageMoreThan5Minutes =\n nextMessage &&\n new Date(nextMessage.createdAt).getTime() - new Date(message.createdAt).getTime() > 60000 * 5\n const prevMessageIsDateSeparator =\n prevMessage && date !== dayjs(prevMessage.createdAt).format('YYYY-MM-DD')\n const nextMessageIsDateSeparator =\n nextMessage && date !== dayjs(nextMessage.createdAt).format('YYYY-MM-DD')\n const insertReplyShadowMessage =\n message.replyRootId &&\n !threadRoot &&\n (prevMessageDifferentThread || prevMessageIsDateSeparator)\n const lastInGroup =\n !nextMessage ||\n nextMessageDifferentAuthor ||\n nextMessageMoreThan5Minutes ||\n nextMessageDifferentThread ||\n nextMessageIsDateSeparator\n const renderAuthor =\n !message.mine &&\n (!prevMessage ||\n prevMessageDifferentAuthor ||\n prevMessageMoreThan5Minutes ||\n prevMessageDifferentThread ||\n prevMessageIsDateSeparator)\n const nextIsReplyShadowMessage =\n repliesEnabled &&\n nextMessageInThread &&\n !nextMessageThreadRoot &&\n (nextMessageDifferentThread || nextMessageIsDateSeparator)\n\n if (message.mine && !encounteredOneOfMyMessages) {\n encounteredOneOfMyMessages = true\n message.myLatestInConversation = true\n } else {\n message.myLatestInConversation = false\n }\n message.lastInGroup = lastInGroup\n message.renderAuthor = renderAuthor\n message.threadPosition = null\n message.nextRendersAuthor = nextMessage?.renderAuthor\n message.isReplyShadowMessage = false\n message.nextIsReplyShadowMessage = nextIsReplyShadowMessage\n\n if (!inReplyScreen && inThread) {\n message.prevIsMyReply = prevMessage?.mine\n message.nextIsMyReply = nextMessage?.mine\n\n const firstInThread = threadRoot\n const lastInThread = nextMessageDifferentThread || nextMessageIsDateSeparator\n\n if (firstInThread && lastInThread)\n message.threadPosition = null // ensures we don't render a connector for root replies that aren't immediately followed up a reply\n else if (firstInThread) message.threadPosition = 'first'\n else if (lastInThread) message.threadPosition = 'last'\n else message.threadPosition = 'center'\n }\n\n enrichedMessages.push(message)\n\n if (insertReplyShadowMessage && repliesEnabled) {\n enrichedMessages.push({\n type: 'ReplyShadowMessage',\n id: `${message.id}-${message.replyRootId}`,\n messageId: message.replyRootId!,\n isReplyShadowMessage: true,\n nextRendersAuthor: message?.renderAuthor,\n })\n }\n\n if (!prevMessage || date !== dayjs(prevMessage.createdAt).format('YYYY-MM-DD')) {\n enrichedMessages.push({ type: 'DateSeparator', id: `day-divider-${message.id}`, date })\n }\n })\n\n return enrichedMessages\n}\ninterface ConversationScreenTitleProps extends HeaderTitleProps {\n conversation_id: number\n badge?: ConversationBadgeResource\n deleted?: boolean\n muted?: boolean\n}\n\nexport const ConversationScreenTitle = ({\n conversation_id,\n badge,\n children,\n style,\n deleted,\n muted,\n}: ConversationScreenTitleProps) => {\n const styles = usePressableHeaderStyle()\n const navigation = useNavigation()\n const resourceType = badge?.pcoResourceType || ''\n const productName = badge?.appName\n const name = badge?.text || undefined\n\n return (\n <PlatformPressable\n accessibilityHint=\"Opens details about members and settings\"\n style={styles.container}\n onPress={() => {\n if (deleted) return\n\n navigation.navigate('ConversationDetails', { conversation_id })\n }}\n >\n <View style={styles.titleWrapper}>\n <View style={styles.titleTextContainer}>\n <HeaderTitle maxFontSizeMultiplier={1} style={style}>\n {children}\n </HeaderTitle>\n </View>\n {muted && <Icon name=\"general.bellMuted\" size={12} />}\n {!deleted && <Icon name=\"general.downChevron\" size={12} />}\n </View>\n <Badge\n variant=\"metaSubtle\"\n productLogoName={productName}\n label={resourceType}\n metaLabel={name}\n style={styles.badge}\n maxFontSizeMultiplier={1}\n />\n </PlatformPressable>\n )\n}\n\nconst usePressableHeaderStyle = () => {\n return StyleSheet.create({\n container: {\n alignItems: Platform.select({ android: 'flex-start', default: 'center' }),\n marginRight: Platform.select({ ios: 20, default: 16 }),\n flex: 1,\n },\n titleWrapper: {\n alignItems: 'center',\n columnGap: 4,\n flexDirection: 'row',\n flexShrink: 1,\n },\n titleTextContainer: {\n flexShrink: 1,\n minWidth: 0,\n },\n badge: {\n alignSelf: Platform.select({ android: 'flex-start', default: 'center' }),\n marginTop: 2,\n },\n })\n}\n\nconst useStyles = () => {\n const navigationTheme = useNavigationTheme()\n const { bottom } = useSafeAreaInsets()\n\n return StyleSheet.create({\n container: {\n flex: 1,\n justifyContent: 'center',\n backgroundColor: navigationTheme.colors.card,\n paddingBottom: bottom,\n },\n listContainer: {\n paddingVertical: 12,\n },\n listHeader: {\n // Just whitespace to provide space where the typing indicator can be\n height: 16,\n },\n })\n}\n\n/**\n * useEnsureConversationsRouteExists\n */\nconst useEnsureConversationsRouteExists = () => {\n const navigation = useNavigation()\n const { params } = useRoute<RouteProp<ConversationScreenProps['route']>>()\n\n useEffect(() => {\n const navigationState = navigation.getState()\n const routes = navigationState?.routes || []\n const conversationsRoute = routes.find(r => r.name === 'Conversations')\n\n if (conversationsRoute) return\n\n navigation.dispatch(state => {\n return CommonActions.reset({\n ...state,\n routes: [\n { name: 'Conversations', params: { chat_group_graph_id: params?.chat_group_graph_id } },\n ...routes,\n ],\n index: state.index + 1,\n })\n })\n }, [navigation, params?.chat_group_graph_id])\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message_preview.d.ts","sourceRoot":"","sources":["../../../../src/screens/message_report/components/message_preview.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAoB,SAAS,EAAE,MAAM,cAAc,CAAA;AAG1D,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAEhD,UAAU,mBAAmB;IAC3B,OAAO,EAAE,eAAe,CAAA;IACxB,KAAK,CAAC,EAAE,SAAS,CAAA;CAClB;AAED,wBAAgB,cAAc,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,mBAAmB,
|
|
1
|
+
{"version":3,"file":"message_preview.d.ts","sourceRoot":"","sources":["../../../../src/screens/message_report/components/message_preview.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAoB,SAAS,EAAE,MAAM,cAAc,CAAA;AAG1D,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAEhD,UAAU,mBAAmB;IAC3B,OAAO,EAAE,eAAe,CAAA;IACxB,KAAK,CAAC,EAAE,SAAS,CAAA;CAClB;AAED,wBAAgB,cAAc,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,mBAAmB,qBAuCrE"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { View, StyleSheet } from 'react-native';
|
|
3
3
|
import { Avatar, Text, Icon } from '../../../components';
|
|
4
|
-
import { useTheme } from '../../../hooks';
|
|
4
|
+
import { useTheme, useFontScale } from '../../../hooks';
|
|
5
5
|
export function MessagePreview({ message, style }) {
|
|
6
6
|
const hasImages = message.attachments.some(att => att.type === 'MessageAttachment' && att.attributes?.contentType?.startsWith('image/'));
|
|
7
7
|
const imageOnly = hasImages && !message.text;
|
|
@@ -9,13 +9,15 @@ export function MessagePreview({ message, style }) {
|
|
|
9
9
|
return (<View style={[styles.previewContainer, style]}>
|
|
10
10
|
<View style={styles.previewHeader}>
|
|
11
11
|
<Avatar sourceUri={message.author.avatar} size="md"/>
|
|
12
|
-
<Text style={styles.authorName}
|
|
12
|
+
<Text style={styles.authorName} maxFontSizeMultiplier={1.5} numberOfLines={1}>
|
|
13
|
+
{message.author.name}
|
|
14
|
+
</Text>
|
|
13
15
|
</View>
|
|
14
16
|
|
|
15
17
|
<View style={styles.messageBubble}>
|
|
16
18
|
{hasImages && (<View style={styles.imagePlaceholder}>
|
|
17
|
-
<Icon name="general.image" style={styles.placeholderIcon}/>
|
|
18
|
-
<Text variant="secondary" style={styles.placeholderText}>
|
|
19
|
+
<Icon name="general.image" style={styles.placeholderIcon} maxFontSizeMultiplier={1.25}/>
|
|
20
|
+
<Text variant="secondary" style={styles.placeholderText} maxFontSizeMultiplier={1.25}>
|
|
19
21
|
Image hidden
|
|
20
22
|
</Text>
|
|
21
23
|
</View>)}
|
|
@@ -28,6 +30,7 @@ export function MessagePreview({ message, style }) {
|
|
|
28
30
|
}
|
|
29
31
|
const useStyles = ({ imageOnly }) => {
|
|
30
32
|
const { colors } = useTheme();
|
|
33
|
+
const fontScale = useFontScale({ maxFontSizeMultiplier: 1.5 });
|
|
31
34
|
return StyleSheet.create({
|
|
32
35
|
previewContainer: {
|
|
33
36
|
gap: 12,
|
|
@@ -41,13 +44,13 @@ const useStyles = ({ imageOnly }) => {
|
|
|
41
44
|
fontSize: 14,
|
|
42
45
|
fontWeight: '600',
|
|
43
46
|
color: colors.textColorDefaultPrimary,
|
|
47
|
+
flexShrink: 1,
|
|
44
48
|
},
|
|
45
49
|
messageBubble: {
|
|
46
50
|
backgroundColor: colors.fillColorNeutral060,
|
|
47
51
|
borderRadius: 16,
|
|
48
|
-
overflow: 'hidden',
|
|
49
52
|
alignSelf: 'flex-start',
|
|
50
|
-
|
|
53
|
+
...(!imageOnly && { maxWidth: '80%' }),
|
|
51
54
|
},
|
|
52
55
|
messageText: {
|
|
53
56
|
fontSize: 14,
|
|
@@ -57,10 +60,11 @@ const useStyles = ({ imageOnly }) => {
|
|
|
57
60
|
paddingVertical: 12,
|
|
58
61
|
},
|
|
59
62
|
imagePlaceholder: {
|
|
60
|
-
|
|
63
|
+
paddingHorizontal: 24 * fontScale,
|
|
64
|
+
paddingVertical: 20 * fontScale,
|
|
61
65
|
justifyContent: 'center',
|
|
62
66
|
alignItems: 'center',
|
|
63
|
-
gap: 8,
|
|
67
|
+
gap: 8 * fontScale,
|
|
64
68
|
},
|
|
65
69
|
placeholderIcon: {
|
|
66
70
|
fontSize: 32,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message_preview.js","sourceRoot":"","sources":["../../../../src/screens/message_report/components/message_preview.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,IAAI,EAAE,UAAU,EAAa,MAAM,cAAc,CAAA;AAC1D,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"message_preview.js","sourceRoot":"","sources":["../../../../src/screens/message_report/components/message_preview.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,IAAI,EAAE,UAAU,EAAa,MAAM,cAAc,CAAA;AAC1D,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AACxD,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAQvD,MAAM,UAAU,cAAc,CAAC,EAAE,OAAO,EAAE,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AAiB,EAAE,EAAE;YACrB,eAAe,EAAE,EAAE;SACpB;QACD,gBAAgB,EAAE;YAChB,iBAAiB,EAAE,EAAE,GAAG,SAAS;YACjC,eAAe,EAAE,EAAE,GAAG,SAAS;YAC/B,cAAc,EAAE,QAAQ;YACxB,UAAU,EAAE,QAAQ;YACpB,GAAG,EAAE,CAAC,GAAG,SAAS;SACnB;QACD,eAAe,EAAE;YACf,QAAQ,EAAE,EAAE;YACZ,KAAK,EAAE,MAAM,CAAC,yBAAyB;SACxC;QACD,eAAe,EAAE;YACf,QAAQ,EAAE,EAAE;SACb;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import React from 'react'\nimport { View, StyleSheet, ViewStyle } from 'react-native'\nimport { Avatar, Text, Icon } from '../../../components'\nimport { useTheme, useFontScale } from '../../../hooks'\nimport { MessageResource } from '../../../types'\n\ninterface MessagePreviewProps {\n message: MessageResource\n style?: ViewStyle\n}\n\nexport function MessagePreview({ message, style }: MessagePreviewProps) {\n const hasImages = message.attachments.some(\n att => att.type === 'MessageAttachment' && att.attributes?.contentType?.startsWith('image/')\n )\n\n const imageOnly = hasImages && !message.text\n const styles = useStyles({ imageOnly })\n\n return (\n <View style={[styles.previewContainer, style]}>\n <View style={styles.previewHeader}>\n <Avatar sourceUri={message.author.avatar} size=\"md\" />\n <Text style={styles.authorName} maxFontSizeMultiplier={1.5} numberOfLines={1}>\n {message.author.name}\n </Text>\n </View>\n\n <View style={styles.messageBubble}>\n {hasImages && (\n <View style={styles.imagePlaceholder}>\n <Icon\n name=\"general.image\"\n style={styles.placeholderIcon}\n maxFontSizeMultiplier={1.25}\n />\n <Text variant=\"secondary\" style={styles.placeholderText} maxFontSizeMultiplier={1.25}>\n Image hidden\n </Text>\n </View>\n )}\n\n {message.text && (\n <Text style={styles.messageText} numberOfLines={5}>\n {message.text}\n </Text>\n )}\n </View>\n </View>\n )\n}\n\nconst useStyles = ({ imageOnly }: { imageOnly: boolean }) => {\n const { colors } = useTheme()\n const fontScale = useFontScale({ maxFontSizeMultiplier: 1.5 })\n\n return StyleSheet.create({\n previewContainer: {\n gap: 12,\n },\n previewHeader: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 12,\n },\n authorName: {\n fontSize: 14,\n fontWeight: '600',\n color: colors.textColorDefaultPrimary,\n flexShrink: 1,\n },\n messageBubble: {\n backgroundColor: colors.fillColorNeutral060,\n borderRadius: 16,\n alignSelf: 'flex-start',\n ...(!imageOnly && { maxWidth: '80%' }),\n },\n messageText: {\n fontSize: 14,\n color: colors.textColorDefaultPrimary,\n lineHeight: 20,\n paddingHorizontal: 16,\n paddingVertical: 12,\n },\n imagePlaceholder: {\n paddingHorizontal: 24 * fontScale,\n paddingVertical: 20 * fontScale,\n justifyContent: 'center',\n alignItems: 'center',\n gap: 8 * fontScale,\n },\n placeholderIcon: {\n fontSize: 32,\n color: colors.iconColorDefaultSecondary,\n },\n placeholderText: {\n fontSize: 14,\n },\n })\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { NativeStackNavigationOptions, NativeStackScreenProps } from '@react-navigation/native-stack';
|
|
3
3
|
import { StaticScreenProps } from '@react-navigation/native';
|
|
4
|
-
export declare const MessageReportScreenOptions: ({ navigation, }: NativeStackScreenProps<any>) => NativeStackNavigationOptions;
|
|
4
|
+
export declare const MessageReportScreenOptions: ({ navigation, route, }: NativeStackScreenProps<any>) => NativeStackNavigationOptions;
|
|
5
5
|
export type MessageReportScreenProps = StaticScreenProps<{
|
|
6
6
|
conversation_id: number;
|
|
7
7
|
message_id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message_report_screen.d.ts","sourceRoot":"","sources":["../../src/screens/message_report_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA0D,MAAM,OAAO,CAAA;AAE9E,OAAO,KAAK,EACV,4BAA4B,EAC5B,sBAAsB,EACvB,MAAM,gCAAgC,CAAA;AACvC,OAAO,EAAE,iBAAiB,EAA+B,MAAM,0BAA0B,CAAA;AAmBzF,eAAO,MAAM,0BAA0B,
|
|
1
|
+
{"version":3,"file":"message_report_screen.d.ts","sourceRoot":"","sources":["../../src/screens/message_report_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA0D,MAAM,OAAO,CAAA;AAE9E,OAAO,KAAK,EACV,4BAA4B,EAC5B,sBAAsB,EACvB,MAAM,gCAAgC,CAAA;AACvC,OAAO,EAAE,iBAAiB,EAA+B,MAAM,0BAA0B,CAAA;AAmBzF,eAAO,MAAM,0BAA0B,2BAGpC,sBAAsB,CAAC,GAAG,CAAC,KAAG,4BAahC,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG,iBAAiB,CAAC;IACvD,eAAe,EAAE,MAAM,CAAA;IACvB,UAAU,EAAE,MAAM,CAAA;CACnB,CAAC,CAAA;AAEF,wBAAgB,mBAAmB,CAAC,EAAE,KAAK,EAAE,EAAE,wBAAwB,4BAStE"}
|
|
@@ -12,11 +12,16 @@ import { MessagePreview } from './message_report/components/message_preview';
|
|
|
12
12
|
import { ReportReasonList } from './message_report/components/report_reason_list';
|
|
13
13
|
import { platformFontWeightBold } from '../utils';
|
|
14
14
|
const MAX_DETAIL_LENGTH = 500;
|
|
15
|
-
export const MessageReportScreenOptions = ({ navigation, }) =>
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
export const MessageReportScreenOptions = ({ navigation, route, }) => {
|
|
16
|
+
const handleClose = () => navigation.dispatch(StackActions.popTo('Conversation', {
|
|
17
|
+
conversation_id: route.params?.conversation_id,
|
|
18
|
+
}));
|
|
19
|
+
return {
|
|
20
|
+
presentation: 'modal',
|
|
21
|
+
title: 'Report message',
|
|
22
|
+
headerLeft: () => <HeaderDismissButton title="Cancel" onPress={handleClose}/>,
|
|
23
|
+
};
|
|
24
|
+
};
|
|
20
25
|
export function MessageReportScreen({ route }) {
|
|
21
26
|
const { conversation_id, message_id } = route.params;
|
|
22
27
|
const { messages } = useConversationMessages({ conversation_id }, { refetchOnMount: false });
|
|
@@ -106,7 +111,7 @@ function MessageReportScreenContent({ message, conversation_id, }) {
|
|
|
106
111
|
}
|
|
107
112
|
return (<KeyboardView>
|
|
108
113
|
<ScrollView contentContainerStyle={styles.container}>
|
|
109
|
-
<Text style={styles.warningText}>
|
|
114
|
+
<Text style={styles.warningText} maxFontSizeMultiplier={1.5}>
|
|
110
115
|
Reporting this message will notify a church leader. The person you are reporting will not
|
|
111
116
|
receive a notification from Church Center. If someone is in immediate danger, call local
|
|
112
117
|
emergency services. Don't wait.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message_report_screen.js","sourceRoot":"","sources":["../../src/screens/message_report_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,eAAe,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC9E,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAKtE,OAAO,EAAqB,aAAa,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACzF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAC3D,OAAO,UAAU,MAAM,+CAA+C,CAAA;AACtE,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACnC,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAC9D,OAAO,EACL,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,qDAAqD,CAAA;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAClE,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAA;AAG5E,OAAO,EAAE,cAAc,EAAE,MAAM,6CAA6C,CAAA;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,gDAAgD,CAAA;AACjF,OAAO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,uBAAuB;SACtC;QACD,QAAQ,EAAE;YACR,KAAK,EAAE,MAAM,CAAC,eAAe;SAC9B;QACD,mBAAmB,EAAE;YACnB,eAAe,EAAE,MAAM,CAAC,eAAe;SACxC;QACD,aAAa,EAAE;YACb,GAAG,EAAE,CAAC;SACP;QACD,SAAS,EAAE;YACT,KAAK,EAAE,MAAM,CAAC,uBAAuB;YACrC,QAAQ,EAAE,EAAE;YACZ,iBAAiB,EAAE,KAAK;YACxB,SAAS,EAAE,GAAG;YACd,SAAS,EAAE,GAAG;YACd,WAAW,EAAE,CAAC;YACd,WAAW,EAAE,MAAM,CAAC,sBAAsB;YAC1C,YAAY,EAAE,CAAC;YACf,iBAAiB,EAAE,EAAE;YACrB,eAAe,EAAE,EAAE;YACnB,eAAe,EAAE,MAAM,CAAC,eAAe;SACxC;QACD,WAAW,EAAE;YACX,KAAK,EAAE,MAAM,CAAC,iBAAiB;YAC/B,QAAQ,EAAE,EAAE;SACb;QACD,YAAY,EAAE;YACZ,QAAQ,EAAE,EAAE;YACZ,YAAY,EAAE,CAAC;SAChB;QACD,eAAe,EAAE;YACf,QAAQ,EAAE,EAAE;YACZ,YAAY,EAAE,CAAC;SAChB;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import React, { useCallback, useLayoutEffect, useMemo, useState } from 'react'\nimport { View, StyleSheet, TextInput, ScrollView } from 'react-native'\nimport type {\n NativeStackNavigationOptions,\n NativeStackScreenProps,\n} from '@react-navigation/native-stack'\nimport { StaticScreenProps, useNavigation, StackActions } from '@react-navigation/native'\nimport { Spinner, Text, KeyboardView } from '../components'\nimport BlankState from '../components/primitive/blank_state_primitive'\nimport { useTheme } from '../hooks'\nimport { useReportMessage } from '../hooks/use_report_message'\nimport {\n HeaderDismissButton,\n HeaderTextButton,\n} from '../components/display/platform_modal_header_buttons'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\nimport { useConversationMessages } from '../hooks/use_conversation_messages'\nimport { MessageResource } from '../types'\nimport { MessageReportReason } from '../types/resources/message_report'\nimport { MessagePreview } from './message_report/components/message_preview'\nimport { ReportReasonList } from './message_report/components/report_reason_list'\nimport { platformFontWeightBold } from '../utils'\n\nconst MAX_DETAIL_LENGTH = 500\n\nexport const MessageReportScreenOptions = ({\n navigation,\n}: NativeStackScreenProps<any>): NativeStackNavigationOptions => ({\n presentation: 'modal',\n title: 'Report message',\n headerLeft: () => <HeaderDismissButton title=\"Cancel\" onPress={() => navigation.goBack()} />,\n})\n\nexport type MessageReportScreenProps = StaticScreenProps<{\n conversation_id: number\n message_id: string\n}>\n\nexport function MessageReportScreen({ route }: MessageReportScreenProps) {\n const { conversation_id, message_id } = route.params\n\n const { messages } = useConversationMessages({ conversation_id }, { refetchOnMount: false })\n const message = messages.find(m => m.id === message_id)\n\n if (!message) return null\n\n return <MessageReportScreenContent message={message} conversation_id={conversation_id} />\n}\n\nfunction MessageReportScreenContent({\n message,\n conversation_id,\n}: {\n message: MessageResource\n conversation_id: number\n}) {\n const styles = useStyles()\n const navigation = useNavigation()\n const [selectedReason, setSelectedReason] = useState<MessageReportReason | null>(null)\n const [reasonDetail, setReasonDetail] = useState('')\n const { mutate: submitReport, status } = useReportMessage(conversation_id, message.id)\n\n const handleReasonChange = useCallback((reason: MessageReportReason) => {\n setSelectedReason(reason)\n\n if (reason !== 'other') {\n setReasonDetail('')\n }\n }, [])\n\n const isFormValid = useMemo(() => {\n if (selectedReason === null) return false\n\n if (selectedReason === 'other' && reasonDetail.trim().length === 0) {\n return false\n }\n\n if (status === 'pending') return false\n\n return true\n }, [selectedReason, reasonDetail, status])\n\n const handleSubmit = useCallback(() => {\n if (!isFormValid || !selectedReason) return\n\n submitReport({\n reason: selectedReason,\n reasonDetail: selectedReason === 'other' ? reasonDetail : undefined,\n })\n }, [isFormValid, selectedReason, reasonDetail, submitReport])\n\n const handleClose = useCallback(() => {\n navigation.dispatch(StackActions.popTo('Conversation', { conversation_id }))\n }, [navigation, conversation_id])\n\n const HeaderRight = useCallback(\n () => <HeaderTextButton title=\"Submit\" onPress={handleSubmit} disabled={!isFormValid} />,\n [handleSubmit, isFormValid]\n )\n\n useLayoutEffect(() => {\n if (status === 'pending' || status === 'success') {\n navigation.setOptions({\n headerRight: () => null,\n })\n } else {\n navigation.setOptions({\n headerTitle: 'Report message',\n headerRight: HeaderRight,\n })\n }\n }, [HeaderRight, navigation, status])\n\n if (status === 'pending') {\n return (\n <View style={styles.fullScreenContainer}>\n <Spinner />\n <Text style={styles.loadingText}>Submitting report...</Text>\n </View>\n )\n }\n\n if (status === 'success') {\n return (\n <View style={styles.fullScreenContainer}>\n <BlankState.Root>\n <BlankState.Imagery name=\"general.checkCircle\" style={styles.successIcon} />\n <BlankState.Content>\n <BlankState.Heading style={styles.successTitle}>Message reported</BlankState.Heading>\n <BlankState.Text style={styles.successSubtitle}>\n The message has been reported and a church leader will be contacted.\n </BlankState.Text>\n </BlankState.Content>\n <BlankState.Button title=\"Close\" onPress={handleClose} size=\"lg\" variant=\"fill\" />\n </BlankState.Root>\n </View>\n )\n }\n\n if (status === 'error') {\n return (\n <BlankState.Root>\n <BlankState.Imagery name=\"general.exclamationTriangle\" />\n <BlankState.Content>\n <BlankState.Heading>Unable to submit report</BlankState.Heading>\n <BlankState.Text>\n We were unable to report this message. Please try again.\n </BlankState.Text>\n </BlankState.Content>\n <BlankState.Button title=\"Close\" onPress={handleClose} size=\"lg\" variant=\"outline\" />\n </BlankState.Root>\n )\n }\n\n return (\n <KeyboardView>\n <ScrollView contentContainerStyle={styles.container}>\n <Text style={styles.warningText}>\n Reporting this message will notify a church leader. The person you are reporting will not\n receive a notification from Church Center. If someone is in immediate danger, call local\n emergency services. Don't wait.\n </Text>\n\n <MessagePreview message={message} />\n\n <View style={styles.reasonSection}>\n <Text style={styles.fieldLabel}>\n What best describes the problem? <Text style={styles.required}>*</Text>\n </Text>\n\n <View style={styles.reasonListContainer}>\n <ReportReasonList selectedReason={selectedReason} onReasonChange={handleReasonChange} />\n </View>\n </View>\n\n {selectedReason === 'other' && (\n <View style={styles.detailSection}>\n <Text style={styles.fieldLabel}>\n Please provide more details <Text style={styles.required}>*</Text>\n </Text>\n <TextInput\n style={styles.textInput}\n multiline\n placeholder=\"Describe the issue...\"\n value={reasonDetail}\n onChangeText={setReasonDetail}\n maxLength={MAX_DETAIL_LENGTH}\n accessibilityLabel=\"Additional details\"\n accessibilityHint=\"Provide more information about why you're reporting this message\"\n />\n {reasonDetail.length >= MAX_DETAIL_LENGTH - 100 && (\n <Text variant=\"footnote\">\n {reasonDetail.length}/{MAX_DETAIL_LENGTH}\n </Text>\n )}\n </View>\n )}\n </ScrollView>\n </KeyboardView>\n )\n}\n\nconst useStyles = () => {\n const { bottom } = useSafeAreaInsets()\n const { colors } = useTheme()\n\n return StyleSheet.create({\n container: {\n padding: 16,\n paddingBottom: 16 + bottom,\n gap: 24,\n },\n fullHeight: {\n flex: 1,\n justifyContent: 'center',\n alignItems: 'center',\n },\n fullScreenContainer: {\n flex: 1,\n justifyContent: 'center',\n alignItems: 'center',\n backgroundColor: colors.surfaceColor100,\n },\n loadingText: {\n marginTop: 16,\n fontSize: 16,\n fontWeight: '600',\n color: colors.textColorDefaultPrimary,\n },\n warningText: {\n fontSize: 14,\n lineHeight: 20,\n color: colors.textColorDefaultSecondary,\n },\n reasonSection: {\n gap: 8,\n },\n fieldLabel: {\n fontSize: 16,\n fontWeight: platformFontWeightBold,\n color: colors.textColorDefaultPrimary,\n },\n required: {\n color: colors.statusErrorText,\n },\n reasonListContainer: {\n backgroundColor: colors.surfaceColor100,\n },\n detailSection: {\n gap: 8,\n },\n textInput: {\n color: colors.textColorDefaultPrimary,\n fontSize: 16,\n textAlignVertical: 'top',\n minHeight: 120,\n maxHeight: 200,\n borderWidth: 1,\n borderColor: colors.borderColorDefaultBase,\n borderRadius: 8,\n paddingHorizontal: 16,\n paddingVertical: 12,\n backgroundColor: colors.surfaceColor100,\n },\n successIcon: {\n color: colors.statusSuccessIcon,\n fontSize: 48,\n },\n successTitle: {\n fontSize: 24,\n marginBottom: 4,\n },\n successSubtitle: {\n fontSize: 16,\n marginBottom: 4,\n },\n })\n}\n"]}
|
|
1
|
+
{"version":3,"file":"message_report_screen.js","sourceRoot":"","sources":["../../src/screens/message_report_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,eAAe,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC9E,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAKtE,OAAO,EAAqB,aAAa,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACzF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAC3D,OAAO,UAAU,MAAM,+CAA+C,CAAA;AACtE,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACnC,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAC9D,OAAO,EACL,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,qDAAqD,CAAA;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAClE,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAA;AAG5E,OAAO,EAAE,cAAc,EAAE,MAAM,6CAA6C,CAAA;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,gDAAgD,CAAA;AACjF,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AAEjD,MAAM,iBAAiB,GAAG,GAAG,CAAA;AAE7B,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,EACzC,UAAU,EACV,KAAK,GACuB,EAAgC,EAAE;IAC9D,MAAM,WAAW,GAAG,GAAG,EAAE,CACvB,UAAU,CAAC,QAAQ,CACjB,YAAY,CAAC,KAAK,CAAC,cAAc,EAAE;QACjC,eAAe,EAAE,KAAK,CAAC,MA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e,EAAE,MAAM,CAAC,eAAe;SACxC;QACD,aAAa,EAAE;YACb,GAAG,EAAE,CAAC;SACP;QACD,SAAS,EAAE;YACT,KAAK,EAAE,MAAM,CAAC,uBAAuB;YACrC,QAAQ,EAAE,EAAE;YACZ,iBAAiB,EAAE,KAAK;YACxB,SAAS,EAAE,GAAG;YACd,SAAS,EAAE,GAAG;YACd,WAAW,EAAE,CAAC;YACd,WAAW,EAAE,MAAM,CAAC,sBAAsB;YAC1C,YAAY,EAAE,CAAC;YACf,iBAAiB,EAAE,EAAE;YACrB,eAAe,EAAE,EAAE;YACnB,eAAe,EAAE,MAAM,CAAC,eAAe;SACxC;QACD,WAAW,EAAE;YACX,KAAK,EAAE,MAAM,CAAC,iBAAiB;YAC/B,QAAQ,EAAE,EAAE;SACb;QACD,YAAY,EAAE;YACZ,QAAQ,EAAE,EAAE;YACZ,YAAY,EAAE,CAAC;SAChB;QACD,eAAe,EAAE;YACf,QAAQ,EAAE,EAAE;YACZ,YAAY,EAAE,CAAC;SAChB;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import React, { useCallback, useLayoutEffect, useMemo, useState } from 'react'\nimport { View, StyleSheet, TextInput, ScrollView } from 'react-native'\nimport type {\n NativeStackNavigationOptions,\n NativeStackScreenProps,\n} from '@react-navigation/native-stack'\nimport { StaticScreenProps, useNavigation, StackActions } from '@react-navigation/native'\nimport { Spinner, Text, KeyboardView } from '../components'\nimport BlankState from '../components/primitive/blank_state_primitive'\nimport { useTheme } from '../hooks'\nimport { useReportMessage } from '../hooks/use_report_message'\nimport {\n HeaderDismissButton,\n HeaderTextButton,\n} from '../components/display/platform_modal_header_buttons'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\nimport { useConversationMessages } from '../hooks/use_conversation_messages'\nimport { MessageResource } from '../types'\nimport { MessageReportReason } from '../types/resources/message_report'\nimport { MessagePreview } from './message_report/components/message_preview'\nimport { ReportReasonList } from './message_report/components/report_reason_list'\nimport { platformFontWeightBold } from '../utils'\n\nconst MAX_DETAIL_LENGTH = 500\n\nexport const MessageReportScreenOptions = ({\n navigation,\n route,\n}: NativeStackScreenProps<any>): NativeStackNavigationOptions => {\n const handleClose = () =>\n navigation.dispatch(\n StackActions.popTo('Conversation', {\n conversation_id: route.params?.conversation_id,\n })\n )\n\n return {\n presentation: 'modal',\n title: 'Report message',\n headerLeft: () => <HeaderDismissButton title=\"Cancel\" onPress={handleClose} />,\n }\n}\n\nexport type MessageReportScreenProps = StaticScreenProps<{\n conversation_id: number\n message_id: string\n}>\n\nexport function MessageReportScreen({ route }: MessageReportScreenProps) {\n const { conversation_id, message_id } = route.params\n\n const { messages } = useConversationMessages({ conversation_id }, { refetchOnMount: false })\n const message = messages.find(m => m.id === message_id)\n\n if (!message) return null\n\n return <MessageReportScreenContent message={message} conversation_id={conversation_id} />\n}\n\nfunction MessageReportScreenContent({\n message,\n conversation_id,\n}: {\n message: MessageResource\n conversation_id: number\n}) {\n const styles = useStyles()\n const navigation = useNavigation()\n const [selectedReason, setSelectedReason] = useState<MessageReportReason | null>(null)\n const [reasonDetail, setReasonDetail] = useState('')\n const { mutate: submitReport, status } = useReportMessage(conversation_id, message.id)\n\n const handleReasonChange = useCallback((reason: MessageReportReason) => {\n setSelectedReason(reason)\n\n if (reason !== 'other') {\n setReasonDetail('')\n }\n }, [])\n\n const isFormValid = useMemo(() => {\n if (selectedReason === null) return false\n\n if (selectedReason === 'other' && reasonDetail.trim().length === 0) {\n return false\n }\n\n if (status === 'pending') return false\n\n return true\n }, [selectedReason, reasonDetail, status])\n\n const handleSubmit = useCallback(() => {\n if (!isFormValid || !selectedReason) return\n\n submitReport({\n reason: selectedReason,\n reasonDetail: selectedReason === 'other' ? reasonDetail : undefined,\n })\n }, [isFormValid, selectedReason, reasonDetail, submitReport])\n\n const handleClose = useCallback(() => {\n navigation.dispatch(StackActions.popTo('Conversation', { conversation_id }))\n }, [navigation, conversation_id])\n\n const HeaderRight = useCallback(\n () => <HeaderTextButton title=\"Submit\" onPress={handleSubmit} disabled={!isFormValid} />,\n [handleSubmit, isFormValid]\n )\n\n useLayoutEffect(() => {\n if (status === 'pending' || status === 'success') {\n navigation.setOptions({\n headerRight: () => null,\n })\n } else {\n navigation.setOptions({\n headerTitle: 'Report message',\n headerRight: HeaderRight,\n })\n }\n }, [HeaderRight, navigation, status])\n\n if (status === 'pending') {\n return (\n <View style={styles.fullScreenContainer}>\n <Spinner />\n <Text style={styles.loadingText}>Submitting report...</Text>\n </View>\n )\n }\n\n if (status === 'success') {\n return (\n <View style={styles.fullScreenContainer}>\n <BlankState.Root>\n <BlankState.Imagery name=\"general.checkCircle\" style={styles.successIcon} />\n <BlankState.Content>\n <BlankState.Heading style={styles.successTitle}>Message reported</BlankState.Heading>\n <BlankState.Text style={styles.successSubtitle}>\n The message has been reported and a church leader will be contacted.\n </BlankState.Text>\n </BlankState.Content>\n <BlankState.Button title=\"Close\" onPress={handleClose} size=\"lg\" variant=\"fill\" />\n </BlankState.Root>\n </View>\n )\n }\n\n if (status === 'error') {\n return (\n <BlankState.Root>\n <BlankState.Imagery name=\"general.exclamationTriangle\" />\n <BlankState.Content>\n <BlankState.Heading>Unable to submit report</BlankState.Heading>\n <BlankState.Text>\n We were unable to report this message. Please try again.\n </BlankState.Text>\n </BlankState.Content>\n <BlankState.Button title=\"Close\" onPress={handleClose} size=\"lg\" variant=\"outline\" />\n </BlankState.Root>\n )\n }\n\n return (\n <KeyboardView>\n <ScrollView contentContainerStyle={styles.container}>\n <Text style={styles.warningText} maxFontSizeMultiplier={1.5}>\n Reporting this message will notify a church leader. The person you are reporting will not\n receive a notification from Church Center. If someone is in immediate danger, call local\n emergency services. Don't wait.\n </Text>\n\n <MessagePreview message={message} />\n\n <View style={styles.reasonSection}>\n <Text style={styles.fieldLabel}>\n What best describes the problem? <Text style={styles.required}>*</Text>\n </Text>\n\n <View style={styles.reasonListContainer}>\n <ReportReasonList selectedReason={selectedReason} onReasonChange={handleReasonChange} />\n </View>\n </View>\n\n {selectedReason === 'other' && (\n <View style={styles.detailSection}>\n <Text style={styles.fieldLabel}>\n Please provide more details <Text style={styles.required}>*</Text>\n </Text>\n <TextInput\n style={styles.textInput}\n multiline\n placeholder=\"Describe the issue...\"\n value={reasonDetail}\n onChangeText={setReasonDetail}\n maxLength={MAX_DETAIL_LENGTH}\n accessibilityLabel=\"Additional details\"\n accessibilityHint=\"Provide more information about why you're reporting this message\"\n />\n {reasonDetail.length >= MAX_DETAIL_LENGTH - 100 && (\n <Text variant=\"footnote\">\n {reasonDetail.length}/{MAX_DETAIL_LENGTH}\n </Text>\n )}\n </View>\n )}\n </ScrollView>\n </KeyboardView>\n )\n}\n\nconst useStyles = () => {\n const { bottom } = useSafeAreaInsets()\n const { colors } = useTheme()\n\n return StyleSheet.create({\n container: {\n padding: 16,\n paddingBottom: 16 + bottom,\n gap: 24,\n },\n fullHeight: {\n flex: 1,\n justifyContent: 'center',\n alignItems: 'center',\n },\n fullScreenContainer: {\n flex: 1,\n justifyContent: 'center',\n alignItems: 'center',\n backgroundColor: colors.surfaceColor100,\n },\n loadingText: {\n marginTop: 16,\n fontSize: 16,\n fontWeight: '600',\n color: colors.textColorDefaultPrimary,\n },\n warningText: {\n fontSize: 14,\n lineHeight: 20,\n color: colors.textColorDefaultSecondary,\n },\n reasonSection: {\n gap: 8,\n },\n fieldLabel: {\n fontSize: 16,\n fontWeight: platformFontWeightBold,\n color: colors.textColorDefaultPrimary,\n },\n required: {\n color: colors.statusErrorText,\n },\n reasonListContainer: {\n backgroundColor: colors.surfaceColor100,\n },\n detailSection: {\n gap: 8,\n },\n textInput: {\n color: colors.textColorDefaultPrimary,\n fontSize: 16,\n textAlignVertical: 'top',\n minHeight: 120,\n maxHeight: 200,\n borderWidth: 1,\n borderColor: colors.borderColorDefaultBase,\n borderRadius: 8,\n paddingHorizontal: 16,\n paddingVertical: 12,\n backgroundColor: colors.surfaceColor100,\n },\n successIcon: {\n color: colors.statusSuccessIcon,\n fontSize: 48,\n },\n successTitle: {\n fontSize: 24,\n marginBottom: 4,\n },\n successSubtitle: {\n fontSize: 16,\n marginBottom: 4,\n },\n })\n}\n"]}
|
package/build/utils/date.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { date as formatDate } from '@planningcenter/datetime-fmt';
|
|
2
|
-
import
|
|
2
|
+
import dayjs from './dayjs';
|
|
3
3
|
export function formatDatePreview(date) {
|
|
4
4
|
if (!date)
|
|
5
5
|
return '';
|
|
6
|
-
const now =
|
|
6
|
+
const now = dayjs();
|
|
7
7
|
const isToday = now.isSame(date, 'day');
|
|
8
8
|
const isThisWeek = now.isSame(date, 'week');
|
|
9
9
|
const isThisYear = now.isSame(date, 'year');
|
|
10
10
|
if (isToday)
|
|
11
|
-
return
|
|
11
|
+
return dayjs(date).format('h:mma');
|
|
12
12
|
if (isThisWeek)
|
|
13
13
|
return formatDate(date, { style: 'relative-short' });
|
|
14
14
|
if (isThisYear)
|
|
@@ -21,7 +21,7 @@ const formatShorterDate = (date) => {
|
|
|
21
21
|
return formatDate(date, { style: 'short', year: true }).replace(/20(\d{2})/, '$1');
|
|
22
22
|
};
|
|
23
23
|
export function getRelativeDateStatus(date) {
|
|
24
|
-
const now =
|
|
24
|
+
const now = dayjs();
|
|
25
25
|
const isToday = now.isSame(date, 'day');
|
|
26
26
|
const isThisWeek = now.isSame(date, 'week');
|
|
27
27
|
const isThisYear = now.isSame(date, 'year');
|
|
@@ -43,14 +43,14 @@ export function relativeDateTime(dateTimeString) {
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
export function relativeTime(date) {
|
|
46
|
-
const now =
|
|
47
|
-
const then =
|
|
48
|
-
const duration =
|
|
46
|
+
const now = dayjs();
|
|
47
|
+
const then = dayjs(date);
|
|
48
|
+
const duration = dayjs.duration(now.diff(then));
|
|
49
49
|
if (duration.asDays() < 1) {
|
|
50
50
|
return then.fromNow();
|
|
51
51
|
}
|
|
52
52
|
else {
|
|
53
|
-
return
|
|
53
|
+
return dayjs(date).format('h:mma');
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
//# sourceMappingURL=date.js.map
|
package/build/utils/date.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date.js","sourceRoot":"","sources":["../../src/utils/date.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,8BAA8B,CAAA;AACjE,OAAO,
|
|
1
|
+
{"version":3,"file":"date.js","sourceRoot":"","sources":["../../src/utils/date.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,8BAA8B,CAAA;AACjE,OAAO,KAAK,MAAM,SAAS,CAAA;AAI3B,MAAM,UAAU,iBAAiB,CAAC,IAAgB;IAChD,IAAI,CAAC,IAAI;QAAE,OAAO,EAAE,CAAA;IAEpB,MAAM,GAAG,GAAG,KAAK,EAAE,CAAA;IACnB,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;IACvC,MAAM,UAAU,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;IAC3C,MAAM,UAAU,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;IAE3C,IAAI,OAAO;QAAE,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;IAC/C,IAAI,UAAU;QAAE,OAAO,UAAU,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,gBAAgB,EAAE,CAAC,CAAA;IACpE,IAAI,UAAU;QAAE,OAAO,UAAU,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC,CAAA;IAEjE,wBAAwB;IACxB,OAAO,iBAAiB,CAAC,IAAI,CAAC,CAAA;AAChC,CAAC;AAED,MAAM,iBAAiB,GAAG,CAAC,IAAe,EAAE,EAAE;IAC5C,iCAA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QACN,OAAO,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAA;IACzC,CAAC;AACH,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,IAAe;IAC1C,MAAM,GAAG,GAAG,KAAK,EAAE,CAAA;IACnB,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,CAAA;IACxB,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;IAE/C,IAAI,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC;QAC1B,OAAO,IAAI,CAAC,OAAO,EAAE,CAAA;IACvB,CAAC;SAAM,CAAC;QACN,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;IACpC,CAAC;AACH,CAAC","sourcesContent":["import { date as formatDate } from '@planningcenter/datetime-fmt'\nimport dayjs from './dayjs'\n\nexport type DateProps = string | number | Date\n\nexport function formatDatePreview(date?: DateProps) {\n if (!date) return ''\n\n const now = dayjs()\n const isToday = now.isSame(date, 'day')\n const isThisWeek = now.isSame(date, 'week')\n const isThisYear = now.isSame(date, 'year')\n\n if (isToday) return dayjs(date).format('h:mma')\n if (isThisWeek) return formatDate(date, { style: 'relative-short' })\n if (isThisYear) return formatDate(date, { style: 'abbreviated' })\n\n // TODO: Org date format\n return formatShorterDate(date)\n}\n\nconst formatShorterDate = (date: DateProps) => {\n // Drop the century from the year\n return formatDate(date, { style: 'short', year: true }).replace(/20(\\d{2})/, '$1')\n}\n\nexport function getRelativeDateStatus(date: DateProps) {\n const now = dayjs()\n\n const isToday = now.isSame(date, 'day')\n const isThisWeek = now.isSame(date, 'week')\n const isThisYear = now.isSame(date, 'year')\n\n return { isToday, isThisWeek, isThisYear }\n}\n\nexport function relativeDateTime(dateTimeString: string): string {\n const date = new Date(dateTimeString)\n const now = new Date()\n\n const isToday = date.toDateString() === now.toDateString()\n const isThisYear = date.getFullYear() === now.getFullYear()\n\n if (isToday) {\n return date.toLocaleTimeString('en-US', { hour: '2-digit', minute: '2-digit', hour12: true })\n } else if (isThisYear) {\n return date.toLocaleDateString('en-US', { month: 'short', day: 'numeric' })\n } else {\n return date.toLocaleDateString('en-US')\n }\n}\n\nexport function relativeTime(date: DateProps): string {\n const now = dayjs()\n const then = dayjs(date)\n const duration = dayjs.duration(now.diff(then))\n\n if (duration.asDays() < 1) {\n return then.fromNow()\n } else {\n return dayjs(date).format('h:mma')\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dayjs.d.ts","sourceRoot":"","sources":["../../src/utils/dayjs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAOzB,eAAe,KAAK,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dayjs.js","sourceRoot":"","sources":["../../src/utils/dayjs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,QAAQ,MAAM,uBAAuB,CAAA;AAC5C,OAAO,YAAY,MAAM,2BAA2B,CAAA;AAEpD,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;AACtB,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC,CAAA;AAE1B,eAAe,KAAK,CAAA","sourcesContent":["import dayjs from 'dayjs'\nimport duration from 'dayjs/plugin/duration'\nimport relativeTime from 'dayjs/plugin/relativeTime'\n\ndayjs.extend(duration)\ndayjs.extend(relativeTime)\n\nexport default dayjs\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@planningcenter/chat-react-native",
|
|
3
|
-
"version": "3.26.1-
|
|
3
|
+
"version": "3.26.1-rc.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"react-compiler-runtime": "^1.0.0"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
|
-
"@planningcenter/datetime-fmt": ">=
|
|
26
|
+
"@planningcenter/datetime-fmt": ">=2.0.0",
|
|
27
27
|
"@planningcenter/icons": "^15.24.0",
|
|
28
28
|
"@planningcenter/jolt-client": ">=2.0.0",
|
|
29
29
|
"@react-native-community/datetimepicker": ">=7.6.2",
|
|
@@ -32,9 +32,8 @@
|
|
|
32
32
|
"@react-navigation/native-stack": ">=7.0.0",
|
|
33
33
|
"@tanstack/react-query": "^5.0.0",
|
|
34
34
|
"color": "^3.1.2",
|
|
35
|
+
"dayjs": ">=1.11.0",
|
|
35
36
|
"lodash": "*",
|
|
36
|
-
"moment": ">=2.0.0",
|
|
37
|
-
"moment-timezone": "*",
|
|
38
37
|
"react": "^18.0.0 || ^19.0.0",
|
|
39
38
|
"react-native": "*",
|
|
40
39
|
"react-native-device-info": "*",
|
|
@@ -59,5 +58,5 @@
|
|
|
59
58
|
"react-native-url-polyfill": "^2.0.0",
|
|
60
59
|
"typescript": "<5.6.0"
|
|
61
60
|
},
|
|
62
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "c156833a4091ac3628566c992e7ef63c19b5c630"
|
|
63
62
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useEffect, useState } from 'react'
|
|
2
|
-
import
|
|
2
|
+
import dayjs from '../utils/dayjs'
|
|
3
3
|
import { relativeTime, type DateProps } from '../utils/date'
|
|
4
4
|
|
|
5
5
|
const MINUTE = 60
|
|
@@ -11,7 +11,7 @@ export function useLiveRelativeTime(date: DateProps) {
|
|
|
11
11
|
|
|
12
12
|
useEffect(() => {
|
|
13
13
|
const tick = () => {
|
|
14
|
-
const then =
|
|
14
|
+
const then = dayjs(date).valueOf()
|
|
15
15
|
const seconds = Math.round(Math.abs(timeNow - then) / 1000)
|
|
16
16
|
|
|
17
17
|
const periodInMinutes = seconds < HOUR ? 1 : seconds < DAY ? 60 : 0
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
useTheme as useNavigationTheme,
|
|
9
9
|
useRoute,
|
|
10
10
|
} from '@react-navigation/native'
|
|
11
|
-
import
|
|
11
|
+
import dayjs from '../utils/dayjs'
|
|
12
12
|
import React, { useCallback, useEffect, useRef, useState } from 'react'
|
|
13
13
|
import { FlatList, Platform, StyleSheet, View } from 'react-native'
|
|
14
14
|
import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
|
@@ -302,7 +302,7 @@ export const groupMessages = ({
|
|
|
302
302
|
ms.forEach((message, i) => {
|
|
303
303
|
const prevMessage = ms[i + 1]
|
|
304
304
|
const nextMessage = ms[i - 1]
|
|
305
|
-
const date =
|
|
305
|
+
const date = dayjs(message.createdAt).format('YYYY-MM-DD')
|
|
306
306
|
const inThread = message.replyRootId !== null
|
|
307
307
|
const nextMessageInThread = nextMessage?.replyRootId !== null
|
|
308
308
|
const threadRoot = message.replyRootId === message.id
|
|
@@ -318,9 +318,9 @@ export const groupMessages = ({
|
|
|
318
318
|
nextMessage &&
|
|
319
319
|
new Date(nextMessage.createdAt).getTime() - new Date(message.createdAt).getTime() > 60000 * 5
|
|
320
320
|
const prevMessageIsDateSeparator =
|
|
321
|
-
prevMessage && date !==
|
|
321
|
+
prevMessage && date !== dayjs(prevMessage.createdAt).format('YYYY-MM-DD')
|
|
322
322
|
const nextMessageIsDateSeparator =
|
|
323
|
-
nextMessage && date !==
|
|
323
|
+
nextMessage && date !== dayjs(nextMessage.createdAt).format('YYYY-MM-DD')
|
|
324
324
|
const insertReplyShadowMessage =
|
|
325
325
|
message.replyRootId &&
|
|
326
326
|
!threadRoot &&
|
|
@@ -383,7 +383,7 @@ export const groupMessages = ({
|
|
|
383
383
|
})
|
|
384
384
|
}
|
|
385
385
|
|
|
386
|
-
if (!prevMessage || date !==
|
|
386
|
+
if (!prevMessage || date !== dayjs(prevMessage.createdAt).format('YYYY-MM-DD')) {
|
|
387
387
|
enrichedMessages.push({ type: 'DateSeparator', id: `day-divider-${message.id}`, date })
|
|
388
388
|
}
|
|
389
389
|
})
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { View, StyleSheet, ViewStyle } from 'react-native'
|
|
3
3
|
import { Avatar, Text, Icon } from '../../../components'
|
|
4
|
-
import { useTheme } from '../../../hooks'
|
|
4
|
+
import { useTheme, useFontScale } from '../../../hooks'
|
|
5
5
|
import { MessageResource } from '../../../types'
|
|
6
6
|
|
|
7
7
|
interface MessagePreviewProps {
|
|
@@ -21,14 +21,20 @@ export function MessagePreview({ message, style }: MessagePreviewProps) {
|
|
|
21
21
|
<View style={[styles.previewContainer, style]}>
|
|
22
22
|
<View style={styles.previewHeader}>
|
|
23
23
|
<Avatar sourceUri={message.author.avatar} size="md" />
|
|
24
|
-
<Text style={styles.authorName}
|
|
24
|
+
<Text style={styles.authorName} maxFontSizeMultiplier={1.5} numberOfLines={1}>
|
|
25
|
+
{message.author.name}
|
|
26
|
+
</Text>
|
|
25
27
|
</View>
|
|
26
28
|
|
|
27
29
|
<View style={styles.messageBubble}>
|
|
28
30
|
{hasImages && (
|
|
29
31
|
<View style={styles.imagePlaceholder}>
|
|
30
|
-
<Icon
|
|
31
|
-
|
|
32
|
+
<Icon
|
|
33
|
+
name="general.image"
|
|
34
|
+
style={styles.placeholderIcon}
|
|
35
|
+
maxFontSizeMultiplier={1.25}
|
|
36
|
+
/>
|
|
37
|
+
<Text variant="secondary" style={styles.placeholderText} maxFontSizeMultiplier={1.25}>
|
|
32
38
|
Image hidden
|
|
33
39
|
</Text>
|
|
34
40
|
</View>
|
|
@@ -46,6 +52,7 @@ export function MessagePreview({ message, style }: MessagePreviewProps) {
|
|
|
46
52
|
|
|
47
53
|
const useStyles = ({ imageOnly }: { imageOnly: boolean }) => {
|
|
48
54
|
const { colors } = useTheme()
|
|
55
|
+
const fontScale = useFontScale({ maxFontSizeMultiplier: 1.5 })
|
|
49
56
|
|
|
50
57
|
return StyleSheet.create({
|
|
51
58
|
previewContainer: {
|
|
@@ -60,13 +67,13 @@ const useStyles = ({ imageOnly }: { imageOnly: boolean }) => {
|
|
|
60
67
|
fontSize: 14,
|
|
61
68
|
fontWeight: '600',
|
|
62
69
|
color: colors.textColorDefaultPrimary,
|
|
70
|
+
flexShrink: 1,
|
|
63
71
|
},
|
|
64
72
|
messageBubble: {
|
|
65
73
|
backgroundColor: colors.fillColorNeutral060,
|
|
66
74
|
borderRadius: 16,
|
|
67
|
-
overflow: 'hidden',
|
|
68
75
|
alignSelf: 'flex-start',
|
|
69
|
-
|
|
76
|
+
...(!imageOnly && { maxWidth: '80%' }),
|
|
70
77
|
},
|
|
71
78
|
messageText: {
|
|
72
79
|
fontSize: 14,
|
|
@@ -76,10 +83,11 @@ const useStyles = ({ imageOnly }: { imageOnly: boolean }) => {
|
|
|
76
83
|
paddingVertical: 12,
|
|
77
84
|
},
|
|
78
85
|
imagePlaceholder: {
|
|
79
|
-
|
|
86
|
+
paddingHorizontal: 24 * fontScale,
|
|
87
|
+
paddingVertical: 20 * fontScale,
|
|
80
88
|
justifyContent: 'center',
|
|
81
89
|
alignItems: 'center',
|
|
82
|
-
gap: 8,
|
|
90
|
+
gap: 8 * fontScale,
|
|
83
91
|
},
|
|
84
92
|
placeholderIcon: {
|
|
85
93
|
fontSize: 32,
|
|
@@ -25,11 +25,21 @@ const MAX_DETAIL_LENGTH = 500
|
|
|
25
25
|
|
|
26
26
|
export const MessageReportScreenOptions = ({
|
|
27
27
|
navigation,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
route,
|
|
29
|
+
}: NativeStackScreenProps<any>): NativeStackNavigationOptions => {
|
|
30
|
+
const handleClose = () =>
|
|
31
|
+
navigation.dispatch(
|
|
32
|
+
StackActions.popTo('Conversation', {
|
|
33
|
+
conversation_id: route.params?.conversation_id,
|
|
34
|
+
})
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
return {
|
|
38
|
+
presentation: 'modal',
|
|
39
|
+
title: 'Report message',
|
|
40
|
+
headerLeft: () => <HeaderDismissButton title="Cancel" onPress={handleClose} />,
|
|
41
|
+
}
|
|
42
|
+
}
|
|
33
43
|
|
|
34
44
|
export type MessageReportScreenProps = StaticScreenProps<{
|
|
35
45
|
conversation_id: number
|
|
@@ -155,7 +165,7 @@ function MessageReportScreenContent({
|
|
|
155
165
|
return (
|
|
156
166
|
<KeyboardView>
|
|
157
167
|
<ScrollView contentContainerStyle={styles.container}>
|
|
158
|
-
<Text style={styles.warningText}>
|
|
168
|
+
<Text style={styles.warningText} maxFontSizeMultiplier={1.5}>
|
|
159
169
|
Reporting this message will notify a church leader. The person you are reporting will not
|
|
160
170
|
receive a notification from Church Center. If someone is in immediate danger, call local
|
|
161
171
|
emergency services. Don't wait.
|
|
@@ -10,7 +10,7 @@ type options = Partial<{
|
|
|
10
10
|
yearSeparator: string
|
|
11
11
|
truncateSameMonth: boolean
|
|
12
12
|
truncateSameYear: boolean
|
|
13
|
-
anchorDate: Date // very optional - only used to anchor relative dates from a date other than `
|
|
13
|
+
anchorDate: Date // very optional - only used to anchor relative dates from a date other than `dayjs()` (current datetime), primarily for tests
|
|
14
14
|
}>
|
|
15
15
|
|
|
16
16
|
declare module '@planningcenter/datetime-fmt' {
|
package/src/utils/date.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { date as formatDate } from '@planningcenter/datetime-fmt'
|
|
2
|
-
import
|
|
2
|
+
import dayjs from './dayjs'
|
|
3
3
|
|
|
4
4
|
export type DateProps = string | number | Date
|
|
5
5
|
|
|
6
6
|
export function formatDatePreview(date?: DateProps) {
|
|
7
7
|
if (!date) return ''
|
|
8
8
|
|
|
9
|
-
const now =
|
|
9
|
+
const now = dayjs()
|
|
10
10
|
const isToday = now.isSame(date, 'day')
|
|
11
11
|
const isThisWeek = now.isSame(date, 'week')
|
|
12
12
|
const isThisYear = now.isSame(date, 'year')
|
|
13
13
|
|
|
14
|
-
if (isToday) return
|
|
14
|
+
if (isToday) return dayjs(date).format('h:mma')
|
|
15
15
|
if (isThisWeek) return formatDate(date, { style: 'relative-short' })
|
|
16
16
|
if (isThisYear) return formatDate(date, { style: 'abbreviated' })
|
|
17
17
|
|
|
@@ -25,7 +25,7 @@ const formatShorterDate = (date: DateProps) => {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
export function getRelativeDateStatus(date: DateProps) {
|
|
28
|
-
const now =
|
|
28
|
+
const now = dayjs()
|
|
29
29
|
|
|
30
30
|
const isToday = now.isSame(date, 'day')
|
|
31
31
|
const isThisWeek = now.isSame(date, 'week')
|
|
@@ -51,13 +51,13 @@ export function relativeDateTime(dateTimeString: string): string {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
export function relativeTime(date: DateProps): string {
|
|
54
|
-
const now =
|
|
55
|
-
const then =
|
|
56
|
-
const duration =
|
|
54
|
+
const now = dayjs()
|
|
55
|
+
const then = dayjs(date)
|
|
56
|
+
const duration = dayjs.duration(now.diff(then))
|
|
57
57
|
|
|
58
58
|
if (duration.asDays() < 1) {
|
|
59
59
|
return then.fromNow()
|
|
60
60
|
} else {
|
|
61
|
-
return
|
|
61
|
+
return dayjs(date).format('h:mma')
|
|
62
62
|
}
|
|
63
63
|
}
|