@plusscommunities/pluss-core-app 8.0.37 → 8.0.38

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