@plusscommunities/pluss-core-app 8.0.27 → 8.0.28-beta.2

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 (210) hide show
  1. package/package.json +1 -1
  2. package/src/components/react-native-expo-image-cropper/ExpoImageManipulator.js +29 -26
  3. package/dist/module/actions/FollowerActions.js +0 -34
  4. package/dist/module/actions/FollowerActions.js.map +0 -1
  5. package/dist/module/actions/MediaActions.js +0 -29
  6. package/dist/module/actions/MediaActions.js.map +0 -1
  7. package/dist/module/actions/ResidentActions.js +0 -26
  8. package/dist/module/actions/ResidentActions.js.map +0 -1
  9. package/dist/module/actions/UserActions.js +0 -223
  10. package/dist/module/actions/UserActions.js.map +0 -1
  11. package/dist/module/actions/UserSettingsActions.js +0 -14
  12. package/dist/module/actions/UserSettingsActions.js.map +0 -1
  13. package/dist/module/actions/index.js +0 -6
  14. package/dist/module/actions/index.js.map +0 -1
  15. package/dist/module/actions/types.js +0 -17
  16. package/dist/module/actions/types.js.map +0 -1
  17. package/dist/module/apis/analyticsActions.js +0 -20
  18. package/dist/module/apis/analyticsActions.js.map +0 -1
  19. package/dist/module/apis/contactActions.js +0 -27
  20. package/dist/module/apis/contactActions.js.map +0 -1
  21. package/dist/module/apis/eventActions.js +0 -161
  22. package/dist/module/apis/eventActions.js.map +0 -1
  23. package/dist/module/apis/fileActions.js +0 -93
  24. package/dist/module/apis/fileActions.js.map +0 -1
  25. package/dist/module/apis/followerActions.js +0 -38
  26. package/dist/module/apis/followerActions.js.map +0 -1
  27. package/dist/module/apis/index.js +0 -13
  28. package/dist/module/apis/index.js.map +0 -1
  29. package/dist/module/apis/notificationActions.js +0 -60
  30. package/dist/module/apis/notificationActions.js.map +0 -1
  31. package/dist/module/apis/profileActions.js +0 -14
  32. package/dist/module/apis/profileActions.js.map +0 -1
  33. package/dist/module/apis/reactionActions.js +0 -76
  34. package/dist/module/apis/reactionActions.js.map +0 -1
  35. package/dist/module/apis/settingActions.js +0 -22
  36. package/dist/module/apis/settingActions.js.map +0 -1
  37. package/dist/module/apis/stringActions.js +0 -30
  38. package/dist/module/apis/stringActions.js.map +0 -1
  39. package/dist/module/apis/typeActions.js +0 -15
  40. package/dist/module/apis/typeActions.js.map +0 -1
  41. package/dist/module/apis/userActions.js +0 -104
  42. package/dist/module/apis/userActions.js.map +0 -1
  43. package/dist/module/assets/icons/fontawesome/fa-brands-400.ttf +0 -0
  44. package/dist/module/assets/icons/fontawesome/fa-light-300.ttf +0 -0
  45. package/dist/module/assets/icons/fontawesome/fa-regular-400.ttf +0 -0
  46. package/dist/module/assets/icons/fontawesome/fa-solid-900.ttf +0 -0
  47. package/dist/module/assets/icons/fontawesome/fa-thin-100.ttf +0 -0
  48. package/dist/module/assets/icons/fontawesome/fa7-glyphmap.json +0 -4205
  49. package/dist/module/assets/icons/reactions/heart.png +0 -0
  50. package/dist/module/assets/icons/reactions/party.png +0 -0
  51. package/dist/module/assets/icons/reactions/sad.png +0 -0
  52. package/dist/module/assets/icons/reactions/smile.png +0 -0
  53. package/dist/module/colours.js +0 -165
  54. package/dist/module/colours.js.map +0 -1
  55. package/dist/module/components/AddButton.js +0 -43
  56. package/dist/module/components/AddButton.js.map +0 -1
  57. package/dist/module/components/AddToCalendarButton.js +0 -225
  58. package/dist/module/components/AddToCalendarButton.js.map +0 -1
  59. package/dist/module/components/Attachment.js +0 -55
  60. package/dist/module/components/Attachment.js.map +0 -1
  61. package/dist/module/components/AudienceSelectorLauncher.js +0 -64
  62. package/dist/module/components/AudienceSelectorLauncher.js.map +0 -1
  63. package/dist/module/components/AudienceSelectorPage.js +0 -351
  64. package/dist/module/components/AudienceSelectorPage.js.map +0 -1
  65. package/dist/module/components/AutoOffsetImage.js +0 -184
  66. package/dist/module/components/AutoOffsetImage.js.map +0 -1
  67. package/dist/module/components/BackButton.js +0 -58
  68. package/dist/module/components/BackButton.js.map +0 -1
  69. package/dist/module/components/CalendarPopup.js +0 -126
  70. package/dist/module/components/CalendarPopup.js.map +0 -1
  71. package/dist/module/components/CategoryTabs.js +0 -155
  72. package/dist/module/components/CategoryTabs.js.map +0 -1
  73. package/dist/module/components/CommentReply.js +0 -334
  74. package/dist/module/components/CommentReply.js.map +0 -1
  75. package/dist/module/components/CommentSection.js +0 -823
  76. package/dist/module/components/CommentSection.js.map +0 -1
  77. package/dist/module/components/ConfirmPopup.js +0 -109
  78. package/dist/module/components/ConfirmPopup.js.map +0 -1
  79. package/dist/module/components/ConfirmationPopup.js +0 -72
  80. package/dist/module/components/ConfirmationPopup.js.map +0 -1
  81. package/dist/module/components/DocumentUploader.js +0 -253
  82. package/dist/module/components/DocumentUploader.js.map +0 -1
  83. package/dist/module/components/DropDownItem.js +0 -75
  84. package/dist/module/components/DropDownItem.js.map +0 -1
  85. package/dist/module/components/DropDownMenu.js +0 -41
  86. package/dist/module/components/DropDownMenu.js.map +0 -1
  87. package/dist/module/components/EmptyStateMain.js +0 -51
  88. package/dist/module/components/EmptyStateMain.js.map +0 -1
  89. package/dist/module/components/EmptyStateWidget.js +0 -48
  90. package/dist/module/components/EmptyStateWidget.js.map +0 -1
  91. package/dist/module/components/FontScaleButton.js +0 -37
  92. package/dist/module/components/FontScaleButton.js.map +0 -1
  93. package/dist/module/components/FontScalePopup.js +0 -76
  94. package/dist/module/components/FontScalePopup.js.map +0 -1
  95. package/dist/module/components/Forbidden.js +0 -58
  96. package/dist/module/components/Forbidden.js.map +0 -1
  97. package/dist/module/components/FormCard.js +0 -25
  98. package/dist/module/components/FormCard.js.map +0 -1
  99. package/dist/module/components/FormCardSection.js +0 -214
  100. package/dist/module/components/FormCardSection.js.map +0 -1
  101. package/dist/module/components/FormCardSectionOptionLauncher.js +0 -73
  102. package/dist/module/components/FormCardSectionOptionLauncher.js.map +0 -1
  103. package/dist/module/components/FormattedText.js +0 -133
  104. package/dist/module/components/FormattedText.js.map +0 -1
  105. package/dist/module/components/GenericInput.js +0 -151
  106. package/dist/module/components/GenericInput.js.map +0 -1
  107. package/dist/module/components/GenericInputSection.js +0 -173
  108. package/dist/module/components/GenericInputSection.js.map +0 -1
  109. package/dist/module/components/Header.js +0 -459
  110. package/dist/module/components/Header.js.map +0 -1
  111. package/dist/module/components/Icon.js +0 -109
  112. package/dist/module/components/Icon.js.map +0 -1
  113. package/dist/module/components/ImagePopup.js +0 -400
  114. package/dist/module/components/ImagePopup.js.map +0 -1
  115. package/dist/module/components/ImageUploadProgress.js +0 -69
  116. package/dist/module/components/ImageUploadProgress.js.map +0 -1
  117. package/dist/module/components/ImageUploader.js +0 -831
  118. package/dist/module/components/ImageUploader.js.map +0 -1
  119. package/dist/module/components/InlineButton.js +0 -66
  120. package/dist/module/components/InlineButton.js.map +0 -1
  121. package/dist/module/components/Input.js +0 -156
  122. package/dist/module/components/Input.js.map +0 -1
  123. package/dist/module/components/LoadingCircles.js +0 -219
  124. package/dist/module/components/LoadingCircles.js.map +0 -1
  125. package/dist/module/components/LoadingIndicator.js +0 -86
  126. package/dist/module/components/LoadingIndicator.js.map +0 -1
  127. package/dist/module/components/LoadingStateWidget.js +0 -46
  128. package/dist/module/components/LoadingStateWidget.js.map +0 -1
  129. package/dist/module/components/MediaPlayer.js +0 -407
  130. package/dist/module/components/MediaPlayer.js.map +0 -1
  131. package/dist/module/components/MiddlePopup.js +0 -49
  132. package/dist/module/components/MiddlePopup.js.map +0 -1
  133. package/dist/module/components/PDFPopup.js +0 -203
  134. package/dist/module/components/PDFPopup.js.map +0 -1
  135. package/dist/module/components/PlussChat.js +0 -1078
  136. package/dist/module/components/PlussChat.js.map +0 -1
  137. package/dist/module/components/PlussChatMessage.js +0 -299
  138. package/dist/module/components/PlussChatMessage.js.map +0 -1
  139. package/dist/module/components/PlussChatTime.js +0 -59
  140. package/dist/module/components/PlussChatTime.js.map +0 -1
  141. package/dist/module/components/Popup.js +0 -126
  142. package/dist/module/components/Popup.js.map +0 -1
  143. package/dist/module/components/PopupMenu.js +0 -120
  144. package/dist/module/components/PopupMenu.js.map +0 -1
  145. package/dist/module/components/PositionedImage.js +0 -313
  146. package/dist/module/components/PositionedImage.js.map +0 -1
  147. package/dist/module/components/ProfilePic.js +0 -105
  148. package/dist/module/components/ProfilePic.js.map +0 -1
  149. package/dist/module/components/RadioButton.js +0 -78
  150. package/dist/module/components/RadioButton.js.map +0 -1
  151. package/dist/module/components/Reaction.js +0 -117
  152. package/dist/module/components/Reaction.js.map +0 -1
  153. package/dist/module/components/Reactions.js +0 -71
  154. package/dist/module/components/Reactions.js.map +0 -1
  155. package/dist/module/components/SharingTools.js +0 -189
  156. package/dist/module/components/SharingTools.js.map +0 -1
  157. package/dist/module/components/Spinner.js +0 -22
  158. package/dist/module/components/Spinner.js.map +0 -1
  159. package/dist/module/components/StickyFooter.js +0 -34
  160. package/dist/module/components/StickyFooter.js.map +0 -1
  161. package/dist/module/components/Text.js +0 -57
  162. package/dist/module/components/Text.js.map +0 -1
  163. package/dist/module/components/TickIcon.js +0 -24
  164. package/dist/module/components/TickIcon.js.map +0 -1
  165. package/dist/module/components/Toggle.js +0 -66
  166. package/dist/module/components/Toggle.js.map +0 -1
  167. package/dist/module/components/TouchableSearchBar.js +0 -68
  168. package/dist/module/components/TouchableSearchBar.js.map +0 -1
  169. package/dist/module/components/UserListPopup.js +0 -136
  170. package/dist/module/components/UserListPopup.js.map +0 -1
  171. package/dist/module/components/UserListing.js +0 -268
  172. package/dist/module/components/UserListing.js.map +0 -1
  173. package/dist/module/components/VideoPopup.js +0 -113
  174. package/dist/module/components/VideoPopup.js.map +0 -1
  175. package/dist/module/components/WarningPopup.js +0 -85
  176. package/dist/module/components/WarningPopup.js.map +0 -1
  177. package/dist/module/components/expo-image-picker-multiple/ImageBrowser.js +0 -289
  178. package/dist/module/components/expo-image-picker-multiple/ImageBrowser.js.map +0 -1
  179. package/dist/module/components/expo-image-picker-multiple/ImageTile.js +0 -117
  180. package/dist/module/components/expo-image-picker-multiple/ImageTile.js.map +0 -1
  181. package/dist/module/components/index.js +0 -60
  182. package/dist/module/components/index.js.map +0 -1
  183. package/dist/module/components/react-native-expo-image-cropper/ExpoImageManipulator.js +0 -415
  184. package/dist/module/components/react-native-expo-image-cropper/ExpoImageManipulator.js.map +0 -1
  185. package/dist/module/components/react-native-expo-image-cropper/ImageCropOverlay.js +0 -387
  186. package/dist/module/components/react-native-expo-image-cropper/ImageCropOverlay.js.map +0 -1
  187. package/dist/module/config.js +0 -27
  188. package/dist/module/config.js.map +0 -1
  189. package/dist/module/constants.js +0 -18
  190. package/dist/module/constants.js.map +0 -1
  191. package/dist/module/helper.js +0 -424
  192. package/dist/module/helper.js.map +0 -1
  193. package/dist/module/index.js +0 -13
  194. package/dist/module/index.js.map +0 -1
  195. package/dist/module/js/images/detectFaces.js +0 -31
  196. package/dist/module/js/images/detectFaces.js.map +0 -1
  197. package/dist/module/js/images/findLandmarkRange.js +0 -93
  198. package/dist/module/js/images/findLandmarkRange.js.map +0 -1
  199. package/dist/module/js/images/getScaledOffset.js +0 -81
  200. package/dist/module/js/images/getScaledOffset.js.map +0 -1
  201. package/dist/module/js/site/getSiteLevelFromState.js +0 -29
  202. package/dist/module/js/site/getSiteLevelFromState.js.map +0 -1
  203. package/dist/module/js/site/isTVEnabled.js +0 -10
  204. package/dist/module/js/site/isTVEnabled.js.map +0 -1
  205. package/dist/module/session.js +0 -58
  206. package/dist/module/session.js.map +0 -1
  207. package/dist/module/styles.js +0 -67
  208. package/dist/module/styles.js.map +0 -1
  209. package/dist/module/withNavigationFocus.js +0 -30
  210. package/dist/module/withNavigationFocus.js.map +0 -1
