@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.
- package/lib/compute.js +2 -3
- package/lib/compute.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/module.js.map +1 -1
- package/lib/queries/inboxQueries.js +65 -0
- package/lib/queries/inboxQueries.js.map +1 -0
- package/lib/routes.json +2 -3
- package/lib/screens/inbox/DialogMessages.js +8 -3
- package/lib/screens/inbox/DialogMessages.js.map +1 -1
- package/lib/screens/inbox/DialogThreadMessages.js +6 -11
- package/lib/screens/inbox/DialogThreadMessages.js.map +1 -1
- package/lib/screens/inbox/DialogThreads.js +58 -20
- package/lib/screens/inbox/DialogThreads.js.map +1 -1
- package/lib/screens/inbox/Inbox.js.map +1 -1
- package/lib/screens/inbox/components/CachedImage/consts.js.map +1 -1
- package/lib/screens/inbox/components/CachedImage/index.js +125 -115
- package/lib/screens/inbox/components/CachedImage/index.js.map +1 -1
- package/lib/screens/inbox/components/DialogItem.js +160 -0
- package/lib/screens/inbox/components/DialogItem.js.map +1 -0
- package/lib/screens/inbox/components/GiftedChatInboxComponent.js +313 -0
- package/lib/screens/inbox/components/GiftedChatInboxComponent.js.map +1 -0
- package/lib/screens/inbox/components/SlackMessageContainer/ImageViewerModal.js +2 -0
- package/lib/screens/inbox/components/SlackMessageContainer/ImageViewerModal.js.map +1 -1
- package/lib/screens/inbox/components/SlackMessageContainer/PaymentMessage.js +194 -0
- package/lib/screens/inbox/components/SlackMessageContainer/PaymentMessage.js.map +1 -0
- package/lib/screens/inbox/components/SlackMessageContainer/SlackBubble.js +144 -32
- package/lib/screens/inbox/components/SlackMessageContainer/SlackBubble.js.map +1 -1
- package/lib/screens/inbox/components/SlackMessageContainer/SlackMessage.js +3 -4
- package/lib/screens/inbox/components/SlackMessageContainer/SlackMessage.js.map +1 -1
- package/lib/screens/inbox/components/SubscriptionHandler.js +22 -0
- package/lib/screens/inbox/components/SubscriptionHandler.js.map +1 -0
- package/lib/screens/inbox/components/ThreadsViewItem.js +67 -47
- package/lib/screens/inbox/components/ThreadsViewItem.js.map +1 -1
- package/lib/screens/inbox/config/config.js +4 -2
- package/lib/screens/inbox/config/config.js.map +1 -1
- package/lib/screens/inbox/containers/ConversationView.js +1098 -1093
- package/lib/screens/inbox/containers/ConversationView.js.map +1 -1
- package/lib/screens/inbox/containers/Dialogs.js +179 -333
- package/lib/screens/inbox/containers/Dialogs.js.map +1 -1
- package/lib/screens/inbox/containers/ThreadConversationView.js +873 -866
- package/lib/screens/inbox/containers/ThreadConversationView.js.map +1 -1
- package/lib/screens/inbox/containers/ThreadsView.js +81 -54
- package/lib/screens/inbox/containers/ThreadsView.js.map +1 -1
- package/lib/screens/inbox/hooks/useInboxMessages.js +31 -0
- package/lib/screens/inbox/hooks/useInboxMessages.js.map +1 -0
- package/lib/screens/inbox/hooks/useSafeDialogThreadsMachine.js +108 -0
- package/lib/screens/inbox/hooks/useSafeDialogThreadsMachine.js.map +1 -0
- package/lib/screens/inbox/workflow/dialog-threads-xstate.js +151 -0
- package/lib/screens/inbox/workflow/dialog-threads-xstate.js.map +1 -0
- package/package.json +5 -5
- package/CHANGELOG.md +0 -156
- package/jest.config.js +0 -24
- package/lib/screens/inbox/components/DialogsListItem.js +0 -175
- package/lib/screens/inbox/components/DialogsListItem.js.map +0 -1
- package/lib/screens/inbox/components/ServiceDialogsListItem.js +0 -165
- package/lib/screens/inbox/components/ServiceDialogsListItem.js.map +0 -1
- package/lib/screens/inbox/containers/workflow/conversation-xstate.js +0 -380
- package/lib/screens/inbox/containers/workflow/conversation-xstate.js.map +0 -1
- package/lib/screens/inbox/containers/workflow/dialogs-xstate.js +0 -235
- package/lib/screens/inbox/containers/workflow/dialogs-xstate.js.map +0 -1
- package/lib/screens/inbox/containers/workflow/thread-conversation-xstate.js +0 -438
- package/lib/screens/inbox/containers/workflow/thread-conversation-xstate.js.map +0 -1
- package/rollup.config.mjs +0 -45
- package/src/components/index.ts +0 -0
- package/src/compute.ts +0 -63
- package/src/index.ts +0 -7
- package/src/module.ts +0 -10
- package/src/navigation/InboxNavigation.tsx +0 -102
- package/src/navigation/index.ts +0 -1
- package/src/screens/inbox/DialogMessages.tsx +0 -21
- package/src/screens/inbox/DialogThreadMessages.tsx +0 -97
- package/src/screens/inbox/DialogThreads.tsx +0 -129
- package/src/screens/inbox/Inbox.tsx +0 -17
- package/src/screens/inbox/components/CachedImage/consts.ts +0 -6
- package/src/screens/inbox/components/CachedImage/index.tsx +0 -223
- package/src/screens/inbox/components/DialogsHeader.tsx +0 -30
- package/src/screens/inbox/components/DialogsListItem.tsx +0 -302
- package/src/screens/inbox/components/ServiceDialogsListItem.tsx +0 -287
- package/src/screens/inbox/components/SlackMessageContainer/ImageViewerModal.tsx +0 -113
- package/src/screens/inbox/components/SlackMessageContainer/SlackBubble.tsx +0 -313
- package/src/screens/inbox/components/SlackMessageContainer/SlackMessage.tsx +0 -145
- package/src/screens/inbox/components/SlackMessageContainer/index.ts +0 -3
- package/src/screens/inbox/components/SupportServiceDialogsListItem.tsx +0 -283
- package/src/screens/inbox/components/ThreadsViewItem.tsx +0 -321
- package/src/screens/inbox/config/config.ts +0 -15
- package/src/screens/inbox/config/index.ts +0 -1
- package/src/screens/inbox/containers/ConversationView.tsx +0 -1782
- package/src/screens/inbox/containers/Dialogs.tsx +0 -544
- package/src/screens/inbox/containers/SupportServiceDialogs.tsx +0 -119
- package/src/screens/inbox/containers/ThreadConversationView.tsx +0 -1537
- package/src/screens/inbox/containers/ThreadsView.tsx +0 -305
- package/src/screens/inbox/containers/workflow/apollo/handleResult.ts +0 -20
- package/src/screens/inbox/containers/workflow/conversation-xstate.ts +0 -313
- package/src/screens/inbox/containers/workflow/dialogs-xstate.ts +0 -196
- package/src/screens/inbox/containers/workflow/thread-conversation-xstate.ts +0 -401
- package/src/screens/index.ts +0 -4
- package/tsconfig.json +0 -13
- package/webpack.config.js +0 -58
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React__default from'react';import {StyleSheet,TouchableHighlight,
|
|
1
|
+
import React__default from'react';import {StyleSheet,View,TouchableHighlight,Text,Platform,Dimensions}from'react-native';import {MessageText,MessageImage,Time,utils}from'react-native-gifted-chat';import CachedImage from'../CachedImage/index.js';var __defProp = Object.defineProperty;
|
|
2
2
|
var __defProps = Object.defineProperties;
|
|
3
3
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
4
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
@@ -29,10 +29,7 @@ var __objRest = (source, exclude) => {
|
|
|
29
29
|
}
|
|
30
30
|
return target;
|
|
31
31
|
};
|
|
32
|
-
var __publicField = (obj, key, value) =>
|
|
33
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
34
|
-
return value;
|
|
35
|
-
};
|
|
32
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
36
33
|
const {
|
|
37
34
|
isSameUser,
|
|
38
35
|
isSameDay
|
|
@@ -64,52 +61,164 @@ class Bubble extends React__default.Component {
|
|
|
64
61
|
return null;
|
|
65
62
|
}
|
|
66
63
|
renderMessageImage() {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
64
|
+
const _a = this.props, {
|
|
65
|
+
currentMessage,
|
|
66
|
+
containerStyle,
|
|
67
|
+
wrapperStyle
|
|
68
|
+
} = _a, messageImageProps = __objRest(_a, [
|
|
69
|
+
"currentMessage",
|
|
70
|
+
"containerStyle",
|
|
71
|
+
"wrapperStyle"
|
|
72
|
+
]);
|
|
73
|
+
if (currentMessage.images && Array.isArray(currentMessage.images) && currentMessage.images.length > 0) {
|
|
74
|
+
const validImages = currentMessage.images.filter((url) => url && typeof url === "string");
|
|
75
|
+
if (validImages.length === 0) {
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
return /* @__PURE__ */ React__default.createElement(View, { style: {
|
|
79
|
+
marginVertical: 0
|
|
80
|
+
} }, /* @__PURE__ */ React__default.createElement(View, { style: {
|
|
81
|
+
flexDirection: "row",
|
|
82
|
+
flexWrap: "wrap",
|
|
83
|
+
gap: 8
|
|
84
|
+
} }, validImages.map((imageUrl, index) => {
|
|
85
|
+
const isLocalImage = imageUrl.startsWith("file:") || imageUrl.startsWith("data:") || imageUrl.startsWith("content:") || !imageUrl.startsWith("http://") && !imageUrl.startsWith("https://");
|
|
86
|
+
const imageSize = validImages.length === 1 ? {
|
|
87
|
+
width: windowWidth * 0.6,
|
|
88
|
+
height: windowWidth * 0.4
|
|
89
|
+
} : {
|
|
90
|
+
width: windowWidth * 0.3,
|
|
91
|
+
height: windowWidth * 0.3
|
|
92
|
+
};
|
|
93
|
+
const isUploading = currentMessage.isUploading;
|
|
94
|
+
return /* @__PURE__ */ React__default.createElement(TouchableHighlight, { key: `image-${index}-${currentMessage._id}`, underlayColor: "transparent", onPress: () => {
|
|
95
|
+
if (isUploading) return;
|
|
96
|
+
const imageObject = {
|
|
97
|
+
_id: `${currentMessage._id}-img-${index}`,
|
|
98
|
+
image: imageUrl
|
|
99
|
+
};
|
|
100
|
+
this.props.setImageViewer(imageObject, true);
|
|
101
|
+
} }, /* @__PURE__ */ React__default.createElement(View, { style: __spreadProps(__spreadValues({}, imageSize), {
|
|
102
|
+
maxHeight: 200,
|
|
103
|
+
borderRadius: 8,
|
|
104
|
+
overflow: "hidden",
|
|
105
|
+
borderWidth: 1,
|
|
106
|
+
borderColor: "#e0e0e0",
|
|
107
|
+
backgroundColor: "#f7f7f7"
|
|
108
|
+
}) }, isLocalImage ? (
|
|
109
|
+
// For local images, use direct Image component with no loading state
|
|
110
|
+
/* @__PURE__ */ React__default.createElement(View, { style: {
|
|
111
|
+
width: "100%",
|
|
112
|
+
height: "100%"
|
|
113
|
+
} }, /* @__PURE__ */ React__default.createElement(MessageImage, __spreadProps(__spreadValues({}, messageImageProps), { currentMessage: __spreadProps(__spreadValues({}, currentMessage), {
|
|
114
|
+
image: imageUrl
|
|
115
|
+
}), imageStyle: {
|
|
116
|
+
width: "100%",
|
|
117
|
+
height: "100%",
|
|
118
|
+
borderRadius: 8
|
|
119
|
+
} })), isUploading && /* @__PURE__ */ React__default.createElement(View, { style: {
|
|
120
|
+
position: "absolute",
|
|
121
|
+
top: 0,
|
|
122
|
+
left: 0,
|
|
123
|
+
right: 0,
|
|
124
|
+
bottom: 0,
|
|
125
|
+
backgroundColor: "rgba(0,0,0,0.2)",
|
|
126
|
+
justifyContent: "center",
|
|
127
|
+
alignItems: "center"
|
|
128
|
+
} }, /* @__PURE__ */ React__default.createElement(Text, { style: {
|
|
129
|
+
color: "white",
|
|
130
|
+
fontWeight: "bold"
|
|
131
|
+
} }, "Uploading...")))
|
|
132
|
+
) : (
|
|
133
|
+
// For remote images, use CachedImage with loading placeholder
|
|
134
|
+
/* @__PURE__ */ React__default.createElement(CachedImage, { style: [styles.slackImage, {
|
|
135
|
+
width: "100%",
|
|
136
|
+
height: "100%"
|
|
137
|
+
}], cacheKey: `${currentMessage._id}-img-${index}-slack-bubble-imageKey`, source: {
|
|
138
|
+
uri: imageUrl,
|
|
139
|
+
expiresIn: 86400
|
|
140
|
+
}, resizeMode: "cover", alt: "image", placeholderContent: /* @__PURE__ */ React__default.createElement(View, { style: [styles.slackImage, {
|
|
141
|
+
width: "100%",
|
|
142
|
+
height: "100%",
|
|
143
|
+
backgroundColor: "#e1e1e1",
|
|
144
|
+
justifyContent: "center",
|
|
145
|
+
alignItems: "center",
|
|
146
|
+
borderRadius: 8
|
|
147
|
+
}] }, /* @__PURE__ */ React__default.createElement(Text, null, isUploading ? "Uploading..." : "Loading...")) })
|
|
148
|
+
)));
|
|
149
|
+
})));
|
|
150
|
+
}
|
|
151
|
+
if (currentMessage.image) {
|
|
75
152
|
if (this.props.renderMessageImage) {
|
|
76
153
|
return this.props.renderMessageImage(messageImageProps);
|
|
77
154
|
}
|
|
78
155
|
const {
|
|
79
156
|
image,
|
|
80
157
|
_id
|
|
81
|
-
} =
|
|
158
|
+
} = currentMessage;
|
|
82
159
|
if (!image || typeof image !== "string") {
|
|
83
|
-
console.log("Invalid image URL:", image);
|
|
84
160
|
return null;
|
|
85
161
|
}
|
|
86
|
-
|
|
162
|
+
const isLocalImage = image.startsWith("file:") || image.startsWith("data:") || image.startsWith("content:") || // Check if the image is a pendingUpload by checking if it doesn't start with http/https
|
|
163
|
+
!image.startsWith("http://") && !image.startsWith("https://");
|
|
164
|
+
const isUploading = currentMessage.isUploading;
|
|
87
165
|
return /* @__PURE__ */ React__default.createElement(TouchableHighlight, { underlayColor: "transparent", style: {
|
|
88
166
|
width: "100%",
|
|
89
|
-
marginVertical:
|
|
90
|
-
}, onPress: () =>
|
|
167
|
+
marginVertical: 0
|
|
168
|
+
}, onPress: () => {
|
|
169
|
+
if (isUploading) return;
|
|
170
|
+
this.props.setImageViewer(currentMessage, true);
|
|
171
|
+
} }, /* @__PURE__ */ React__default.createElement(View, { style: {
|
|
91
172
|
width: windowWidth * 0.6,
|
|
173
|
+
// 60% of screen width
|
|
92
174
|
height: windowWidth * 0.4,
|
|
175
|
+
// Maintain aspect ratio
|
|
93
176
|
maxHeight: 200,
|
|
94
177
|
borderRadius: 8,
|
|
95
178
|
overflow: "hidden",
|
|
96
179
|
borderWidth: 1,
|
|
97
180
|
borderColor: "#e0e0e0",
|
|
98
181
|
backgroundColor: "#f7f7f7"
|
|
99
|
-
} },
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
182
|
+
} }, isLocalImage ? (
|
|
183
|
+
// For local images, use direct Image component with no loading state
|
|
184
|
+
/* @__PURE__ */ React__default.createElement(View, { style: {
|
|
185
|
+
width: "100%",
|
|
186
|
+
height: "100%",
|
|
187
|
+
position: "relative"
|
|
188
|
+
} }, /* @__PURE__ */ React__default.createElement(MessageImage, __spreadProps(__spreadValues({}, messageImageProps), { imageStyle: {
|
|
189
|
+
width: "100%",
|
|
190
|
+
height: "100%",
|
|
191
|
+
borderRadius: 8
|
|
192
|
+
} })), isUploading && /* @__PURE__ */ React__default.createElement(View, { style: {
|
|
193
|
+
position: "absolute",
|
|
194
|
+
top: 0,
|
|
195
|
+
left: 0,
|
|
196
|
+
right: 0,
|
|
197
|
+
bottom: 0,
|
|
198
|
+
backgroundColor: "rgba(0,0,0,0.2)",
|
|
199
|
+
justifyContent: "center",
|
|
200
|
+
alignItems: "center"
|
|
201
|
+
} }, /* @__PURE__ */ React__default.createElement(Text, { style: {
|
|
202
|
+
color: "white",
|
|
203
|
+
fontWeight: "bold"
|
|
204
|
+
} }, "Uploading...")))
|
|
205
|
+
) : (
|
|
206
|
+
// For remote images, use CachedImage with loading placeholder
|
|
207
|
+
/* @__PURE__ */ React__default.createElement(CachedImage, { style: [styles.slackImage, {
|
|
208
|
+
width: "100%",
|
|
209
|
+
height: "100%"
|
|
210
|
+
}], cacheKey: `${_id}-slack-bubble-imageKey`, source: {
|
|
211
|
+
uri: image,
|
|
212
|
+
expiresIn: 86400
|
|
213
|
+
}, resizeMode: "cover", alt: "image", placeholderContent: /* @__PURE__ */ React__default.createElement(View, { style: [styles.slackImage, {
|
|
214
|
+
width: "100%",
|
|
215
|
+
height: "100%",
|
|
216
|
+
backgroundColor: "#e1e1e1",
|
|
217
|
+
justifyContent: "center",
|
|
218
|
+
alignItems: "center",
|
|
219
|
+
borderRadius: 8
|
|
220
|
+
}] }, /* @__PURE__ */ React__default.createElement(Text, null, isUploading ? "Uploading..." : "Loading...")) })
|
|
221
|
+
)));
|
|
113
222
|
}
|
|
114
223
|
return null;
|
|
115
224
|
}
|
|
@@ -226,14 +335,17 @@ const styles = StyleSheet.create({
|
|
|
226
335
|
marginRight: 10
|
|
227
336
|
},
|
|
228
337
|
headerView: {
|
|
338
|
+
// Try to align it better with the avatar on Android.
|
|
229
339
|
marginTop: Platform.OS === "android" ? -2 : 0,
|
|
230
340
|
flexDirection: "row",
|
|
231
341
|
alignItems: "baseline"
|
|
232
342
|
},
|
|
343
|
+
/* eslint-disable react-native/no-color-literals */
|
|
233
344
|
tick: {
|
|
234
345
|
backgroundColor: "transparent",
|
|
235
346
|
color: "white"
|
|
236
347
|
},
|
|
348
|
+
/* eslint-enable react-native/no-color-literals */
|
|
237
349
|
tickView: {
|
|
238
350
|
flexDirection: "row"
|
|
239
351
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SlackBubble.js","sources":["../../../../../src/screens/inbox/components/SlackMessageContainer/SlackBubble.tsx"],"sourcesContent":["/* eslint-disable no-underscore-dangle, no-use-before-define */\nimport React from 'react';\nimport { Text, StyleSheet, TouchableOpacity, TouchableHighlight, View, Platform, Dimensions } from 'react-native';\n\nimport { MessageText, MessageImage, Time, utils } from 'react-native-gifted-chat';\nimport CachedImage from '../CachedImage';\nconst { isSameUser, isSameDay } = utils;\nconst windowWidth = Dimensions.get('window').width;\nconst windowHeight = Dimensions.get('window').height;\n\nexport default class Bubble extends React.Component<any> {\n static defaultProps: {\n touchableProps: {};\n onLongPress: null;\n renderMessageImage: null;\n renderMessageText: null;\n renderCustomView: null;\n renderTime: null;\n currentMessage: { text: null; createdAt: null; image: null };\n nextMessage: {};\n previousMessage: {};\n containerStyle: {};\n wrapperStyle: {};\n tickStyle: {};\n containerToNextStyle: {};\n containerToPreviousStyle: {};\n isShowImageViewer: false;\n setImageViewer: (obj: any, v: boolean) => void;\n };\n static propTypes: any;\n constructor(props: any) {\n super(props);\n }\n\n renderMessageText() {\n if (this.props.currentMessage.text) {\n const { containerStyle, wrapperStyle, messageTextStyle, ...messageTextProps } = this.props;\n if (this.props.renderMessageText) {\n return this.props.renderMessageText(messageTextProps);\n }\n return (\n <MessageText\n {...messageTextProps}\n textStyle={{\n left: [\n styles.standardFont,\n styles.slackMessageText,\n messageTextProps.textStyle,\n messageTextStyle,\n ],\n }}\n />\n );\n }\n return null;\n }\n\n renderMessageImage() {\n if (this.props.currentMessage.image) {\n const { containerStyle, wrapperStyle, ...messageImageProps } = this.props;\n if (this.props.renderMessageImage) {\n return this.props.renderMessageImage(messageImageProps);\n }\n const { image, _id } = messageImageProps?.currentMessage;\n\n // Add validation for image URL\n if (!image || typeof image !== 'string') {\n console.log('Invalid image URL:', image);\n return null;\n }\n\n // Log the image URL for debugging\n console.log('Rendering message image:', image);\n\n return (\n <TouchableHighlight\n underlayColor={'transparent'}\n style={{ width: '100%', marginVertical: 5 }}\n onPress={() => this.props.setImageViewer(messageImageProps?.currentMessage, true)}\n >\n <View\n style={{\n width: windowWidth * 0.6, // 60% of screen width\n height: windowWidth * 0.4, // Maintain aspect ratio\n maxHeight: 200,\n borderRadius: 8,\n overflow: 'hidden',\n borderWidth: 1,\n borderColor: '#e0e0e0',\n backgroundColor: '#f7f7f7',\n }}\n >\n <CachedImage\n style={[styles.slackImage, { width: '100%', height: '100%' }]}\n cacheKey={`${_id}-slack-bubble-imageKey`}\n source={{\n uri: image,\n expiresIn: 86400,\n }}\n resizeMode={'cover'}\n alt={'image'}\n placeholderContent={\n <View\n style={[\n styles.slackImage,\n {\n width: '100%',\n height: '100%',\n backgroundColor: '#e1e1e1',\n justifyContent: 'center',\n alignItems: 'center',\n borderRadius: 8,\n },\n ]}\n >\n <Text>Loading...</Text>\n </View>\n }\n />\n </View>\n </TouchableHighlight>\n );\n }\n return null;\n }\n\n renderTicks() {\n const { currentMessage } = this.props;\n if (this.props.renderTicks) {\n return this.props.renderTicks(currentMessage);\n }\n if (currentMessage.user._id !== this.props.user._id) {\n return null;\n }\n if (currentMessage.sent || currentMessage.received) {\n return (\n <View style={[styles.headerItem, styles.tickView]}>\n {currentMessage.sent && (\n <Text style={[styles.standardFont, styles.tick, this.props.tickStyle]}>✓</Text>\n )}\n {currentMessage.received && (\n <Text style={[styles.standardFont, styles.tick, this.props.tickStyle]}>✓</Text>\n )}\n </View>\n );\n }\n return null;\n }\n\n renderUsername() {\n const username = this.props.currentMessage.user.name;\n if (username) {\n const { containerStyle, wrapperStyle, ...usernameProps } = this.props;\n if (this.props.renderUsername) {\n return this.props.renderUsername(usernameProps);\n }\n return (\n <Text style={[styles.standardFont, styles.headerItem, styles.username, this.props.usernameStyle]}>\n {username}\n </Text>\n );\n }\n return null;\n }\n\n renderTime() {\n if (this.props.currentMessage.createdAt) {\n const { containerStyle, wrapperStyle, ...timeProps }: any = this.props;\n if (this.props.renderTime) {\n return this.props.renderTime(timeProps);\n }\n return (\n <Time\n {...timeProps}\n containerStyle={{ left: [styles.timeContainer] }}\n textStyle={{\n left: [styles.standardFont, styles.headerItem, styles.time, timeProps.textStyle],\n }}\n />\n );\n }\n return null;\n }\n\n renderCustomView() {\n if (this.props.renderCustomView) {\n return this.props.renderCustomView(this.props);\n }\n return null;\n }\n\n render() {\n const isSameThread =\n isSameUser(this.props.currentMessage, this.props.previousMessage) &&\n isSameDay(this.props.currentMessage, this.props.previousMessage);\n\n const messageHeader = isSameThread ? null : (\n <View style={styles.headerView}>\n {this.renderUsername()}\n {this.renderTime()}\n {this.renderTicks()}\n </View>\n );\n\n return (\n <View style={[styles.container, this.props.containerStyle]}>\n <TouchableHighlight\n style={{ width: '100%' }}\n // underlayColor={'#c0c0c0'}\n underlayColor={'transparent'}\n disabled={true}\n accessibilityTraits=\"text\"\n {...this.props.touchableProps}\n >\n <View style={[styles.wrapper, this.props.wrapperStyle]}>\n <View>\n {this.renderCustomView()}\n {messageHeader}\n {this.renderMessageImage()}\n {this.renderMessageText()}\n </View>\n </View>\n </TouchableHighlight>\n </View>\n );\n }\n}\n\n// Note: Everything is forced to be \"left\" positioned with this component.\n// The \"right\" position is only used in the default Bubble.\nconst styles = StyleSheet.create({\n standardFont: {\n fontSize: 15,\n },\n slackMessageText: {\n marginLeft: 0,\n marginRight: 0,\n },\n container: {\n flex: 1,\n alignItems: 'flex-start',\n },\n wrapper: {\n marginRight: 60,\n minHeight: 20,\n justifyContent: 'flex-start',\n },\n username: {\n fontWeight: 'bold',\n top: 0,\n paddingTop: 0,\n marginTop: 0,\n },\n time: {\n textAlign: 'left',\n fontSize: 12,\n },\n timeContainer: {\n marginLeft: 0,\n marginRight: 0,\n marginBottom: 0,\n },\n headerItem: {\n marginRight: 10,\n },\n headerView: {\n // Try to align it better with the avatar on Android.\n marginTop: Platform.OS === 'android' ? -2 : 0,\n flexDirection: 'row',\n alignItems: 'baseline',\n },\n /* eslint-disable react-native/no-color-literals */\n tick: {\n backgroundColor: 'transparent',\n color: 'white',\n },\n /* eslint-enable react-native/no-color-literals */\n tickView: {\n flexDirection: 'row',\n },\n slackImage: {\n borderRadius: 3,\n marginLeft: 8,\n marginRight: 0,\n },\n});\n\n// Bubble.contextTypes = {\n// actionSheet: PropTypes.func,\n// };\n\nBubble.defaultProps = {\n touchableProps: {},\n onLongPress: null,\n renderMessageImage: null,\n renderMessageText: null,\n renderCustomView: null,\n renderTime: null,\n currentMessage: {\n text: null,\n createdAt: null,\n image: null,\n },\n nextMessage: {},\n previousMessage: {},\n containerStyle: {},\n wrapperStyle: {},\n tickStyle: {},\n containerToNextStyle: {},\n containerToPreviousStyle: {},\n isShowImageViewer: false,\n setImageViewer: (obj: any, v: boolean) => null,\n};\n"],"names":["React"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,MAAM;AAAA,EACJ,UAAA;AAAA,EACA;AACF,CAAI,GAAA,KAAA;AACJ,MAAM,WAAc,GAAA,UAAA,CAAW,GAAI,CAAA,QAAQ,CAAE,CAAA,KAAA;AACxB,UAAA,CAAW,GAAI,CAAA,QAAQ,CAAE,CAAA;AACzB,MAAA,MAAA,SAAeA,eAAM,SAAe,CAAA;AAAA,EAwBvD,YAAY,KAAY,EAAA;AACtB,IAAA,KAAA,CAAM,KAAK,CAAA;AAAA;AACb,EACA,iBA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A,GAAY,EAAK,GAAA,CAAA;AAAA,IAC5C,aAAe,EAAA,KAAA;AAAA,IACf,UAAY,EAAA;AAAA,GACd;AAAA,EAEA,IAAM,EAAA;AAAA,IACJ,eAAiB,EAAA,aAAA;AAAA,IACjB,KAAO,EAAA;AAAA,GACT;AAAA,EAEA,QAAU,EAAA;AAAA,IACR,aAAe,EAAA;AAAA,GACjB;AAAA,EACA,UAAY,EAAA;AAAA,IACV,YAAc,EAAA,CAAA;AAAA,IACd,UAAY,EAAA,CAAA;AAAA,IACZ,WAAa,EAAA;AAAA;AAEjB,CAAC,CAAA;AAMD,MAAA,CAAO,YAAe,GAAA;AAAA,EACpB,gBAAgB,EAAC;AAAA,EACjB,WAAa,EAAA,IAAA;AAAA,EACb,kBAAoB,EAAA,IAAA;AAAA,EACpB,iBAAmB,EAAA,IAAA;AAAA,EACnB,gBAAkB,EAAA,IAAA;AAAA,EAClB,UAAY,EAAA,IAAA;AAAA,EACZ,cAAgB,EAAA;AAAA,IACd,IAAM,EAAA,IAAA;AAAA,IACN,SAAW,EAAA,IAAA;AAAA,IACX,KAAO,EAAA;AAAA,GACT;AAAA,EACA,aAAa,EAAC;AAAA,EACd,iBAAiB,EAAC;AAAA,EAClB,gBAAgB,EAAC;AAAA,EACjB,cAAc,EAAC;AAAA,EACf,WAAW,EAAC;AAAA,EACZ,sBAAsB,EAAC;AAAA,EACvB,0BAA0B,EAAC;AAAA,EAC3B,iBAAmB,EAAA,KAAA;AAAA,EACnB,cAAA,EAAgB,CAAC,GAAA,EAAU,CAAe,KAAA;AAC5C,CAAA"}
|
|
1
|
+
{"version":3,"file":"SlackBubble.js","sources":["../../../../../src/screens/inbox/components/SlackMessageContainer/SlackBubble.tsx"],"sourcesContent":["/* eslint-disable no-underscore-dangle, no-use-before-define */\nimport React from 'react';\nimport { Text, StyleSheet, TouchableOpacity, TouchableHighlight, View, Platform, Dimensions } from 'react-native';\n\nimport { MessageText, MessageImage, Time, utils } from 'react-native-gifted-chat';\nimport CachedImage from '../CachedImage';\nconst { isSameUser, isSameDay } = utils;\nconst windowWidth = Dimensions.get('window').width;\nconst windowHeight = Dimensions.get('window').height;\n\nexport default class Bubble extends React.Component<any> {\n static defaultProps: {\n touchableProps: {};\n onLongPress: null;\n renderMessageImage: null;\n renderMessageText: null;\n renderCustomView: null;\n renderTime: null;\n currentMessage: { text: null; createdAt: null; image: null };\n nextMessage: {};\n previousMessage: {};\n containerStyle: {};\n wrapperStyle: {};\n tickStyle: {};\n containerToNextStyle: {};\n containerToPreviousStyle: {};\n isShowImageViewer: false;\n setImageViewer: (obj: any, v: boolean) => void;\n };\n static propTypes: any;\n constructor(props: any) {\n super(props);\n }\n\n renderMessageText() {\n if (this.props.currentMessage.text) {\n const { containerStyle, wrapperStyle, messageTextStyle, ...messageTextProps } = this.props;\n if (this.props.renderMessageText) {\n return this.props.renderMessageText(messageTextProps);\n }\n return (\n <MessageText\n {...messageTextProps}\n textStyle={{\n left: [\n styles.standardFont,\n styles.slackMessageText,\n messageTextProps.textStyle,\n messageTextStyle,\n ],\n }}\n />\n );\n }\n return null;\n }\n\n renderMessageImage() {\n const { currentMessage, containerStyle, wrapperStyle, ...messageImageProps } = this.props;\n\n // Check if we have multiple images\n if (currentMessage.images && Array.isArray(currentMessage.images) && currentMessage.images.length > 0) {\n // Filter out any invalid or empty image URLs first\n const validImages = currentMessage.images.filter((url) => url && typeof url === 'string');\n\n // If no valid images after filtering, don't render anything\n if (validImages.length === 0) {\n return null;\n }\n\n // Render multiple images in a scrollable horizontal row\n return (\n <View style={{ marginVertical: 0 }}>\n <View\n style={{\n flexDirection: 'row',\n flexWrap: 'wrap',\n gap: 8,\n }}\n >\n {validImages.map((imageUrl, index) => {\n // Check if this is a local image\n const isLocalImage =\n imageUrl.startsWith('file:') ||\n imageUrl.startsWith('data:') ||\n imageUrl.startsWith('content:') ||\n (!imageUrl.startsWith('http://') && !imageUrl.startsWith('https://'));\n\n const imageSize =\n validImages.length === 1\n ? { width: windowWidth * 0.6, height: windowWidth * 0.4 }\n : { width: windowWidth * 0.3, height: windowWidth * 0.3 };\n\n // Show upload indicator if this message is uploading\n const isUploading = currentMessage.isUploading;\n\n return (\n <TouchableHighlight\n key={`image-${index}-${currentMessage._id}`}\n underlayColor={'transparent'}\n onPress={() => {\n // Don't allow viewing while uploading\n if (isUploading) return;\n\n // Create a message-like object with this image for the viewer\n const imageObject = {\n _id: `${currentMessage._id}-img-${index}`,\n image: imageUrl,\n };\n this.props.setImageViewer(imageObject, true);\n }}\n >\n <View\n style={{\n ...imageSize,\n maxHeight: 200,\n borderRadius: 8,\n overflow: 'hidden',\n borderWidth: 1,\n borderColor: '#e0e0e0',\n backgroundColor: '#f7f7f7',\n }}\n >\n {isLocalImage ? (\n // For local images, use direct Image component with no loading state\n <View style={{ width: '100%', height: '100%' }}>\n <MessageImage\n {...messageImageProps}\n currentMessage={{ ...currentMessage, image: imageUrl }}\n imageStyle={{\n width: '100%',\n height: '100%',\n borderRadius: 8,\n }}\n />\n\n {/* Show upload indicator if needed */}\n {isUploading && (\n <View\n style={{\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n backgroundColor: 'rgba(0,0,0,0.2)',\n justifyContent: 'center',\n alignItems: 'center',\n }}\n >\n <Text style={{ color: 'white', fontWeight: 'bold' }}>\n Uploading...\n </Text>\n </View>\n )}\n </View>\n ) : (\n // For remote images, use CachedImage with loading placeholder\n <CachedImage\n style={[styles.slackImage, { width: '100%', height: '100%' }]}\n cacheKey={`${currentMessage._id}-img-${index}-slack-bubble-imageKey`}\n source={{\n uri: imageUrl,\n expiresIn: 86400,\n }}\n resizeMode={'cover'}\n alt={'image'}\n placeholderContent={\n <View\n style={[\n styles.slackImage,\n {\n width: '100%',\n height: '100%',\n backgroundColor: '#e1e1e1',\n justifyContent: 'center',\n alignItems: 'center',\n borderRadius: 8,\n },\n ]}\n >\n <Text>{isUploading ? 'Uploading...' : 'Loading...'}</Text>\n </View>\n }\n />\n )}\n </View>\n </TouchableHighlight>\n );\n })}\n </View>\n </View>\n );\n }\n\n // Fall back to single image rendering if no images array\n if (currentMessage.image) {\n if (this.props.renderMessageImage) {\n return this.props.renderMessageImage(messageImageProps);\n }\n const { image, _id } = currentMessage;\n\n // Add validation for image URL\n if (!image || typeof image !== 'string') {\n return null;\n }\n\n // Check if this is a local image (from device camera/library)\n const isLocalImage =\n image.startsWith('file:') ||\n image.startsWith('data:') ||\n image.startsWith('content:') ||\n // Check if the image is a pendingUpload by checking if it doesn't start with http/https\n (!image.startsWith('http://') && !image.startsWith('https://'));\n\n // Check uploading state\n const isUploading = currentMessage.isUploading;\n\n // Class components can't use hooks like useMemo\n // Directly render the CachedImage instead\n return (\n <TouchableHighlight\n underlayColor={'transparent'}\n style={{ width: '100%', marginVertical: 0 }}\n onPress={() => {\n // Don't allow viewing while uploading\n if (isUploading) return;\n this.props.setImageViewer(currentMessage, true);\n }}\n >\n <View\n style={{\n width: windowWidth * 0.6, // 60% of screen width\n height: windowWidth * 0.4, // Maintain aspect ratio\n maxHeight: 200,\n borderRadius: 8,\n overflow: 'hidden',\n borderWidth: 1,\n borderColor: '#e0e0e0',\n backgroundColor: '#f7f7f7',\n }}\n >\n {isLocalImage ? (\n // For local images, use direct Image component with no loading state\n <View style={{ width: '100%', height: '100%', position: 'relative' }}>\n <MessageImage\n {...messageImageProps}\n imageStyle={{\n width: '100%',\n height: '100%',\n borderRadius: 8,\n }}\n />\n\n {/* Show upload indicator if needed */}\n {isUploading && (\n <View\n style={{\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n backgroundColor: 'rgba(0,0,0,0.2)',\n justifyContent: 'center',\n alignItems: 'center',\n }}\n >\n <Text style={{ color: 'white', fontWeight: 'bold' }}>Uploading...</Text>\n </View>\n )}\n </View>\n ) : (\n // For remote images, use CachedImage with loading placeholder\n <CachedImage\n style={[styles.slackImage, { width: '100%', height: '100%' }]}\n cacheKey={`${_id}-slack-bubble-imageKey`}\n source={{\n uri: image,\n expiresIn: 86400,\n }}\n resizeMode={'cover'}\n alt={'image'}\n placeholderContent={\n <View\n style={[\n styles.slackImage,\n {\n width: '100%',\n height: '100%',\n backgroundColor: '#e1e1e1',\n justifyContent: 'center',\n alignItems: 'center',\n borderRadius: 8,\n },\n ]}\n >\n <Text>{isUploading ? 'Uploading...' : 'Loading...'}</Text>\n </View>\n }\n />\n )}\n </View>\n </TouchableHighlight>\n );\n }\n\n return null;\n }\n\n renderTicks() {\n const { currentMessage } = this.props;\n if (this.props.renderTicks) {\n return this.props.renderTicks(currentMessage);\n }\n if (currentMessage.user._id !== this.props.user._id) {\n return null;\n }\n if (currentMessage.sent || currentMessage.received) {\n return (\n <View style={[styles.headerItem, styles.tickView]}>\n {currentMessage.sent && (\n <Text style={[styles.standardFont, styles.tick, this.props.tickStyle]}>✓</Text>\n )}\n {currentMessage.received && (\n <Text style={[styles.standardFont, styles.tick, this.props.tickStyle]}>✓</Text>\n )}\n </View>\n );\n }\n return null;\n }\n\n renderUsername() {\n const username = this.props.currentMessage.user.name;\n if (username) {\n const { containerStyle, wrapperStyle, ...usernameProps } = this.props;\n if (this.props.renderUsername) {\n return this.props.renderUsername(usernameProps);\n }\n return (\n <Text style={[styles.standardFont, styles.headerItem, styles.username, this.props.usernameStyle]}>\n {username}\n </Text>\n );\n }\n return null;\n }\n\n renderTime() {\n if (this.props.currentMessage.createdAt) {\n const { containerStyle, wrapperStyle, ...timeProps }: any = this.props;\n if (this.props.renderTime) {\n return this.props.renderTime(timeProps);\n }\n return (\n <Time\n {...timeProps}\n containerStyle={{ left: [styles.timeContainer] }}\n textStyle={{\n left: [styles.standardFont, styles.headerItem, styles.time, timeProps.textStyle],\n }}\n />\n );\n }\n return null;\n }\n\n renderCustomView() {\n if (this.props.renderCustomView) {\n return this.props.renderCustomView(this.props);\n }\n return null;\n }\n\n render() {\n const isSameThread =\n isSameUser(this.props.currentMessage, this.props.previousMessage) &&\n isSameDay(this.props.currentMessage, this.props.previousMessage);\n\n const messageHeader = isSameThread ? null : (\n <View style={styles.headerView}>\n {this.renderUsername()}\n {this.renderTime()}\n {this.renderTicks()}\n </View>\n );\n\n return (\n <View style={[styles.container, this.props.containerStyle]}>\n <TouchableHighlight\n style={{ width: '100%' }}\n // underlayColor={'#c0c0c0'}\n underlayColor={'transparent'}\n disabled={true}\n accessibilityTraits=\"text\"\n {...this.props.touchableProps}\n >\n <View style={[styles.wrapper, this.props.wrapperStyle]}>\n <View>\n {this.renderCustomView()}\n {messageHeader}\n {this.renderMessageImage()}\n {this.renderMessageText()}\n </View>\n </View>\n </TouchableHighlight>\n </View>\n );\n }\n}\n\n// Note: Everything is forced to be \"left\" positioned with this component.\n// The \"right\" position is only used in the default Bubble.\nconst styles = StyleSheet.create({\n standardFont: {\n fontSize: 15,\n },\n slackMessageText: {\n marginLeft: 0,\n marginRight: 0,\n },\n container: {\n flex: 1,\n alignItems: 'flex-start',\n },\n wrapper: {\n marginRight: 60,\n minHeight: 20,\n justifyContent: 'flex-start',\n },\n username: {\n fontWeight: 'bold',\n top: 0,\n paddingTop: 0,\n marginTop: 0,\n },\n time: {\n textAlign: 'left',\n fontSize: 12,\n },\n timeContainer: {\n marginLeft: 0,\n marginRight: 0,\n marginBottom: 0,\n },\n headerItem: {\n marginRight: 10,\n },\n headerView: {\n // Try to align it better with the avatar on Android.\n marginTop: Platform.OS === 'android' ? -2 : 0,\n flexDirection: 'row',\n alignItems: 'baseline',\n },\n /* eslint-disable react-native/no-color-literals */\n tick: {\n backgroundColor: 'transparent',\n color: 'white',\n },\n /* eslint-enable react-native/no-color-literals */\n tickView: {\n flexDirection: 'row',\n },\n slackImage: {\n borderRadius: 3,\n marginLeft: 8,\n marginRight: 0,\n },\n});\n\n// Bubble.contextTypes = {\n// actionSheet: PropTypes.func,\n// };\n\nBubble.defaultProps = {\n touchableProps: {},\n onLongPress: null,\n renderMessageImage: null,\n renderMessageText: null,\n renderCustomView: null,\n renderTime: null,\n currentMessage: {\n text: null,\n createdAt: null,\n image: null,\n },\n nextMessage: {},\n previousMessage: {},\n containerStyle: {},\n wrapperStyle: {},\n tickStyle: {},\n containerToNextStyle: {},\n containerToPreviousStyle: {},\n isShowImageViewer: false,\n setImageViewer: (obj: any, v: boolean) => null,\n};\n"],"names":["React"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,MAAM;AAAA,EACJ,UAAA;AAAA,EACA;AACF,CAAA,GAAI,KAAA;AACJ,MAAM,WAAA,GAAc,UAAA,CAAW,GAAA,CAAI,QAAQ,CAAA,CAAE,KAAA;AACxB,UAAA,CAAW,GAAA,CAAI,QAAQ,CAAA,CAAE;AAC9C,MAAqB,MAAA,SAAeA,eAAM,SAAA,CAAe;AAAA,EAwBvD,YAAY,KAAA,EAAY;AACtB,IAAA,KAAA,CAAM,KAAK,CAAA;AAAA,EACb;AAAA,EACA,iBAAA,GAAoB;AAClB,IAAA,IAAI,IAAA,CAAK,KAAA,CAAM,cAAA,CAAe,IAAA,EAAM;AAClC,MAAA,MAKI,UAAK,KAAA,EAJP;AAAA,QAAA,cAAA;AAAA,QACA,YAAA;AAAA,QACA;AAAA,OA3CR,GA6CU,EAAA,EADC,gBAAA,GAAA,SAAA,CACD,EAAA,EADC;AAAA,QAHH,gBAAA;AAAA,QACA,cAAA;AAAA,QACA;AAAA,OAAA,CAAA;AAGF,MAAA,IAAI,IAAA,CAAK,MAAM,iBAAA,EAAmB;AAChC,QAAA,OAAO,IAAA,CAAK,KAAA,CAAM,iBAAA,CAAkB,gBAAgB,CAAA;AAAA,MACtD;AACA,MAAA,uBAAOA,cAAA,CAAA,aAAA,CAAC,WAAA,EAAA,aAAA,CAAA,cAAA,CAAA,EAAA,EAAgB,gBAAA,CAAA,EAAhB,EAAkC,SAAA,EAAW;AAAA,QACnD,IAAA,EAAM,CAAC,MAAA,CAAO,YAAA,EAAc,OAAO,gBAAA,EAAkB,gBAAA,CAAiB,WAAW,gBAAgB;AAAA,OACnG,EAAA,CAAG,CAAA;AAAA,IACL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gB,EAAC;AAAA,EACjB,cAAc,EAAC;AAAA,EACf,WAAW,EAAC;AAAA,EACZ,sBAAsB,EAAC;AAAA,EACvB,0BAA0B,EAAC;AAAA,EAC3B,iBAAA,EAAmB,KAAA;AAAA,EACnB,cAAA,EAAgB,CAAC,GAAA,EAAU,CAAA,KAAe;AAC5C,CAAA"}
|
|
@@ -29,10 +29,7 @@ var __objRest = (source, exclude) => {
|
|
|
29
29
|
}
|
|
30
30
|
return target;
|
|
31
31
|
};
|
|
32
|
-
var __publicField = (obj, key, value) =>
|
|
33
|
-
__defNormalProp(obj, key + "" , value);
|
|
34
|
-
return value;
|
|
35
|
-
};
|
|
32
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, key + "" , value);
|
|
36
33
|
const {
|
|
37
34
|
isSameUser,
|
|
38
35
|
isSameDay
|
|
@@ -95,9 +92,11 @@ const styles = StyleSheet.create({
|
|
|
95
92
|
marginRight: 0
|
|
96
93
|
},
|
|
97
94
|
slackAvatar: {
|
|
95
|
+
// The bottom should roughly line up with the first line of message text.
|
|
98
96
|
height: 40,
|
|
99
97
|
width: 40,
|
|
100
98
|
borderRadius: 3,
|
|
99
|
+
// marginTop: 0,
|
|
101
100
|
marginTop: 1
|
|
102
101
|
}
|
|
103
102
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SlackMessage.js","sources":["../../../../../src/screens/inbox/components/SlackMessageContainer/SlackMessage.tsx"],"sourcesContent":["/* eslint-disable no-underscore-dangle, no-use-before-define */\n\nimport PropTypes from 'prop-types';\nimport React from 'react';\nimport { View, StyleSheet } from 'react-native';\n\nimport { Day, utils } from 'react-native-gifted-chat';\nimport { Avatar, AvatarFallbackText, AvatarImage } from '@admin-layout/gluestack-ui-mobile';\nimport Bubble from './SlackBubble';\n\nconst { isSameUser, isSameDay } = utils;\n\nexport default class Message extends React.Component<any> {\n static defaultProps: {\n renderAvatar: undefined;\n renderBubble: null;\n renderDay: null;\n currentMessage: {};\n nextMessage: {};\n previousMessage: {};\n user: {};\n containerStyle: {};\n isShowImageViewer: false;\n setImageViewer: (obj: any, v: boolean) => void;\n };\n getInnerComponentProps() {\n const { containerStyle, ...props } = this.props;\n return {\n ...props,\n position: 'left',\n isSameUser,\n isSameDay,\n };\n }\n\n renderDay() {\n if (this.props.currentMessage.createdAt) {\n const dayProps = this.getInnerComponentProps();\n if (this.props.renderDay) {\n return this.props.renderDay(dayProps);\n }\n return <Day {...dayProps} />;\n }\n return null;\n }\n\n renderBubble() {\n const bubbleProps = this.getInnerComponentProps();\n if (this.props.renderBubble) {\n return this.props.renderBubble(bubbleProps);\n }\n return (\n <Bubble\n {...bubbleProps}\n isShowImageViewer={this.props.isShowImageViewer}\n setImageViewer={this.props.setImageViewer}\n />\n );\n }\n\n renderAvatar() {\n let extraStyle: any;\n //new param added\n let isSameUserAndSameDay: boolean = false;\n if (\n isSameUser(this.props.currentMessage, this.props.previousMessage) &&\n isSameDay(this.props.currentMessage, this.props.previousMessage)\n ) {\n // Set the invisible avatar height to 0, but keep the width, padding, etc.\n extraStyle = { height: 0 };\n isSameUserAndSameDay = true;\n }\n\n const avatarProps: any = this.getInnerComponentProps();\n\n return (\n <Avatar size={'sm'} className=\"bg-transparent rounded-none mr-2\">\n <AvatarFallbackText>\n {isSameUserAndSameDay ? '' : avatarProps?.currentMessage?.user?.name[0]}\n </AvatarFallbackText>\n {!isSameUserAndSameDay && avatarProps?.currentMessage?.user?.avatar && (\n <AvatarImage\n alt=\"image\"\n style={{ ...styles.slackAvatar, ...avatarProps.imageStyle }}\n source={{\n uri: avatarProps?.currentMessage?.user?.avatar,\n }}\n />\n )}\n </Avatar>\n // <Avatar\n // {...avatarProps}\n // showAvatarForEveryMessage={true}\n // imageStyle={{\n // left: [styles.slackAvatar, avatarProps.imageStyle, extraStyle],\n // }}\n // />\n );\n }\n\n render() {\n const marginBottom = isSameUser(this.props.currentMessage, this.props.nextMessage) ? 2 : 10;\n\n return (\n <View>\n {this.renderDay()}\n <View style={[styles.container, { marginBottom }, this.props.containerStyle]}>\n {this.renderAvatar()}\n {this.renderBubble()}\n </View>\n </View>\n );\n }\n}\n\nconst styles = StyleSheet.create({\n container: {\n flexDirection: 'row',\n alignItems: 'flex-start',\n justifyContent: 'flex-start',\n marginLeft: 8,\n marginRight: 0,\n },\n slackAvatar: {\n // The bottom should roughly line up with the first line of message text.\n height: 40,\n width: 40,\n borderRadius: 3,\n // marginTop: 0,\n marginTop: 1,\n },\n});\n\nMessage.defaultProps = {\n renderAvatar: undefined,\n renderBubble: null,\n renderDay: null,\n currentMessage: {},\n nextMessage: {},\n previousMessage: {},\n user: {},\n containerStyle: {},\n isShowImageViewer: false,\n setImageViewer: (obj: any, v: boolean) => null,\n};\n"],"names":["React"],"mappings":"
|
|
1
|
+
{"version":3,"file":"SlackMessage.js","sources":["../../../../../src/screens/inbox/components/SlackMessageContainer/SlackMessage.tsx"],"sourcesContent":["/* eslint-disable no-underscore-dangle, no-use-before-define */\n\nimport PropTypes from 'prop-types';\nimport React from 'react';\nimport { View, StyleSheet } from 'react-native';\n\nimport { Day, utils } from 'react-native-gifted-chat';\nimport { Avatar, AvatarFallbackText, AvatarImage } from '@admin-layout/gluestack-ui-mobile';\nimport Bubble from './SlackBubble';\n\nconst { isSameUser, isSameDay } = utils;\n\nexport default class Message extends React.Component<any> {\n static defaultProps: {\n renderAvatar: undefined;\n renderBubble: null;\n renderDay: null;\n currentMessage: {};\n nextMessage: {};\n previousMessage: {};\n user: {};\n containerStyle: {};\n isShowImageViewer: false;\n setImageViewer: (obj: any, v: boolean) => void;\n };\n getInnerComponentProps() {\n const { containerStyle, ...props } = this.props;\n return {\n ...props,\n position: 'left',\n isSameUser,\n isSameDay,\n };\n }\n\n renderDay() {\n if (this.props.currentMessage.createdAt) {\n const dayProps = this.getInnerComponentProps();\n if (this.props.renderDay) {\n return this.props.renderDay(dayProps);\n }\n return <Day {...dayProps} />;\n }\n return null;\n }\n\n renderBubble() {\n const bubbleProps = this.getInnerComponentProps();\n if (this.props.renderBubble) {\n return this.props.renderBubble(bubbleProps);\n }\n return (\n <Bubble\n {...bubbleProps}\n isShowImageViewer={this.props.isShowImageViewer}\n setImageViewer={this.props.setImageViewer}\n />\n );\n }\n\n renderAvatar() {\n let extraStyle: any;\n //new param added\n let isSameUserAndSameDay: boolean = false;\n if (\n isSameUser(this.props.currentMessage, this.props.previousMessage) &&\n isSameDay(this.props.currentMessage, this.props.previousMessage)\n ) {\n // Set the invisible avatar height to 0, but keep the width, padding, etc.\n extraStyle = { height: 0 };\n isSameUserAndSameDay = true;\n }\n\n const avatarProps: any = this.getInnerComponentProps();\n\n return (\n <Avatar size={'sm'} className=\"bg-transparent rounded-none mr-2\">\n <AvatarFallbackText>\n {isSameUserAndSameDay ? '' : avatarProps?.currentMessage?.user?.name[0]}\n </AvatarFallbackText>\n {!isSameUserAndSameDay && avatarProps?.currentMessage?.user?.avatar && (\n <AvatarImage\n alt=\"image\"\n style={{ ...styles.slackAvatar, ...avatarProps.imageStyle }}\n source={{\n uri: avatarProps?.currentMessage?.user?.avatar,\n }}\n />\n )}\n </Avatar>\n // <Avatar\n // {...avatarProps}\n // showAvatarForEveryMessage={true}\n // imageStyle={{\n // left: [styles.slackAvatar, avatarProps.imageStyle, extraStyle],\n // }}\n // />\n );\n }\n\n render() {\n const marginBottom = isSameUser(this.props.currentMessage, this.props.nextMessage) ? 2 : 10;\n\n return (\n <View>\n {this.renderDay()}\n <View style={[styles.container, { marginBottom }, this.props.containerStyle]}>\n {this.renderAvatar()}\n {this.renderBubble()}\n </View>\n </View>\n );\n }\n}\n\nconst styles = StyleSheet.create({\n container: {\n flexDirection: 'row',\n alignItems: 'flex-start',\n justifyContent: 'flex-start',\n marginLeft: 8,\n marginRight: 0,\n },\n slackAvatar: {\n // The bottom should roughly line up with the first line of message text.\n height: 40,\n width: 40,\n borderRadius: 3,\n // marginTop: 0,\n marginTop: 1,\n },\n});\n\nMessage.defaultProps = {\n renderAvatar: undefined,\n renderBubble: null,\n renderDay: null,\n currentMessage: {},\n nextMessage: {},\n previousMessage: {},\n user: {},\n containerStyle: {},\n isShowImageViewer: false,\n setImageViewer: (obj: any, v: boolean) => null,\n};\n"],"names":["React"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,MAAM;AAAA,EACJ,UAAA;AAAA,EACA;AACF,CAAA,GAAI,KAAA;AACJ,MAAqB,OAAA,SAAgBA,eAAM,SAAA,CAAe;AAAA,EAaxD,sBAAA,GAAyB;AACvB,IAAA,MAGI,UAAK,KAAA,EAFP;AAAA,MAAA;AAAA,KA3BN,GA6BQ,EAAA,EADC,KAAA,GAAA,SAAA,CACD,EAAA,EADC;AAAA,MADH;AAAA,KAAA,CAAA;AAGF,IAAA,OAAO,iCACF,KAAA,CAAA,EADE;AAAA,MAEL,QAAA,EAAU,MAAA;AAAA,MACV,UAAA;AAAA,MACA;AAAA,KACF,CAAA;AAAA,EACF;AAAA,EACA,SAAA,GAAY;AACV,IAAA,IAAI,IAAA,CAAK,KAAA,CAAM,cAAA,CAAe,SAAA,EAAW;AACvC,MAAA,MAAM,QAAA,GAAW,KAAK,sBAAA,EAAuB;AAC7C,MAAA,IAAI,IAAA,CAAK,MAAM,SAAA,EAAW;AACxB,QAAA,OAAO,IAAA,CAAK,KAAA,CAAM,SAAA,CAAU,QAAQ,CAAA;AAAA,MACtC;AACA,MAAA,uBAAOA,cAAA,CAAA,aAAA,CAAC,wBAAQ,QAAA,CAAU,CAAA;AAAA,IAC5B;AACA,IAAA,OAAO,IAAA;AAAA,EACT;AAAA,EACA,YAAA,GAAe;AACb,IAAA,MAAM,WAAA,GAAc,KAAK,sBAAA,EAAuB;AAChD,IAAA,IAAI,IAAA,CAAK,MAAM,YAAA,EAAc;AAC3B,MAAA,OAAO,IAAA,CAAK,KAAA,CAAM,YAAA,CAAa,WAAW,CAAA;AAAA,IAC5C;AACA,IAAA,uBAAOA,cAAA,CAAA,aAAA,CAAC,MAAA,EAAA,aAAA,CAAA,cAA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AW,IAAA;AAAA,EACX,gBAAgB,EAAC;AAAA,EACjB,aAAa,EAAC;AAAA,EACd,iBAAiB,EAAC;AAAA,EAClB,MAAM,EAAC;AAAA,EACP,gBAAgB,EAAC;AAAA,EACjB,iBAAA,EAAmB,KAAA;AAAA,EACnB,cAAA,EAAgB,CAAC,GAAA,EAAU,CAAA,KAAe;AAC5C,CAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {useEffect}from'react';function SubscriptionHandler({
|
|
2
|
+
subscribeToMore,
|
|
3
|
+
document,
|
|
4
|
+
variables,
|
|
5
|
+
updateQuery,
|
|
6
|
+
onError,
|
|
7
|
+
enabled = true
|
|
8
|
+
}) {
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
if (!enabled) return;
|
|
11
|
+
const unsubscribe = subscribeToMore({
|
|
12
|
+
document,
|
|
13
|
+
variables,
|
|
14
|
+
updateQuery,
|
|
15
|
+
onError
|
|
16
|
+
});
|
|
17
|
+
return () => {
|
|
18
|
+
if (unsubscribe && typeof unsubscribe === "function") unsubscribe();
|
|
19
|
+
};
|
|
20
|
+
}, [subscribeToMore, document, JSON.stringify(variables), updateQuery, onError, enabled]);
|
|
21
|
+
return null;
|
|
22
|
+
}export{SubscriptionHandler};//# sourceMappingURL=SubscriptionHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SubscriptionHandler.js","sources":["../../../../src/screens/inbox/components/SubscriptionHandler.tsx"],"sourcesContent":["import { useEffect } from 'react';\n\n/**\n * Shared SubscriptionHandler for Apollo subscribeToMore\n *\n * @param subscribeToMore - Apollo subscribeToMore function\n * @param document - GraphQL subscription document\n * @param variables - Variables for the subscription\n * @param updateQuery - Apollo updateQuery function\n * @param onError - Optional error handler\n * @param enabled - If false, disables the subscription\n */\nexport function SubscriptionHandler({\n subscribeToMore,\n document,\n variables,\n updateQuery,\n onError,\n enabled = true,\n}: {\n subscribeToMore: Function;\n document: any;\n variables: Record<string, any>;\n updateQuery: (prev: any, { subscriptionData }: any) => any;\n onError?: (error: any) => void;\n enabled?: boolean;\n}) {\n useEffect(() => {\n if (!enabled) return;\n const unsubscribe = subscribeToMore({\n document,\n variables,\n updateQuery,\n onError,\n });\n return () => {\n if (unsubscribe && typeof unsubscribe === 'function') unsubscribe();\n };\n }, [subscribeToMore, document, JSON.stringify(variables), updateQuery, onError, enabled]);\n return null;\n}\n"],"names":[],"mappings":"8BAYO,SAAS,mBAAA,CAAoB;AAAA,EAClC,eAAA;AAAA,EACA,QAAA;AAAA,EACA,SAAA;AAAA,EACA,WAAA;AAAA,EACA,OAAA;AAAA,EACA,OAAA,GAAU;AACZ,CAAA,EASG;AACD,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,CAAC,OAAA,EAAS;AACd,IAAA,MAAM,cAAc,eAAA,CAAgB;AAAA,MAClC,QAAA;AAAA,MACA,SAAA;AAAA,MACA,WAAA;AAAA,MACA;AAAA,KACD,CAAA;AACD,IAAA,OAAO,MAAM;AACX,MAAA,IAAI,WAAA,IAAe,OAAO,WAAA,KAAgB,UAAA,EAAY,WAAA,EAAY;AAAA,IACpE,CAAA;AAAA,EACF,CAAA,EAAG,CAAC,eAAA,EAAiB,QAAA,EAAU,IAAA,CAAK,SAAA,CAAU,SAAS,CAAA,EAAG,WAAA,EAAa,OAAA,EAAS,OAAO,CAAC,CAAA;AACxF,EAAA,OAAO,IAAA;AACT"}
|
|
@@ -1,54 +1,74 @@
|
|
|
1
|
-
import React__default
|
|
2
|
-
if (!value)
|
|
3
|
-
return "";
|
|
1
|
+
import React__default,{useMemo}from'react';import {Pressable,Box,VStack,Text,HStack,Avatar,AvatarFallbackText,AvatarImage,Link,LinkText,Button,ButtonText}from'@admin-layout/gluestack-ui-mobile';import {isToday,format}from'date-fns';import {startCase}from'lodash-es';import colors from'tailwindcss/colors';import {useSelector}from'react-redux';import {userSelector}from'@adminide-stack/user-auth0-client';const timeFormat = (value) => {
|
|
2
|
+
if (!value) return "";
|
|
4
3
|
let date = new Date(value);
|
|
5
|
-
if (isToday(date))
|
|
6
|
-
|
|
7
|
-
if (isYesterday(date))
|
|
8
|
-
return "Yesterday";
|
|
9
|
-
return format(new Date(value), "MMM dd, yyyy");
|
|
4
|
+
if (isToday(date)) return format(date, "h:mm a").toUpperCase();
|
|
5
|
+
return format(date, "MMM do").toUpperCase();
|
|
10
6
|
};
|
|
11
|
-
const ThreadViewItemComponent = function
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
7
|
+
const ThreadViewItemComponent = function ThreadViewItem2({
|
|
8
|
+
id,
|
|
9
|
+
post,
|
|
10
|
+
channel,
|
|
11
|
+
replies,
|
|
12
|
+
onPress,
|
|
13
|
+
channelId,
|
|
14
|
+
channelsDetail
|
|
17
15
|
}) {
|
|
18
|
-
var _a, _b;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}, [])
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
return null;
|
|
26
|
-
return thread == null ? void 0 : thread.replies;
|
|
27
|
-
}, [thread]);
|
|
28
|
-
if (!threadPostReply || (threadPostReply == null ? void 0 : threadPostReply.length) == 0) {
|
|
29
|
-
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null);
|
|
16
|
+
var _a, _b, _c, _d;
|
|
17
|
+
const currentUser = useSelector(userSelector);
|
|
18
|
+
const threadReplies = useMemo(() => {
|
|
19
|
+
return replies || [];
|
|
20
|
+
}, [replies]);
|
|
21
|
+
if (!threadReplies || threadReplies.length === 0) {
|
|
22
|
+
return null;
|
|
30
23
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
24
|
+
const lastReply = threadReplies[0];
|
|
25
|
+
const totalReplies = threadReplies.length;
|
|
26
|
+
const primaryUser = ((_a = channel == null ? void 0 : channel.users) == null ? void 0 : _a[0]) || (lastReply == null ? void 0 : lastReply.author);
|
|
27
|
+
(channel == null ? void 0 : channel.title) || `${(primaryUser == null ? void 0 : primaryUser.givenName) || ""} ${(primaryUser == null ? void 0 : primaryUser.familyName) || ""}`;
|
|
28
|
+
(_b = channel == null ? void 0 : channel.users) == null ? void 0 : _b.some((user) => user.id === (currentUser == null ? void 0 : currentUser.id));
|
|
29
|
+
return /* @__PURE__ */ React__default.createElement(Pressable, { onPress: () => onPress(channel == null ? void 0 : channel.id, "Thread", post == null ? void 0 : post.id), style: {
|
|
30
|
+
marginVertical: 5,
|
|
31
|
+
backgroundColor: "white",
|
|
32
|
+
borderRadius: 10,
|
|
33
|
+
paddingVertical: 5,
|
|
34
|
+
elevation: 1,
|
|
35
|
+
shadowColor: "#000",
|
|
36
|
+
shadowOffset: {
|
|
37
|
+
width: 0,
|
|
38
|
+
height: 1
|
|
39
|
+
},
|
|
40
|
+
shadowOpacity: 0.1,
|
|
41
|
+
shadowRadius: 2
|
|
42
|
+
} }, /* @__PURE__ */ React__default.createElement(Box, { className: "mb-3" }, /* @__PURE__ */ React__default.createElement(VStack, { space: "md" }, /* @__PURE__ */ React__default.createElement(Text, { className: "text-sm font-medium text-gray-600 px-4 pt-2" }, (_d = (_c = channel == null ? void 0 : channel.users) == null ? void 0 : _c.map((user) => (user == null ? void 0 : user.givenName) || (user == null ? void 0 : user.username))) == null ? void 0 : _d.join(", ")), threadReplies.slice(0, 3).map((reply, index) => {
|
|
43
|
+
var _a2, _b2, _c2, _d2, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
44
|
+
const previousReply = index > 0 ? threadReplies.slice(0, 3)[index - 1] : null;
|
|
45
|
+
const isConsecutiveReply = previousReply && ((_a2 = previousReply.author) == null ? void 0 : _a2.id) === ((_b2 = reply.author) == null ? void 0 : _b2.id);
|
|
46
|
+
return /* @__PURE__ */ React__default.createElement(HStack, { key: reply.id || index, space: "md", className: "px-4 py-1" }, !isConsecutiveReply ? /* @__PURE__ */ React__default.createElement(Avatar, { size: "md", style: {
|
|
47
|
+
width: 40,
|
|
48
|
+
height: 40,
|
|
49
|
+
backgroundColor: ((_c2 = reply == null ? void 0 : reply.author) == null ? void 0 : _c2.id) === (currentUser == null ? void 0 : currentUser.id) ? "#2EB67D" : "#E8A54A"
|
|
50
|
+
} }, /* @__PURE__ */ React__default.createElement(AvatarFallbackText, null, startCase(((_e = (_d2 = reply == null ? void 0 : reply.author) == null ? void 0 : _d2.username) == null ? void 0 : _e.charAt(0)) || "U")), ((_f = reply == null ? void 0 : reply.author) == null ? void 0 : _f.picture) && /* @__PURE__ */ React__default.createElement(AvatarImage, { alt: ((_g = reply == null ? void 0 : reply.author) == null ? void 0 : _g.username) || "User", source: {
|
|
51
|
+
uri: (_h = reply == null ? void 0 : reply.author) == null ? void 0 : _h.picture
|
|
52
|
+
} })) : /* @__PURE__ */ React__default.createElement(Box, { style: {
|
|
53
|
+
width: 40
|
|
54
|
+
} }), /* @__PURE__ */ React__default.createElement(VStack, { space: "xs", className: "flex-1" }, !isConsecutiveReply && /* @__PURE__ */ React__default.createElement(HStack, { space: "sm", className: "items-center" }, /* @__PURE__ */ React__default.createElement(Text, { className: "font-bold text-gray-900" }, ((_i = reply == null ? void 0 : reply.author) == null ? void 0 : _i.givenName) || ((_j = reply == null ? void 0 : reply.author) == null ? void 0 : _j.username) || "User"), /* @__PURE__ */ React__default.createElement(Text, { className: "text-xs text-gray-500" }, timeFormat(reply == null ? void 0 : reply.createdAt))), (reply == null ? void 0 : reply.message) && /* @__PURE__ */ React__default.createElement(Text, { color: colors.gray[700], numberOfLines: 2, className: "text-base" }, reply == null ? void 0 : reply.message, (reply == null ? void 0 : reply.edited) && /* @__PURE__ */ React__default.createElement(Text, { className: "text-xs text-gray-500" }, " (edited)")), reply.email && /* @__PURE__ */ React__default.createElement(Text, { className: "text-blue-500" }, reply.email), ((_l = (_k = reply == null ? void 0 : reply.files) == null ? void 0 : _k.data) == null ? void 0 : _l.length) > 0 && /* @__PURE__ */ React__default.createElement(HStack, { space: "sm", className: "my-1" }, (_n = (_m = reply == null ? void 0 : reply.files) == null ? void 0 : _m.data) == null ? void 0 : _n.map((file, fileIndex) => /* @__PURE__ */ React__default.createElement(Box, { key: fileIndex, className: "overflow-hidden", style: {
|
|
55
|
+
width: 80,
|
|
56
|
+
height: 80
|
|
57
|
+
} }, /* @__PURE__ */ React__default.createElement(AvatarImage, { alt: "attachment", className: "rounded-none border-none", style: {
|
|
58
|
+
width: "100%",
|
|
59
|
+
height: "100%"
|
|
37
60
|
}, source: {
|
|
38
|
-
uri:
|
|
39
|
-
} })))
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
color: "#000"
|
|
51
|
-
} }, "Reply"))));
|
|
52
|
-
})))))));
|
|
61
|
+
uri: file == null ? void 0 : file.url
|
|
62
|
+
} }))))));
|
|
63
|
+
}), totalReplies > 3 && /* @__PURE__ */ React__default.createElement(HStack, { className: "px-4 items-center", space: "sm" }, /* @__PURE__ */ React__default.createElement(Box, { style: {
|
|
64
|
+
width: 40
|
|
65
|
+
} }), /* @__PURE__ */ React__default.createElement(Link, { onPress: () => onPress(channel == null ? void 0 : channel.id, "Thread", post == null ? void 0 : post.id) }, /* @__PURE__ */ React__default.createElement(LinkText, { className: "text-blue-600 mt-1" }, totalReplies - 3, " more ", totalReplies - 3 === 1 ? "reply" : "replies"))), /* @__PURE__ */ React__default.createElement(Box, { className: "px-4 pb-2" }, /* @__PURE__ */ React__default.createElement(Button, { size: "sm", className: "self-start rounded-full", variant: "outline", style: {
|
|
66
|
+
borderColor: "#E2E8F0",
|
|
67
|
+
paddingHorizontal: 16,
|
|
68
|
+
paddingVertical: 6
|
|
69
|
+
}, onPress: () => onPress(channel == null ? void 0 : channel.id, "Thread", post == null ? void 0 : post.id) }, /* @__PURE__ */ React__default.createElement(ButtonText, { style: {
|
|
70
|
+
fontSize: 14,
|
|
71
|
+
color: colors.gray[800]
|
|
72
|
+
} }, "Reply"))))));
|
|
53
73
|
};
|
|
54
74
|
const ThreadViewItem = React__default.memo(ThreadViewItemComponent);export{ThreadViewItem,ThreadViewItemComponent};//# sourceMappingURL=ThreadsViewItem.js.map
|