@messenger-box/platform-mobile 10.0.3-alpha.18 → 10.0.3-alpha.180

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 (98) hide show
  1. package/lib/compute.js +2 -3
  2. package/lib/compute.js.map +1 -1
  3. package/lib/index.js.map +1 -1
  4. package/lib/module.js.map +1 -1
  5. package/lib/queries/inboxQueries.js +65 -0
  6. package/lib/queries/inboxQueries.js.map +1 -0
  7. package/lib/routes.json +2 -3
  8. package/lib/screens/inbox/DialogMessages.js +8 -3
  9. package/lib/screens/inbox/DialogMessages.js.map +1 -1
  10. package/lib/screens/inbox/DialogThreadMessages.js +6 -11
  11. package/lib/screens/inbox/DialogThreadMessages.js.map +1 -1
  12. package/lib/screens/inbox/DialogThreads.js +58 -20
  13. package/lib/screens/inbox/DialogThreads.js.map +1 -1
  14. package/lib/screens/inbox/Inbox.js.map +1 -1
  15. package/lib/screens/inbox/components/CachedImage/consts.js.map +1 -1
  16. package/lib/screens/inbox/components/CachedImage/index.js +125 -115
  17. package/lib/screens/inbox/components/CachedImage/index.js.map +1 -1
  18. package/lib/screens/inbox/components/DialogItem.js +160 -0
  19. package/lib/screens/inbox/components/DialogItem.js.map +1 -0
  20. package/lib/screens/inbox/components/GiftedChatInboxComponent.js +313 -0
  21. package/lib/screens/inbox/components/GiftedChatInboxComponent.js.map +1 -0
  22. package/lib/screens/inbox/components/SlackMessageContainer/ImageViewerModal.js +2 -0
  23. package/lib/screens/inbox/components/SlackMessageContainer/ImageViewerModal.js.map +1 -1
  24. package/lib/screens/inbox/components/SlackMessageContainer/PaymentMessage.js +194 -0
  25. package/lib/screens/inbox/components/SlackMessageContainer/PaymentMessage.js.map +1 -0
  26. package/lib/screens/inbox/components/SlackMessageContainer/SlackBubble.js +144 -32
  27. package/lib/screens/inbox/components/SlackMessageContainer/SlackBubble.js.map +1 -1
  28. package/lib/screens/inbox/components/SlackMessageContainer/SlackMessage.js +3 -4
  29. package/lib/screens/inbox/components/SlackMessageContainer/SlackMessage.js.map +1 -1
  30. package/lib/screens/inbox/components/SubscriptionHandler.js +22 -0
  31. package/lib/screens/inbox/components/SubscriptionHandler.js.map +1 -0
  32. package/lib/screens/inbox/components/ThreadsViewItem.js +67 -47
  33. package/lib/screens/inbox/components/ThreadsViewItem.js.map +1 -1
  34. package/lib/screens/inbox/config/config.js +4 -2
  35. package/lib/screens/inbox/config/config.js.map +1 -1
  36. package/lib/screens/inbox/containers/ConversationView.js +1098 -1093
  37. package/lib/screens/inbox/containers/ConversationView.js.map +1 -1
  38. package/lib/screens/inbox/containers/Dialogs.js +179 -333
  39. package/lib/screens/inbox/containers/Dialogs.js.map +1 -1
  40. package/lib/screens/inbox/containers/ThreadConversationView.js +873 -866
  41. package/lib/screens/inbox/containers/ThreadConversationView.js.map +1 -1
  42. package/lib/screens/inbox/containers/ThreadsView.js +81 -54
  43. package/lib/screens/inbox/containers/ThreadsView.js.map +1 -1
  44. package/lib/screens/inbox/hooks/useInboxMessages.js +31 -0
  45. package/lib/screens/inbox/hooks/useInboxMessages.js.map +1 -0
  46. package/lib/screens/inbox/hooks/useSafeDialogThreadsMachine.js +108 -0
  47. package/lib/screens/inbox/hooks/useSafeDialogThreadsMachine.js.map +1 -0
  48. package/lib/screens/inbox/workflow/dialog-threads-xstate.js +151 -0
  49. package/lib/screens/inbox/workflow/dialog-threads-xstate.js.map +1 -0
  50. package/package.json +5 -5
  51. package/CHANGELOG.md +0 -156
  52. package/jest.config.js +0 -24
  53. package/lib/screens/inbox/components/DialogsListItem.js +0 -175
  54. package/lib/screens/inbox/components/DialogsListItem.js.map +0 -1
  55. package/lib/screens/inbox/components/ServiceDialogsListItem.js +0 -165
  56. package/lib/screens/inbox/components/ServiceDialogsListItem.js.map +0 -1
  57. package/lib/screens/inbox/containers/workflow/conversation-xstate.js +0 -380
  58. package/lib/screens/inbox/containers/workflow/conversation-xstate.js.map +0 -1
  59. package/lib/screens/inbox/containers/workflow/dialogs-xstate.js +0 -235
  60. package/lib/screens/inbox/containers/workflow/dialogs-xstate.js.map +0 -1
  61. package/lib/screens/inbox/containers/workflow/thread-conversation-xstate.js +0 -438
  62. package/lib/screens/inbox/containers/workflow/thread-conversation-xstate.js.map +0 -1
  63. package/rollup.config.mjs +0 -45
  64. package/src/components/index.ts +0 -0
  65. package/src/compute.ts +0 -63
  66. package/src/index.ts +0 -7
  67. package/src/module.ts +0 -10
  68. package/src/navigation/InboxNavigation.tsx +0 -102
  69. package/src/navigation/index.ts +0 -1
  70. package/src/screens/inbox/DialogMessages.tsx +0 -21
  71. package/src/screens/inbox/DialogThreadMessages.tsx +0 -97
  72. package/src/screens/inbox/DialogThreads.tsx +0 -129
  73. package/src/screens/inbox/Inbox.tsx +0 -17
  74. package/src/screens/inbox/components/CachedImage/consts.ts +0 -6
  75. package/src/screens/inbox/components/CachedImage/index.tsx +0 -223
  76. package/src/screens/inbox/components/DialogsHeader.tsx +0 -30
  77. package/src/screens/inbox/components/DialogsListItem.tsx +0 -302
  78. package/src/screens/inbox/components/ServiceDialogsListItem.tsx +0 -287
  79. package/src/screens/inbox/components/SlackMessageContainer/ImageViewerModal.tsx +0 -113
  80. package/src/screens/inbox/components/SlackMessageContainer/SlackBubble.tsx +0 -313
  81. package/src/screens/inbox/components/SlackMessageContainer/SlackMessage.tsx +0 -145
  82. package/src/screens/inbox/components/SlackMessageContainer/index.ts +0 -3
  83. package/src/screens/inbox/components/SupportServiceDialogsListItem.tsx +0 -283
  84. package/src/screens/inbox/components/ThreadsViewItem.tsx +0 -321
  85. package/src/screens/inbox/config/config.ts +0 -15
  86. package/src/screens/inbox/config/index.ts +0 -1
  87. package/src/screens/inbox/containers/ConversationView.tsx +0 -1782
  88. package/src/screens/inbox/containers/Dialogs.tsx +0 -544
  89. package/src/screens/inbox/containers/SupportServiceDialogs.tsx +0 -119
  90. package/src/screens/inbox/containers/ThreadConversationView.tsx +0 -1537
  91. package/src/screens/inbox/containers/ThreadsView.tsx +0 -305
  92. package/src/screens/inbox/containers/workflow/apollo/handleResult.ts +0 -20
  93. package/src/screens/inbox/containers/workflow/conversation-xstate.ts +0 -313
  94. package/src/screens/inbox/containers/workflow/dialogs-xstate.ts +0 -196
  95. package/src/screens/inbox/containers/workflow/thread-conversation-xstate.ts +0 -401
  96. package/src/screens/index.ts +0 -4
  97. package/tsconfig.json +0 -13
  98. package/webpack.config.js +0 -58