@@ -1,823 +0,0 @@
1
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
2
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
3
- function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
4
- import React, { Component } from "react";
5
- import { View, TouchableOpacity, Image, StyleSheet } from "react-native";
6
- import { Text } from "./Text";
7
- import _ from "lodash";
8
- import moment from "moment";
9
- import { connect } from "react-redux";
10
- import { Icon } from "@rneui/themed";
11
- import { getPluralS, getThumb300, get1400, getSiteSettingFromState, getFirstName, getPluralOptions } from "../helper";
12
- import { getMainBrandingColourFromState, TEXT_DARKEST, BG_GREY, TEXT_LIGHT, LINEGREY } from "../colours";
13
- import { reactionActions, notificationActions } from "../apis";
14
- import { blockUser, unblockUser } from "../actions";
15
- import { ConfirmPopup } from "./ConfirmPopup";
16
- import { ProfilePic } from "./ProfilePic";
17
- import { ImagePopup } from "./ImagePopup";
18
- import { InlineButton } from "./InlineButton";
19
- import { Spinner } from "./Spinner";
20
- import { Services } from "../config";
21
- class CommentSection extends Component {
22
- constructor(props) {
23
- super(props);
24
- _defineProperty(this, "onPressDeleteComment", c => {
25
- this.setState({
26
- commentToDelete: c
27
- });
28
- });
29
- _defineProperty(this, "onPressConfirmDelete", () => {
30
- reactionActions.removeComment(this.state.commentToDelete.Id).then(res => {
31
- console.log("deleted");
32
- });
33
- const newComments = _.filter(this.state.comments, c => {
34
- return c.Id !== this.state.commentToDelete.Id;
35
- });
36
- this.setState({
37
- comments: newComments,
38
- commentToDelete: null
39
- });
40
- });
41
- _defineProperty(this, "onPressCancelDelete", () => {
42
- this.setState({
43
- commentToDelete: null
44
- });
45
- });
46
- _defineProperty(this, "onPressReportComment", c => {
47
- this.setState({
48
- commentToReport: c
49
- });
50
- });
51
- _defineProperty(this, "onPressBlockUser", c => {
52
- this.setState({
53
- commentToBlock: c
54
- });
55
- });
56
- _defineProperty(this, "onPressConfirmBlock", () => {
57
- const userId = this.state.commentToBlock.UserId;
58
- this.props.blockUser(userId);
59
- this.setState({
60
- commentToBlock: null
61
- });
62
- });
63
- _defineProperty(this, "onPressCancelBlock", () => {
64
- this.setState({
65
- commentToBlock: null
66
- });
67
- });
68
- _defineProperty(this, "onPressUnblockUser", c => {
69
- this.setState({
70
- commentToUnblock: c
71
- });
72
- });
73
- _defineProperty(this, "onPressConfirmUnblock", () => {
74
- const userId = this.state.commentToUnblock.UserId;
75
- this.props.unblockUser(userId);
76
- this.setState({
77
- commentToUnblock: null
78
- });
79
- });
80
- _defineProperty(this, "onPressCancelUnblock", () => {
81
- this.setState({
82
- commentToUnblock: null
83
- });
84
- });
85
- _defineProperty(this, "onPressConfirmReport", () => {
86
- const commentId = this.state.commentToReport.Id;
87
- this.setState({
88
- reportLoading: true,
89
- commentToReport: null
90
- }, () => {
91
- reactionActions.reportComment(commentId).then(res => {
92
- this.setState({
93
- commentReportedStatus: "success",
94
- reportLoading: false
95
- });
96
- }).catch(error => {
97
- console.log("reportComment", error);
98
- this.setState({
99
- commentReportedStatus: "fail",
100
- reportLoading: false
101
- });
102
- });
103
- });
104
- });
105
- _defineProperty(this, "onPressCancelReport", () => {
106
- this.setState({
107
- commentToReport: null
108
- });
109
- });
110
- _defineProperty(this, "onPressConfirmReportStatus", () => {
111
- this.setState({
112
- commentReportedStatus: null
113
- });
114
- });
115
- _defineProperty(this, "onOpenThread", comment => {
116
- Services.navigation.navigate("thread", {
117
- ...this.props,
118
- threadId: comment.Id
119
- });
120
- });
121
- _defineProperty(this, "onMute", () => {
122
- const {
123
- entityType,
124
- entityId
125
- } = this.props;
126
- this.setState({
127
- processing: true
128
- }, async () => {
129
- try {
130
- const {
131
- data
132
- } = await notificationActions.muteEntity(entityType, entityId);
133
- // console.log('onMute', data);
134
- const muteExpiry = moment(data.Expiry);
135
- this.setState({
136
- muteExpiry,
137
- processing: false
138
- });
139
- } catch (error) {
140
- console.error("onMute", error);
141
- this.setState({
142
- processing: false
143
- });
144
- }
145
- });
146
- });
147
- _defineProperty(this, "onUnmute", () => {
148
- const {
149
- entityType,
150
- entityId
151
- } = this.props;
152
- this.setState({
153
- processing: true
154
- }, async () => {
155
- try {
156
- const {
157
- data
158
- } = await notificationActions.unmuteEntity(entityType, entityId);
159
- // console.log('onUnmute', data);
160
- this.setState({
161
- muteExpiry: null,
162
- processing: false
163
- });
164
- } catch (error) {
165
- console.error("onUnmute", error);
166
- this.setState({
167
- processing: false
168
- });
169
- }
170
- });
171
- });
172
- _defineProperty(this, "isMuted", () => {
173
- const {
174
- muteExpiry
175
- } = this.state;
176
- return muteExpiry && moment() <= muteExpiry;
177
- });
178
- _defineProperty(this, "getMuteRemaining", () => {
179
- const {
180
- muteExpiry
181
- } = this.state;
182
- const actual = muteExpiry ? moment.duration(muteExpiry.diff(moment())).asHours() : 0;
183
- return Math.abs(Math.ceil(actual));
184
- });
185
- _defineProperty(this, "getNotificationSate", () => {
186
- const {
187
- processing
188
- } = this.state;
189
- const {
190
- entityType,
191
- entityId,
192
- notificationsForComments
193
- } = this.props;
194
- if (processing || !notificationsForComments) return;
195
- this.setState({
196
- processing: true
197
- }, async () => {
198
- try {
199
- const {
200
- data
201
- } = await notificationActions.getEntityNotificationSetting(entityType, entityId);
202
- // console.log('getNotificationSate', data);
203
- const muteExpiry = data ? moment(data.Expiry) : null;
204
- this.setState({
205
- muteExpiry,
206
- muteLoaded: true,
207
- processing: false
208
- });
209
- } catch (error) {
210
- console.error("getNotificationSate", error);
211
- this.setState({
212
- processing: false
213
- });
214
- }
215
- });
216
- });
217
- _defineProperty(this, "isLoading", () => {
218
- return this.state.commentsLoading;
219
- });
220
- _defineProperty(this, "isUserBlocked", c => {
221
- return _.includes(this.props.blockedUsers, c.UserId);
222
- });
223
- _defineProperty(this, "canBlockComment", c => {
224
- return this.props.user.uid !== c.UserId;
225
- });
226
- _defineProperty(this, "renderReplyText", (c, isUserBlocked) => {
227
- if (this.props.threadId || this.props.hideReplyButton) {
228
- return null;
229
- }
230
- const threadComments = _.filter(this.state.comments, innerC => {
231
- return innerC.ParentId === c.Id;
232
- });
233
- let content = null;
234
- if (_.isEmpty(threadComments)) {
235
- // no replies
236
- content = /*#__PURE__*/React.createElement(Text, {
237
- style: [styles.commentRepliesText, {
238
- color: this.props.colourBrandingMain
239
- }]
240
- }, `Reply to ${getFirstName(!isUserBlocked && c.User ? c.User.displayName : "comment")}`);
241
- } else {
242
- // existing replies
243
- const profilePics = _.take(_.uniqBy(threadComments, c => c.UserId), 3);
244
- content = /*#__PURE__*/React.createElement(View, {
245
- style: styles.multiReplyContainer
246
- }, profilePics.map((c, i) => {
247
- return /*#__PURE__*/React.createElement(ProfilePic, {
248
- key: c.Id,
249
- style: {
250
- marginRight: -10
251
- },
252
- Diameter: 20,
253
- ProfilePic: c.User.profilePic
254
- });
255
- }), /*#__PURE__*/React.createElement(Text, {
256
- style: [styles.commentRepliesText, {
257
- marginLeft: 20,
258
- color: this.props.colourBrandingMain
259
- }]
260
- }, `${threadComments.length} repl${getPluralOptions(threadComments.length, "y", "ies")}`));
261
- }
262
- return /*#__PURE__*/React.createElement(View, {
263
- style: styles.commentReplies
264
- }, /*#__PURE__*/React.createElement(TouchableOpacity, {
265
- onPress: () => {
266
- this.onOpenThread(c);
267
- }
268
- }, content));
269
- });
270
- this.state = {
271
- commentsLoading: false,
272
- comments: [],
273
- addingComment: false,
274
- commentToDelete: null,
275
- commentToReport: null,
276
- commentReportedStatus: null,
277
- reportLoading: false,
278
- processing: false,
279
- muteExpiry: null,
280
- muteLoaded: false
281
- };
282
- }
283
- componentDidMount() {
284
- this.getNotificationSate();
285
- if (!_.includes(this.props.user.hidden, "viewComment")) {
286
- this.getComments();
287
- }
288
- }
289
- componentWillUnmount() {
290
- if (this.loadTimer) {
291
- clearTimeout(this.loadTimer);
292
- }
293
- }
294
- onPressCommentImage(image) {
295
- this.setState({
296
- imagePopupSource: [image],
297
- imagePopupOpen: true
298
- });
299
- }
300
- onGoToAdd() {
301
- var _this$props$commentRe;
302
- (_this$props$commentRe = this.props.commentReply) === null || _this$props$commentRe === void 0 || (_this$props$commentRe = _this$props$commentRe.current) === null || _this$props$commentRe === void 0 || _this$props$commentRe.focusInput();
303
- }
304
- getAdjustedSize(size) {
305
- if (this.props.scaleFont) {
306
- return size + this.props.user.fontScale;
307
- }
308
- return size;
309
- }
310
- getComments() {
311
- if (!this.state.commentsLoadStarted) {
312
- var _this$props$commentRe2;
313
- this.setState({
314
- commentsLoadStarted: true,
315
- commentsLoading: true
316
- });
317
- (_this$props$commentRe2 = this.props.commentReply) === null || _this$props$commentRe2 === void 0 || (_this$props$commentRe2 = _this$props$commentRe2.current) === null || _this$props$commentRe2 === void 0 || _this$props$commentRe2.loadingStarted();
318
- this.loadComments();
319
- }
320
- }
321
- isEmpty() {
322
- return _.isEmpty(this.state.comments);
323
- }
324
- loadComments() {
325
- const minTime = this.isEmpty() ? 0 : _.maxBy(this.state.comments, c => {
326
- return c.Timestamp;
327
- }).Timestamp;
328
- reactionActions.getComments(this.props.entityId, this.props.entityType, minTime).then(res => {
329
- var _this$props$commentRe3;
330
- this.setState({
331
- comments: _.sortBy(_.uniqBy(_.filter(_.concat(this.state.comments, res.data), c => {
332
- if (!this.props.threadId) {
333
- return true;
334
- }
335
- return c.Id === this.props.threadId || c.ParentId === this.props.threadId;
336
- }), c => {
337
- return c.Id;
338
- }), "Timestamp"),
339
- commentsLoading: false
340
- }, () => {
341
- if (this.props.onCommentsLoaded) {
342
- this.props.onCommentsLoaded(this.state.comments.length);
343
- }
344
- });
345
- //if (this.props.commentReply) {
346
- (_this$props$commentRe3 = this.props.commentReply) === null || _this$props$commentRe3 === void 0 || (_this$props$commentRe3 = _this$props$commentRe3.current) === null || _this$props$commentRe3 === void 0 || _this$props$commentRe3.loadingCompleted();
347
- //}
348
- if (this.props.live) {
349
- this.loadTimer = setTimeout(() => {
350
- this.loadComments();
351
- }, this.props.refreshFrequency || 2000);
352
- }
353
- });
354
- }
355
- startedAddingComment() {
356
- this.setState({
357
- addingComment: true
358
- });
359
- }
360
- commentAdded(comment) {
361
- const newComments = this.state.comments;
362
- newComments.push(comment);
363
- this.setState({
364
- addingComment: false,
365
- comments: newComments
366
- }, () => {
367
- if (this.props.onCommentAdded) {
368
- this.props.onCommentAdded();
369
- }
370
- });
371
- }
372
- canRemoveComment(c) {
373
- if (this.props.user.uid === c.UserId) {
374
- return true;
375
- }
376
- return _.includes(this.props.user.permissions, this.props.adminPermission);
377
- }
378
- closeCommentGallery() {
379
- this.setState({
380
- imagePopupSource: [],
381
- imagePopupOpen: false
382
- });
383
- }
384
- renderCommentDeleteConfirm() {
385
- return /*#__PURE__*/React.createElement(ConfirmPopup, {
386
- visible: !!this.state.commentToDelete,
387
- onConfirm: this.onPressConfirmDelete,
388
- onCancel: this.onPressCancelDelete,
389
- onClose: this.onPressCancelDelete,
390
- text: "Are you sure you want to delete this comment?"
391
- });
392
- }
393
- renderCommentReportConfirm() {
394
- return /*#__PURE__*/React.createElement(ConfirmPopup, {
395
- visible: !!this.state.commentToReport,
396
- onConfirm: this.onPressConfirmReport,
397
- onCancel: this.onPressCancelReport,
398
- onClose: this.onPressCancelReport,
399
- text: "Are you sure you want to report this comment?",
400
- extraContent: /*#__PURE__*/React.createElement(Text, {
401
- style: styles.commentReportText
402
- }, "This comment will be reported to our team and considered for deletion")
403
- });
404
- }
405
- renderCommentBlockConfirm() {
406
- return /*#__PURE__*/React.createElement(ConfirmPopup, {
407
- visible: !!this.state.commentToBlock,
408
- onConfirm: this.onPressConfirmBlock,
409
- onCancel: this.onPressCancelBlock,
410
- onClose: this.onPressCancelBlock,
411
- text: "Are you sure you want to block this user?",
412
- extraContent: /*#__PURE__*/React.createElement(Text, {
413
- style: styles.commentReportText
414
- }, "You will no longer see comments made by this user")
415
- });
416
- }
417
- renderCommentUnblockConfirm() {
418
- return /*#__PURE__*/React.createElement(ConfirmPopup, {
419
- visible: !!this.state.commentToUnblock,
420
- onConfirm: this.onPressConfirmUnblock,
421
- onCancel: this.onPressCancelUnblock,
422
- onClose: this.onPressCancelUnblock,
423
- text: "Are you sure you want to unblock this user?",
424
- extraContent: /*#__PURE__*/React.createElement(Text, {
425
- style: styles.commentReportText
426
- }, "You will once again see comments made by this user")
427
- });
428
- }
429
- renderCommentReportStatus() {
430
- const {
431
- commentReportedStatus
432
- } = this.state;
433
- const isSuccess = commentReportedStatus === "success";
434
- return /*#__PURE__*/React.createElement(ConfirmPopup, {
435
- visible: !!commentReportedStatus,
436
- onConfirm: this.onPressConfirmReportStatus,
437
- text: isSuccess ? "Thank you for reporting" : "Unable to report",
438
- extraContent: /*#__PURE__*/React.createElement(Text, {
439
- style: styles.commentReportText
440
- }, isSuccess ? "We will review the comment within 24 hours" : "There was a problem reporting the comment please try again later"),
441
- hideNo: true,
442
- yesText: "Done"
443
- });
444
- }
445
- renderCommentImage(c) {
446
- if (_.isEmpty(c.Image)) {
447
- return null;
448
- }
449
- return /*#__PURE__*/React.createElement(TouchableOpacity, {
450
- style: styles.commentImageContainer,
451
- onPress: this.onPressCommentImage.bind(this, get1400(c.Image))
452
- }, /*#__PURE__*/React.createElement(Image, {
453
- style: styles.commentImage,
454
- source: {
455
- uri: getThumb300(c.Image)
456
- }
457
- }));
458
- }
459
- renderComment(c) {
460
- const isUserBlocked = this.isUserBlocked(c);
461
- return /*#__PURE__*/React.createElement(View, {
462
- style: styles.comment,
463
- key: c.Id
464
- }, /*#__PURE__*/React.createElement(View, {
465
- style: styles.commentFlex
466
- }, /*#__PURE__*/React.createElement(ProfilePic, {
467
- ProfilePic: isUserBlocked ? null : c.User.profilePic,
468
- Diameter: 40,
469
- style: styles.commentProfilePic
470
- }), /*#__PURE__*/React.createElement(View, {
471
- style: styles.commentBlock
472
- }, /*#__PURE__*/React.createElement(View, {
473
- style: styles.commentTitleRow
474
- }, this.canRemoveComment(c) ? /*#__PURE__*/React.createElement(TouchableOpacity, {
475
- onPress: this.onPressDeleteComment.bind(this, c)
476
- }, /*#__PURE__*/React.createElement(View, {
477
- style: [styles.commentButtonContainer, {
478
- backgroundColor: this.props.colourBrandingMain
479
- }]
480
- }, /*#__PURE__*/React.createElement(Icon, {
481
- name: "trash",
482
- type: "font-awesome",
483
- iconStyle: styles.commentButtonIcon
484
- }))) : !this.props.disableFlag && /*#__PURE__*/React.createElement(TouchableOpacity, {
485
- onPress: this.onPressReportComment.bind(this, c)
486
- }, /*#__PURE__*/React.createElement(View, {
487
- style: [styles.commentButtonContainer, {
488
- backgroundColor: this.props.colourBrandingMain
489
- }]
490
- }, /*#__PURE__*/React.createElement(Icon, {
491
- name: "flag",
492
- type: "font-awesome",
493
- iconStyle: styles.commentButtonIcon
494
- }))), !this.props.disableFlag && this.canBlockComment(c) && (isUserBlocked ? /*#__PURE__*/React.createElement(TouchableOpacity, {
495
- style: {
496
- marginRight: 8
497
- },
498
- onPress: this.onPressUnblockUser.bind(this, c)
499
- }, /*#__PURE__*/React.createElement(View, {
500
- style: [styles.commentButtonContainer, {
501
- backgroundColor: this.props.colourBrandingMain
502
- }]
503
- }, /*#__PURE__*/React.createElement(Icon, {
504
- name: "user-plus",
505
- type: "font-awesome",
506
- iconStyle: styles.commentButtonIcon
507
- }))) : /*#__PURE__*/React.createElement(TouchableOpacity, {
508
- style: {
509
- marginRight: 8
510
- },
511
- onPress: this.onPressBlockUser.bind(this, c)
512
- }, /*#__PURE__*/React.createElement(View, {
513
- style: [styles.commentButtonContainer, {
514
- backgroundColor: this.props.colourBrandingMain
515
- }]
516
- }, /*#__PURE__*/React.createElement(Icon, {
517
- name: "user-times",
518
- type: "font-awesome",
519
- iconStyle: styles.commentButtonIcon
520
- })))), /*#__PURE__*/React.createElement(Text, {
521
- style: [styles.commentName, {
522
- fontSize: this.getAdjustedSize(13)
523
- }]
524
- }, isUserBlocked ? "[blocked user]" : c.User.displayName)), !_.isEmpty(c.Comment) && /*#__PURE__*/React.createElement(Text, {
525
- style: [styles.commentText, {
526
- fontSize: this.getAdjustedSize(13)
527
- }]
528
- }, isUserBlocked ? "[hidden]" : c.Comment), !isUserBlocked && this.renderCommentImage(c))), /*#__PURE__*/React.createElement(View, {
529
- style: styles.commentBottom
530
- }, /*#__PURE__*/React.createElement(Text, {
531
- style: [styles.commentTime, {
532
- fontSize: this.getAdjustedSize(13)
533
- }]
534
- }, moment.utc(c.Timestamp).local().format("D MMM • h:mma")), this.renderReplyText(c, isUserBlocked)));
535
- }
536
- renderMute() {
537
- const {
538
- notificationsForComments
539
- } = this.props;
540
- const {
541
- muteLoaded,
542
- muteExpiry,
543
- processing
544
- } = this.state;
545
- if (!notificationsForComments || !muteLoaded) return null;
546
- if (processing) return /*#__PURE__*/React.createElement(View, {
547
- style: styles.muteSpinnerContainer
548
- }, /*#__PURE__*/React.createElement(Spinner, {
549
- size: "small",
550
- color: this.props.colourBrandingMain
551
- }));
552
- const isMuted = this.isMuted();
553
- const hours = this.getMuteRemaining();
554
- const mutedFor = `Muted for ${hours} hour${getPluralS(hours)}`;
555
- // console.log(muteExpiry.format('DD MMM YYYY hh:mm a'));
556
-
557
- return /*#__PURE__*/React.createElement(View, {
558
- style: styles.muteContainer
559
- }, isMuted && muteExpiry ? /*#__PURE__*/React.createElement(Text, {
560
- style: [{
561
- color: this.props.colourBrandingMain
562
- }, styles.mutedForText]
563
- }, mutedFor) : null, /*#__PURE__*/React.createElement(InlineButton, {
564
- onPress: isMuted ? this.onUnmute : this.onMute,
565
- color: "#fff",
566
- style: [{
567
- borderColor: this.props.colourBrandingMain
568
- }, styles.muteButton],
569
- disabled: processing,
570
- disabledOpacity: true,
571
- noText: true
572
- }, /*#__PURE__*/React.createElement(View, {
573
- style: styles.muteButtonInner
574
- }, /*#__PURE__*/React.createElement(Icon, {
575
- name: isMuted ? "bell-o" : "bell-slash-o",
576
- type: "font-awesome",
577
- iconStyle: [{
578
- color: this.props.colourBrandingMain
579
- }, styles.muteButtonIcon]
580
- }), /*#__PURE__*/React.createElement(Text, {
581
- style: [{
582
- color: this.props.colourBrandingMain
583
- }, styles.muteButtonText]
584
- }, isMuted ? "Unmute" : "Mute"))));
585
- }
586
- renderComments() {
587
- if (this.state.commentsLoading) {
588
- return /*#__PURE__*/React.createElement(View, {
589
- style: styles.commentSection
590
- }, /*#__PURE__*/React.createElement(Spinner, {
591
- color: this.props.colourBrandingMain
592
- }));
593
- }
594
- if (this.isEmpty() && !this.state.addingComment) {
595
- if (_.includes(this.props.user.hidden, "addComment")) {
596
- return null;
597
- }
598
- if (!_.isNil(this.props.placeHolder) && _.isEmpty(this.props.placeHolder)) return null;
599
- return /*#__PURE__*/React.createElement(View, {
600
- style: styles.commentSection
601
- }, /*#__PURE__*/React.createElement(Text, {
602
- style: [styles.commentsEmpty, {
603
- fontSize: this.getAdjustedSize(15)
604
- }]
605
- }, _.isNil(this.props.placeHolder) ? "Be the first to add a comment!" : this.props.placeHolder));
606
- }
607
- let source = [...this.state.comments];
608
- if (this.props.reverseOrder) {
609
- source = source.reverse();
610
- }
611
- if (!this.props.showReplies && !this.props.threadId) {
612
- source = _.filter(source, c => {
613
- return !c.ParentId;
614
- });
615
- }
616
- return /*#__PURE__*/React.createElement(View, {
617
- style: styles.commentSection
618
- }, !this.isEmpty() && /*#__PURE__*/React.createElement(View, {
619
- style: styles.commentSectionTitleRow
620
- }, /*#__PURE__*/React.createElement(View, {
621
- style: {
622
- alignItems: "flex-end"
623
- }
624
- }, this.renderMute(), !this.props.hideAddComment && this.state.comments.length > 2 && /*#__PURE__*/React.createElement(TouchableOpacity, {
625
- onPress: this.onGoToAdd.bind(this)
626
- }, /*#__PURE__*/React.createElement(Text, {
627
- style: [styles.goToText, {
628
- color: this.props.colourBrandingMain
629
- }]
630
- }, "Add a comment"))), /*#__PURE__*/React.createElement(Text, {
631
- style: [styles.commentCount, {
632
- fontSize: this.getAdjustedSize(15)
633
- }]
634
- }, this.state.comments.length, ` comment${getPluralS(this.state.comments.length)}`)), this.props.reverseOrder && this.state.addingComment && /*#__PURE__*/React.createElement(Spinner, {
635
- color: this.props.colourBrandingMain
636
- }), source.map(c => {
637
- return this.renderComment(c);
638
- }), !this.props.reverseOrder && this.state.addingComment && /*#__PURE__*/React.createElement(Spinner, {
639
- color: this.props.colourBrandingMain
640
- }));
641
- }
642
- renderCommentImagePopup() {
643
- return /*#__PURE__*/React.createElement(ImagePopup, {
644
- visible: this.state.imagePopupOpen,
645
- images: this.state.imagePopupSource,
646
- onClose: this.closeCommentGallery.bind(this)
647
- });
648
- }
649
- renderReportLoading() {
650
- if (!this.state.reportLoading) return null;
651
- return /*#__PURE__*/React.createElement(View, {
652
- style: styles.reportLoadingContainer
653
- }, /*#__PURE__*/React.createElement(Spinner, {
654
- color: this.props.colourBrandingMain
655
- }));
656
- }
657
- render() {
658
- if (_.includes(this.props.user.hidden, "viewComment")) {
659
- return null;
660
- }
661
- return /*#__PURE__*/React.createElement(View, {
662
- style: [styles.commentSectionOuter, this.props.style]
663
- }, this.renderComments(), this.renderReportLoading(), this.renderCommentDeleteConfirm(), this.renderCommentReportConfirm(), this.renderCommentBlockConfirm(), this.renderCommentUnblockConfirm(), this.renderCommentReportStatus(), this.renderCommentImagePopup());
664
- }
665
- }
666
- const styles = StyleSheet.create({
667
- commentSectionOuter: {
668
- flex: 1,
669
- paddingHorizontal: 16
670
- },
671
- commentSection: {
672
- flex: 1,
673
- paddingVertical: 12,
674
- borderTopColor: LINEGREY,
675
- borderTopWidth: 1
676
- },
677
- commentCount: {
678
- fontFamily: "sf-semibold",
679
- color: TEXT_DARKEST,
680
- flex: 1,
681
- marginTop: 4
682
- },
683
- comment: {
684
- marginTop: 16
685
- },
686
- commentFlex: {
687
- flexDirection: "row"
688
- },
689
- commentProfilePic: {
690
- marginRight: 8
691
- },
692
- commentBlock: {
693
- flex: 1,
694
- backgroundColor: BG_GREY,
695
- borderRadius: 5,
696
- padding: 8
697
- },
698
- commentTitleRow: {
699
- flexDirection: "row-reverse",
700
- alignItems: "center"
701
- },
702
- commentButtonContainer: {
703
- width: 24,
704
- height: 24,
705
- borderRadius: 12,
706
- alignItems: "center",
707
- justifyContent: "center"
708
- },
709
- commentButtonIcon: {
710
- fontSize: 13,
711
- color: "#fff"
712
- },
713
- commentName: {
714
- fontFamily: "sf-semibold",
715
- color: TEXT_DARKEST,
716
- flex: 1
717
- },
718
- commentText: {
719
- marginTop: 8,
720
- fontFamily: "sf-regular",
721
- color: TEXT_DARKEST
722
- },
723
- commentBottom: {
724
- flexDirection: "row-reverse",
725
- justifyContent: "space-between",
726
- alignItems: "center"
727
- },
728
- commentTime: {
729
- fontFamily: "sf-regular",
730
- marginTop: 4,
731
- color: TEXT_LIGHT,
732
- textAlign: "right"
733
- },
734
- commentReplies: {
735
- flex: 1,
736
- paddingLeft: 48
737
- },
738
- commentRepliesText: {
739
- fontFamily: "sf-semibold",
740
- fontSize: 15
741
- },
742
- multiReplyContainer: {
743
- flexDirection: "row",
744
- alignItems: "center",
745
- paddingVertical: 4
746
- },
747
- commentImageContainer: {
748
- marginTop: 8,
749
- width: 60,
750
- height: 60
751
- },
752
- commentImage: {
753
- width: 60,
754
- height: 60,
755
- borderRadius: 2
756
- },
757
- commentsEmpty: {
758
- fontFamily: "sf-semibold",
759
- color: TEXT_DARKEST
760
- },
761
- commentSectionTitleRow: {
762
- flexDirection: "row-reverse"
763
- },
764
- commentReportText: {
765
- fontFamily: "sf-regular",
766
- fontSize: 14,
767
- paddingHorizontal: 22,
768
- textAlign: "center"
769
- },
770
- reportLoadingContainer: {
771
- paddingVertical: 10
772
- },
773
- goToText: {
774
- marginTop: 4
775
- },
776
- muteSpinnerContainer: {
777
- width: 100,
778
- marginBottom: 6
779
- },
780
- muteContainer: {
781
- flexDirection: "row",
782
- alignItems: "center",
783
- justifyContent: "flex-end",
784
- marginBottom: 6
785
- },
786
- mutedForText: {
787
- fontFamily: "sf-semibold",
788
- fontSize: 13,
789
- marginRight: 8
790
- },
791
- muteButton: {
792
- borderWidth: 1,
793
- paddingHorizontal: 8
794
- },
795
- muteButtonInner: {
796
- flexDirection: "row",
797
- alignItems: "center"
798
- },
799
- muteButtonIcon: {
800
- fontSize: 14
801
- },
802
- muteButtonText: {
803
- fontFamily: "sf-semibold",
804
- fontSize: 14,
805
- marginLeft: 6
806
- }
807
- });
808
- const mapStateToProps = state => {
809
- return {
810
- colourBrandingMain: getMainBrandingColourFromState(state),
811
- user: state.user,
812
- notificationsForComments: getSiteSettingFromState(state, "NotificationsForComments", false),
813
- blockedUsers: state.userSettings.blockedUsers || []
814
- };
815
- };
816
- const commentSection = connect(mapStateToProps, {
817
- blockUser,
818
- unblockUser
819
- }, null, {
820
- forwardRef: true
821
- })(CommentSection);
822
- export { commentSection as CommentSection };
823
- //# sourceMappingURL=CommentSection.js.map