@@ -1,283 +0,0 @@
1
- import React, { useMemo } from 'react';
2
- import {
3
- Text,
4
- Image,
5
- Pressable,
6
- HStack,
7
- Box,
8
- AvatarGroup,
9
- Avatar,
10
- AvatarFallbackText,
11
- AvatarImage,
12
- AvatarBadge,
13
- View,
14
- } from '@admin-layout/gluestack-ui-mobile';
15
- import { format, isToday, isYesterday } from 'date-fns';
16
- import { useFocusEffect } from '@react-navigation/native';
17
- import { IChannel, IUserAccount } from 'common';
18
- import {
19
- useThreadMessagesQuery,
20
- useMessagesQuery,
21
- useUserAccountQuery,
22
- useOnThreadCreatedUpdatedSubscription,
23
- useOnThreadChatMessageAddedSubscription,
24
- OnThreadCreatedUpdatedDocument as THREAD_CHAT_ADDED,
25
- OnThreadChatMessageAddedDocument as CHAT_MESSAGE_ADDED,
26
- } from 'common/graphql';
27
- import { startCase } from 'lodash-es';
28
- import colors from 'tailwindcss/colors';
29
-
30
- const createdAtText = (value: string) => {
31
- if (!value) return '';
32
- let date = new Date(value);
33
- if (isToday(date)) return 'Today';
34
- if (isYesterday(date)) return 'Yesterday';
35
- return format(new Date(value), 'MMM dd, yyyy');
36
- };
37
-
38
- export interface IDialogListChannel extends IChannel {
39
- users: IUserAccount[];
40
- }
41
-
42
- export interface IDialogListItemProps {
43
- currentUser?: any;
44
- users?: any;
45
- selectedChannelId?: any;
46
- channel?: any;
47
- onOpen: (id: any, title: any, postParentId?: any) => void;
48
- refreshing: boolean;
49
- role: any;
50
- }
51
-
52
- /**
53
- * TODO:
54
- * - Get Reservation info: reservation date, status
55
- * - Add ability to get property information: name, logo
56
- */
57
- export const SupportServiceDialogsListItemComponent: React.FC<IDialogListItemProps> = function DialogsListItem({
58
- currentUser,
59
- // users,
60
- selectedChannelId,
61
- channel,
62
- onOpen,
63
- refreshing,
64
- role,
65
- }) {
66
- const [servicePostParentId, setServicePostParentId] = React.useState(null);
67
- const {
68
- data: threadMessages,
69
- loading: threadMessageLoading,
70
- error,
71
- refetch: refetchThreadMessages,
72
- subscribeToMore,
73
- } = useThreadMessagesQuery({
74
- variables: {
75
- channelId: channel?.id?.toString(),
76
- role,
77
- limit: 2,
78
- },
79
- fetchPolicy: 'cache-and-network',
80
- });
81
-
82
- useFocusEffect(
83
- React.useCallback(() => {
84
- // Do something when the screen is focused
85
- // refetchMessages({ channelId: channel?.id?.toString(), limit: 25 });
86
- refetchThreadMessages({ channelId: channel?.id?.toString(), role, limit: 2 });
87
- return () => {
88
- // Do something when the screen is unfocused
89
- // Useful for cleanup functions
90
- };
91
- }, [refreshing]),
92
- );
93
-
94
- const lastMessage = useMemo(() => {
95
- if (!threadMessages?.threadMessages?.data?.length) {
96
- return null;
97
- }
98
- const { data }: any = threadMessages.threadMessages;
99
- const replies =
100
- data
101
- ?.map((t: any) => t?.replies)
102
- ?.flat(1)
103
- ?.filter((p: any) => p?.message !== '') ?? [];
104
- if (replies?.length) {
105
- return replies[0];
106
- // return replies[replies.length - 1];
107
- } else {
108
- const post =
109
- data?.find((t: any) => {
110
- return t?.post?.message !== '';
111
- }) ??
112
- data?.find((t: any) => {
113
- return t?.post;
114
- }) ??
115
- null;
116
- return post ? post?.post : null;
117
- }
118
- }, [threadMessages]);
119
-
120
- React.useEffect(() => {
121
- if (lastMessage) {
122
- const sParentId = lastMessage?.parentId ? lastMessage?.parentId : lastMessage?.id;
123
- setServicePostParentId(sParentId);
124
- }
125
- }, [lastMessage]);
126
-
127
- const creatorAndMembersId = React.useMemo(() => {
128
- if (!channel?.members) return null;
129
- const membersIds: any =
130
- channel?.members
131
- ?.filter((m: any) => m !== null && m?.user?.id !== currentUser?.id)
132
- ?.map((mu: any) => mu?.user?.id) ?? [];
133
- const creatorId: any = channel?.creator?.id;
134
- const mergedIds: any = [].concat(membersIds, creatorId) ?? [];
135
- return mergedIds?.filter((m: any, pos: any) => mergedIds?.indexOf(m) === pos) ?? [];
136
- }, [channel]);
137
-
138
- const postParentId = React.useMemo(() => {
139
- if (!creatorAndMembersId?.length) return null;
140
-
141
- return creatorAndMembersId?.length && creatorAndMembersId?.includes(currentUser?.id)
142
- ? null
143
- : lastMessage?.parentId
144
- ? lastMessage?.parentId
145
- : lastMessage?.id ?? 0;
146
- }, [creatorAndMembersId, lastMessage]);
147
-
148
- // const { data: threadCreatedUpdated } = useOnThreadCreatedUpdatedSubscription({
149
- // variables: {
150
- // channelId: channel?.id?.toString(),
151
- // postParentId:
152
- // postParentId == null
153
- // ? null
154
- // : lastMessage?.parentId
155
- // ? lastMessage?.parentId ?? null
156
- // : lastMessage?.id ?? null,
157
- // },
158
- // });
159
-
160
- // React.useEffect(() => {
161
- // if (threadCreatedUpdated?.threadCreatedUpdated?.data) {
162
- // refetchThreadMessages({ channelId: channel?.id?.toString(), role, limit: 2 });
163
- // }
164
- // }, [threadCreatedUpdated]);
165
-
166
- return (
167
- <Pressable
168
- onPress={() => channel?.id !== selectedChannelId && onOpen(channel?.id, channel?.title, postParentId)}
169
- className="flex-1 border rounded-md border-gray-200 dark:border-gray-600 dark:bg-gray-700"
170
- >
171
- <HStack space={'sm'} className="flex-1 w-[100%] py-3 justify-between items-center">
172
- <Box className="flex-[0.1] items-start pl-3">
173
- <Avatar
174
- key={'support-service-channels-key-' + channel?.id}
175
- size={'sm'}
176
- className="bg-transparent top-0 right-0 z-[1]"
177
- >
178
- <AvatarFallbackText> {startCase(channel?.creator?.username?.charAt(0))}</AvatarFallbackText>
179
- <AvatarImage
180
- alt="user image"
181
- style={{ borderRadius: 6, borderWidth: 2, borderColor: '#fff' }}
182
- source={{
183
- uri: channel?.creator?.picture,
184
- }}
185
- />
186
- </Avatar>
187
- </Box>
188
- <Box className="flex-[0.9]">
189
- <ServiceChannelWithLastMessage
190
- channel={channel}
191
- lastMessage={lastMessage}
192
- subscribeToNewMessages={() =>
193
- subscribeToMore({
194
- document: THREAD_CHAT_ADDED,
195
- variables: {
196
- channelId: channel?.id?.toString(),
197
- postParentId: postParentId ? servicePostParentId : null,
198
- },
199
- updateQuery: (prev, { subscriptionData }: any) => {
200
- if (!subscriptionData.data) return prev;
201
-
202
- const newPostThreadData: any = subscriptionData?.data?.threadCreatedUpdated?.data;
203
- const newMessage: any = subscriptionData?.data?.threadCreatedUpdated?.lastMessage;
204
- const data = prev?.threadMessages?.data?.map((t: any) =>
205
- t.id === newPostThreadData?.id
206
- ? {
207
- ...t,
208
- replies: [...t?.replies, newMessage],
209
- replyCount: newPostThreadData?.replyCount,
210
- lastReplyAt: newPostThreadData?.lastReplyAt,
211
- updatedAt: newPostThreadData?.updatedAt,
212
- }
213
- : t,
214
- );
215
-
216
- return Object.assign({}, prev, {
217
- threadMessages: {
218
- ...prev?.threadMessages,
219
- // totalCount: prev?.threadMessages?.totalCount + 1,
220
- data: data,
221
- },
222
- });
223
- },
224
- })
225
- }
226
- />
227
- {/* <Text
228
- flex={1}
229
- color="gray.600"
230
- p={0}
231
- m={0}
232
- w={'100%'}
233
- justifyContent={''}
234
- fontSize="lg"
235
- fontWeight="semibold"
236
- >
237
- {title}
238
- </Text> */}
239
- {/* <Text flex={0.1} color="gray.600">
240
- {lastMessage?.message ?? ''}
241
- </Text> */}
242
- </Box>
243
- {/* <Text flex={0.2} color="gray.500">
244
- {lastMessage ? createdAtText(lastMessage?.createdAt) : ''}
245
- </Text> */}
246
- </HStack>
247
- </Pressable>
248
- );
249
- };
250
-
251
- const ServiceChannelWithLastMessage = React.memo(({ channel, lastMessage, subscribeToNewMessages }: any) => {
252
- React.useEffect(() => subscribeToNewMessages(), []);
253
- return (
254
- <HStack space={'sm'} className="flex-1 justify-center items-center">
255
- <Box className="flex-[0.8]">
256
- <Text color={colors.gray[600]} className="text-lg flex-wrap font-semibold">
257
- {channel?.title}
258
- </Text>
259
- <Text color={colors.gray[600]} numberOfLines={1}>
260
- {/* {creatorAndMembersId?.length && creatorAndMembersId?.includes(currentUser?.id)
261
- ? lastMessageCreatorAndMembers?.message ?? ''
262
- : lastMessage?.message ?? ''} */}
263
- {lastMessage?.message ?? ''}
264
- </Text>
265
- </Box>
266
-
267
- <Box className="flex-[0.2]">
268
- {/* {creatorAndMembersId?.length && creatorAndMembersId?.includes(currentUser?.id) ? (
269
- <Text color="gray.500">
270
- {lastMessageCreatorAndMembers
271
- ? createdAtText(lastMessageCreatorAndMembers?.createdAt)
272
- : ''}
273
- </Text>
274
- ) : (
275
- <Text color="gray.500">{lastMessage ? createdAtText(lastMessage?.createdAt) : ''}</Text>
276
- )} */}
277
- <Text color={colors.gray[500]}>{lastMessage ? createdAtText(lastMessage?.createdAt) : ''}</Text>
278
- </Box>
279
- </HStack>
280
- );
281
- });
282
-
283
- export const SupportServiceDialogsListItem = React.memo(SupportServiceDialogsListItemComponent);
@@ -1,321 +0,0 @@
1
- import React, { useMemo } from 'react';
2
- import {
3
- VStack,
4
- Text,
5
- Image,
6
- Pressable,
7
- HStack,
8
- Box,
9
- AvatarGroup,
10
- Avatar,
11
- AvatarFallbackText,
12
- AvatarImage,
13
- AvatarBadge,
14
- View,
15
- Button,
16
- ButtonText,
17
- } from '@admin-layout/gluestack-ui-mobile';
18
- import { format, isToday, isYesterday } from 'date-fns';
19
- import { useFocusEffect } from '@react-navigation/native';
20
- import { IChannel, IUserAccount } from 'common';
21
- import {
22
- useThreadMessagesQuery,
23
- useMessagesQuery,
24
- useUserAccountQuery,
25
- useOnThreadChatMessageAddedSubscription,
26
- useOnThreadCreatedUpdatedSubscription,
27
- } from 'common/graphql';
28
- import { startCase } from 'lodash-es';
29
- import colors from 'tailwindcss/colors';
30
-
31
- const createdAtText = (value: string) => {
32
- if (!value) return '';
33
- let date = new Date(value);
34
- if (isToday(date)) return 'Today';
35
- if (isYesterday(date)) return 'Yesterday';
36
- return format(new Date(value), 'MMM dd, yyyy');
37
- };
38
-
39
- export interface IDialogListChannel extends IChannel {
40
- users: IUserAccount[];
41
- }
42
-
43
- export interface IDialogListItemProps {
44
- currentUser?: any;
45
- users?: any;
46
- thread?: any;
47
- onOpen: (id: any, title: any, postParentId?: any) => void;
48
- role?: any;
49
- setData?: any;
50
- }
51
-
52
- /**
53
- * TODO:
54
- * - Get Reservation info: reservation date, status
55
- * - Add ability to get property information: name, logo
56
- */
57
- export const ThreadViewItemComponent: React.FC<IDialogListItemProps> = function DialogsListItem({
58
- currentUser,
59
- // users,
60
- thread,
61
- onOpen,
62
- role,
63
- setData,
64
- }) {
65
- // const { data: threadCreatedUpdated } = useOnThreadCreatedUpdatedSubscription({
66
- // variables: {
67
- // channelId: thread?.channel?.id?.toString(),
68
- // postParentId: thread?.post?.id?.toString(),
69
- // },
70
- // });
71
-
72
- useFocusEffect(
73
- React.useCallback(() => {
74
- // Do something when the screen is focused
75
- return () => {
76
- // Do something when the screen is unfocused
77
- // Useful for cleanup functions
78
- };
79
- }, []),
80
- );
81
-
82
- const threadPostReply = React.useMemo(() => {
83
- if (!thread?.replies) return null;
84
- return thread?.replies;
85
- }, [thread]);
86
-
87
- // React.useEffect(() => {
88
- // if (threadCreatedUpdated?.threadCreatedUpdated?.data) setData(threadCreatedUpdated?.threadCreatedUpdated?.data);
89
- // }, [threadCreatedUpdated?.threadCreatedUpdated]);
90
-
91
- // const threadPostReply = React.useMemo(() => {
92
- // if (!thread?.replies) return null;
93
- // if (threadCreatedUpdated?.threadCreatedUpdated?.data?.replies?.length) {
94
- // return threadCreatedUpdated?.threadCreatedUpdated?.data?.replies;
95
- // } else return thread?.replies;
96
- // }, [thread, threadCreatedUpdated]);
97
-
98
- // const lastMessage = useMemo(() => {
99
- // if (!threadPost) {
100
- // return null;
101
- // }
102
- // const replies = threadPost?.replies?.filter((p: any) => p?.message !== '') ?? [];
103
- // if (replies?.length) {
104
- // return replies[0];
105
- // // return replies[replies.length - 1];
106
- // } else {
107
- // const post = threadPost?.post ?? null;
108
- // return post ? post?.post : null;
109
- // }
110
- // }, [threadPost]);
111
-
112
- // const participants: any = React.useMemo(() => {
113
- // if (!thread?.participants?.length) return null;
114
- // return thread?.participants?.filter((u: any) => u?.user?.id !== currentUser?.id) ?? [];
115
- // }, [thread]);
116
-
117
- // const allParticipantsNames: any = React.useMemo(() => {
118
- // if (!participants?.length) return null;
119
- // return (
120
- // participants
121
- // ?.map((p: any) => {
122
- // return p?.user?.givenName + ' ' + p?.user?.familyName ?? '';
123
- // })
124
- // ?.join(', ') ?? ''
125
- // );
126
- // }, [participants]);
127
-
128
- if (!threadPostReply || threadPostReply?.length == 0) {
129
- return <></>;
130
- }
131
-
132
- return (
133
- <VStack
134
- space={'sm'}
135
- className="flex-1 py-2 px-2 border rounded-md bg-white border-gray-200 dark:border-white dark:bg-white"
136
- >
137
- <HStack space={'sm'} className="py-2 w-[100%] flex-1 justify-between items-center">
138
- <Box className="flex-1">
139
- {/* <HStack flex={1} space={5} py={2} alignItems={'baseline'}>
140
- <Box>
141
- <Avatar.Badge size={4} left={0} zIndex={1} bg="green.800" />
142
- </Box>
143
- <Box>
144
- <Text color="gray.600" fontSize="lg" flexWrap={'wrap'} fontWeight="semibold">
145
- {allParticipantsNames || ''}
146
- </Text>
147
- </Box>
148
- </HStack> */}
149
- <HStack space={'sm'} className="flex-1 justify-center items-center">
150
- <Box className="flex-1">
151
- {/* <HStack space={2} py={2}>
152
- <Box>
153
- <Avatar
154
- bg={'transparent'}
155
- size={8}
156
- _image={{ borderRadius: 6, borderWidth: 2, borderColor: '#fff' }}
157
- source={{
158
- uri: thread?.post?.author?.picture,
159
- }}
160
- >
161
- {startCase(thread?.post?.author?.username?.charAt(0))}
162
- </Avatar>
163
- </Box>
164
- <Box>
165
- <HStack space={4}>
166
- <Text>
167
- {thread?.post?.author?.givenName + ' ' + thread?.post?.author?.familyName ??
168
- ''}
169
- </Text>
170
- <Text color="gray.500">
171
- {thread?.post ? createdAtText(thread?.post?.createdAt) : ''}
172
- </Text>
173
- </HStack>
174
- <Text color="gray.600" noOfLines={2}>
175
- {thread?.post?.message ?? ''}
176
- </Text>
177
- {!thread?.replies?.length && (
178
- <Button
179
- size={'xs'}
180
- w={150}
181
- variant={'outline'}
182
- _text={{ fontSize: 12, color: '#000' }}
183
- onPress={() =>
184
- onOpen(thread?.channel?.id, thread?.channel?.title, thread?.post?.id)
185
- }
186
- >
187
- Reply
188
- </Button>
189
- )}
190
- </Box>
191
- </HStack> */}
192
- {threadPostReply?.length > 0 && (
193
- <>
194
- {threadPostReply
195
- ?.slice(0, 2)
196
- ?.reverse()
197
- ?.map((reply: any, index: any) => (
198
- <HStack key={index} space={'sm'} className="pb-2 pt-1">
199
- <Box>
200
- <Avatar
201
- key={'thread-view-key-' + index}
202
- size={'md'}
203
- className="bg-transparent top-0 right-0 z-[1]"
204
- >
205
- <AvatarFallbackText>
206
- {' '}
207
- {startCase(reply?.author?.username?.charAt(0))}
208
- </AvatarFallbackText>
209
- <AvatarImage
210
- alt="image"
211
- style={{
212
- borderRadius: 6,
213
- borderWidth: 2,
214
- borderColor: '#fff',
215
- }}
216
- source={{
217
- uri: reply?.author?.picture,
218
- }}
219
- />
220
- </Avatar>
221
- </Box>
222
- <Box>
223
- <HStack space={'md'}>
224
- <Text>
225
- {reply?.author?.givenName ?? '' ?? ''}{' '}
226
- {reply?.author?.familyName ?? '' ?? ''}
227
- {/* {lastMessage?.author?.givenName +
228
- ' ' +
229
- lastMessage?.author?.familyName ?? ''} */}
230
- </Text>
231
- <Text color={colors.gray[500]}>
232
- {reply?.createdAt ? createdAtText(reply?.createdAt) : ''}
233
- {/* {lastMessage ? createdAtText(lastMessage?.createdAt) : ''} */}
234
- </Text>
235
- </HStack>
236
- <VStack space={'sm'}>
237
- {reply?.message && (
238
- <Text color={colors.gray[600]} numberOfLines={2}>
239
- {reply?.message.length < 70
240
- ? `${reply?.message}`
241
- : `${reply?.message.substring(0, 68)}....`}
242
- </Text>
243
- )}
244
- {/* <Text color="gray.600" noOfLines={2}>
245
- {reply?.message
246
- ? reply?.message.length < 70
247
- ? `${reply?.message}`
248
- : `${reply?.message.substring(0, 68)}....`
249
- : ''}
250
- </Text> */}
251
-
252
- <>
253
- {reply?.files?.data?.length > 0 &&
254
- reply?.files?.data?.map((f: any, index: any) => (
255
- <Box>
256
- <Avatar
257
- key={'thread-view-other-key-' + index}
258
- className="bg-transparent"
259
- size={'md'}
260
- >
261
- <AvatarFallbackText> I</AvatarFallbackText>
262
- <AvatarImage
263
- alt="image"
264
- style={{
265
- borderRadius: 6,
266
- borderWidth: 2,
267
- borderColor: '#fff',
268
- }}
269
- source={{
270
- uri: f?.url,
271
- }}
272
- />
273
- </Avatar>
274
- </Box>
275
- ))}
276
- </>
277
- </VStack>
278
-
279
- {(threadPostReply?.length == 1 || index !== 0) && (
280
- <Button
281
- size={'xs'}
282
- className="w-[150]"
283
- variant={'outline'}
284
- onPress={() =>
285
- onOpen(
286
- thread?.channel?.id,
287
- thread?.channel?.title,
288
- thread?.post?.id,
289
- )
290
- }
291
- >
292
- <ButtonText style={{ fontSize: 12, color: '#000' }}>
293
- Reply
294
- </ButtonText>
295
- </Button>
296
- )}
297
- </Box>
298
- </HStack>
299
- ))}
300
- </>
301
- )}
302
- </Box>
303
- </HStack>
304
- </Box>
305
- </HStack>
306
- {/* <HStack>
307
- <Box flex={0.06} alignItems={'flex-start'}></Box>
308
- <Button
309
- size={'xs'}
310
- variant={'outline'}
311
- _text={{ fontSize: 12, color: '#000' }}
312
- onPress={() => onOpen(thread?.channel?.id, thread?.channel?.title, postParentId)}
313
- >
314
- Reply
315
- </Button>
316
- </HStack> */}
317
- </VStack>
318
- );
319
- };
320
-
321
- export const ThreadViewItem = React.memo(ThreadViewItemComponent);
@@ -1,15 +0,0 @@
1
- import { cleanEnv, num, str } from 'envalid';
2
-
3
- export const config = cleanEnv(process['APP_ENV'] || process.env, {
4
- MESSAGES_PER_PAGE: num({ devDefault: 20, default: 20 }),
5
- FILES_PER_MESSAGE: num({ default: 10 }),
6
- INBOX_MESSEGE_PATH: str({ default: 'MainStack.Message' }),
7
- // THREAD_MESSEGE_PATH: str({ default: 'MainStack.Thread' }),
8
- // THREADS_PATH: str({ default: 'MainStack.ThreadMessage' }),
9
- THREAD_MESSEGE_PATH: str({ default: 'MainStack.ThreadMessage' }),
10
- THREADS_PATH: str({ default: 'MainStack.Thread' }),
11
- CALL_TO_ACTION_PATH: str({ default: 'MainStack.GuestReservationRequestDetail' }),
12
- CALL_TO_ACTION_BOX_BGCOLOR: str({ default: '#0084ff' }),
13
- CALL_TO_ACTION_BUTTON_BORDERCOLOR: str({ default: '#fff' }),
14
- CALL_TO_ACTION_TEXT_COLOR: str({ default: '#fff' }),
15
- });
@@ -1 +0,0 @@
1
- export { config } from './config';