@plusscommunities/pluss-circles-web 1.0.16-beta.0 → 1.0.17

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/dist/index.umd.js CHANGED
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
2
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@babel/runtime/helpers/defineProperty'), require('@babel/runtime/helpers/asyncToGenerator'), require('@babel/runtime/helpers/classCallCheck'), require('@babel/runtime/helpers/createClass'), require('@babel/runtime/helpers/assertThisInitialized'), require('@babel/runtime/helpers/inherits'), require('@babel/runtime/helpers/possibleConstructorReturn'), require('@babel/runtime/helpers/getPrototypeOf'), require('@babel/runtime/regenerator'), require('react'), require('react-redux'), require('lodash'), require('moment'), require('react-router-dom'), require('@plusscommunities/pluss-core-web'), require('react-bootstrap'), require('react-fontawesome'), require('@babel/runtime/helpers/toConsumableArray'), require('react-router')) :
3
3
  typeof define === 'function' && define.amd ? define(['exports', '@babel/runtime/helpers/defineProperty', '@babel/runtime/helpers/asyncToGenerator', '@babel/runtime/helpers/classCallCheck', '@babel/runtime/helpers/createClass', '@babel/runtime/helpers/assertThisInitialized', '@babel/runtime/helpers/inherits', '@babel/runtime/helpers/possibleConstructorReturn', '@babel/runtime/helpers/getPrototypeOf', '@babel/runtime/regenerator', 'react', 'react-redux', 'lodash', 'moment', 'react-router-dom', '@plusscommunities/pluss-core-web', 'react-bootstrap', 'react-fontawesome', '@babel/runtime/helpers/toConsumableArray', 'react-router'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global['@plusscommunities/pluss-circles-web'] = {}, global._defineProperty, global._asyncToGenerator, global._classCallCheck, global._createClass, global._assertThisInitialized, global._inherits, global._possibleConstructorReturn, global._getPrototypeOf, global._regeneratorRuntime, global.React$1, global.reactRedux, global._, global.moment, global.reactRouterDom, global.PlussCore, global.reactBootstrap, global.FontAwesome, global._toConsumableArray, global.reactRouter));
5
- }(this, (function (exports, _defineProperty, _asyncToGenerator, _classCallCheck, _createClass, _assertThisInitialized, _inherits, _possibleConstructorReturn, _getPrototypeOf, _regeneratorRuntime, React$1, reactRedux, _, moment, reactRouterDom, PlussCore, reactBootstrap, FontAwesome, _toConsumableArray, reactRouter) { 'use strict';
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global['@plusscommunities/pluss-circles-web'] = {}, global._defineProperty, global._asyncToGenerator, global._classCallCheck, global._createClass, global._assertThisInitialized, global._inherits, global._possibleConstructorReturn, global._getPrototypeOf, global._regeneratorRuntime, global.React, global.reactRedux, global._, global.moment, global.reactRouterDom, global.PlussCore, global.reactBootstrap, global.FontAwesome, global._toConsumableArray, global.reactRouter));
5
+ }(this, (function (exports, _defineProperty, _asyncToGenerator, _classCallCheck, _createClass, _assertThisInitialized, _inherits, _possibleConstructorReturn, _getPrototypeOf, _regeneratorRuntime, React, reactRedux, _, moment, reactRouterDom, PlussCore, reactBootstrap, FontAwesome, _toConsumableArray, reactRouter) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -35,7 +35,7 @@
35
35
  var _possibleConstructorReturn__default = /*#__PURE__*/_interopDefaultLegacy(_possibleConstructorReturn);
36
36
  var _getPrototypeOf__default = /*#__PURE__*/_interopDefaultLegacy(_getPrototypeOf);
37
37
  var _regeneratorRuntime__default = /*#__PURE__*/_interopDefaultLegacy(_regeneratorRuntime);
38
- var React__default = /*#__PURE__*/_interopDefaultLegacy(React$1);
38
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
39
39
  var ___default = /*#__PURE__*/_interopDefaultLegacy(_);
40
40
  var moment__default = /*#__PURE__*/_interopDefaultLegacy(moment);
41
41
  var PlussCore__namespace = /*#__PURE__*/_interopNamespace(PlussCore);
@@ -90,7 +90,7 @@
90
90
  }],
91
91
  featurePickerInfo: {
92
92
  image: 'https://pluss-prd-uploads.s3.ap-southeast-2.amazonaws.com/uploads/users/ap-southeast-2:80aecdcb-9955-493e-a341-2f2263f64777/public/e4a5948c40908e2137f0a65eb1/groups.jpg',
93
- text: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("p", null, "Open and closed group chat - where your community does its planning, discussing and sharing."), /*#__PURE__*/React.createElement("p", null, "Keep them open for any member to join, or private to the admins - ", values.textFeatureTitle, " gives you that control."), /*#__PURE__*/React.createElement("p", null, "Your ", values.textFeatureTitle, " activity will keep the app close to your communities hands.")),
93
+ text: /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("p", null, "Open and closed group chat - where your community does its planning, discussing and sharing."), /*#__PURE__*/React__default['default'].createElement("p", null, "Keep them open for any member to join, or private to the admins - ", values.textFeatureTitle, " gives you that control."), /*#__PURE__*/React__default['default'].createElement("p", null, "Your ", values.textFeatureTitle, " activity will keep the app close to your communities hands.")),
94
94
  layoutDisclaimer: true
95
95
  },
96
96
  menu: {
@@ -763,7 +763,7 @@
763
763
  }]);
764
764
 
765
765
  return Circles;
766
- }(React$1.Component);
766
+ }(React.Component);
767
767
 
768
768
  var mapStateToProps$2 = function mapStateToProps(state) {
769
769
  var circles = state[values.reducerKey].circles;
@@ -1331,7 +1331,7 @@
1331
1331
  }]);
1332
1332
 
1333
1333
  return AddCircle;
1334
- }(React$1.Component);
1334
+ }(React.Component);
1335
1335
 
1336
1336
  var mapStateToProps$1 = function mapStateToProps(state) {
1337
1337
  var circles = state[values.reducerKey].circles;
@@ -1560,6 +1560,17 @@
1560
1560
  });
1561
1561
  });
1562
1562
 
1563
+ _defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onReply", function (m) {
1564
+ _this.setState({
1565
+ replyingTo: m
1566
+ });
1567
+
1568
+ if (m) {
1569
+ var input = document.getElementById('messageInput');
1570
+ if (input) input.focus();
1571
+ }
1572
+ });
1573
+
1563
1574
  _defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "handleMessageDateChange", function (date) {
1564
1575
  _this.setState({
1565
1576
  messageDate: date,
@@ -1631,6 +1642,10 @@
1631
1642
  return;
1632
1643
  }
1633
1644
 
1645
+ if (_this.state.replyingTo) {
1646
+ message.replyingTo = _this.state.replyingTo;
1647
+ }
1648
+
1634
1649
  var clonedMessage = ___default['default'].cloneDeep(message);
1635
1650
 
1636
1651
  clonedMessage.uploading = true;
@@ -1653,6 +1668,8 @@
1653
1668
  });
1654
1669
 
1655
1670
  setTimeout(function () {
1671
+ _this.onReply(null);
1672
+
1656
1673
  _this.scrollToBottom();
1657
1674
 
1658
1675
  _this.imageInput && _this.imageInput.getWrappedInstance().setValue(null);
@@ -1670,7 +1687,8 @@
1670
1687
  messages: [],
1671
1688
  images: [],
1672
1689
  files: [],
1673
- membersExpanded: true
1690
+ membersExpanded: true,
1691
+ replyingTo: null
1674
1692
  };
1675
1693
  return _this;
1676
1694
  }
@@ -1843,6 +1861,8 @@
1843
1861
  }, {
1844
1862
  key: "renderMessage",
1845
1863
  value: function renderMessage(m) {
1864
+ var _this6 = this;
1865
+
1846
1866
  if (m.system) {
1847
1867
  return /*#__PURE__*/React__default['default'].createElement("div", {
1848
1868
  key: m._id,
@@ -1871,7 +1891,12 @@
1871
1891
  }, /*#__PURE__*/React__default['default'].createElement(Components$1.Text, {
1872
1892
  type: "body",
1873
1893
  className: "message_name"
1874
- }, m.user.name), /*#__PURE__*/React__default['default'].createElement("div", {
1894
+ }, m.user.name, m.replyingTo ? " replied to ".concat(m.replyingTo.user.name) : ''), m.replyingTo && /*#__PURE__*/React__default['default'].createElement("div", {
1895
+ className: "message_replyBubble"
1896
+ }, /*#__PURE__*/React__default['default'].createElement(Components$1.Text, {
1897
+ type: "body",
1898
+ className: "message_text"
1899
+ }, Helper.toParagraphed((m.replyingTo.text || '').substr(0, 100)))), /*#__PURE__*/React__default['default'].createElement("div", {
1875
1900
  className: "message_bubble"
1876
1901
  }, /*#__PURE__*/React__default['default'].createElement(Components$1.Text, {
1877
1902
  type: "body",
@@ -1892,7 +1917,14 @@
1892
1917
  key: i,
1893
1918
  white: isSelf
1894
1919
  });
1895
- }))))));
1920
+ }))), /*#__PURE__*/React__default['default'].createElement("div", {
1921
+ className: "message_reply"
1922
+ }, /*#__PURE__*/React__default['default'].createElement(Components$1.Text, {
1923
+ type: "button",
1924
+ onClick: function onClick() {
1925
+ _this6.onReply(m);
1926
+ }
1927
+ }, "Reply")))));
1896
1928
  }
1897
1929
  }, {
1898
1930
  key: "renderHeaderRight",
@@ -1988,10 +2020,39 @@
1988
2020
  });
1989
2021
  }))));
1990
2022
  }
2023
+ }, {
2024
+ key: "renderReplyTo",
2025
+ value: function renderReplyTo() {
2026
+ var _this7 = this;
2027
+
2028
+ if (!this.state.replyingTo) {
2029
+ return null;
2030
+ }
2031
+
2032
+ var m = this.state.replyingTo;
2033
+ return /*#__PURE__*/React__default['default'].createElement("div", {
2034
+ className: "chat_replyTo"
2035
+ }, /*#__PURE__*/React__default['default'].createElement("div", {
2036
+ className: "chat_replyTo_container"
2037
+ }, /*#__PURE__*/React__default['default'].createElement(Components$1.Text, {
2038
+ type: "h5"
2039
+ }, "Replying to ", m && m.user && !___default['default'].isEmpty(m.user.displayName) ? m.user.displayName : ''), m && !___default['default'].isEmpty(m.text) && /*#__PURE__*/React__default['default'].createElement(Components$1.Text, {
2040
+ type: "body"
2041
+ }, m.text.substr(0, 50))), /*#__PURE__*/React__default['default'].createElement("div", {
2042
+ className: "chat_replyTo_remove"
2043
+ }, /*#__PURE__*/React__default['default'].createElement(Components$1.SVGIcon, {
2044
+ className: "removeIcon",
2045
+ icon: "close",
2046
+ onClick: function onClick() {
2047
+ _this7.onReply(null);
2048
+ },
2049
+ colour: Colours$1.COLOUR_DUSK
2050
+ })));
2051
+ }
1991
2052
  }, {
1992
2053
  key: "render",
1993
2054
  value: function render() {
1994
- var _this6 = this;
2055
+ var _this8 = this;
1995
2056
 
1996
2057
  return /*#__PURE__*/React__default['default'].createElement(Components$1.OverlayPage, {
1997
2058
  fullPage: true,
@@ -2028,8 +2089,8 @@
2028
2089
  value: this.state.messageDateText,
2029
2090
  readOnly: true,
2030
2091
  onClick: function onClick() {
2031
- return _this6.setState({
2032
- showMessageDate: !_this6.state.showMessageDate
2092
+ return _this8.setState({
2093
+ showMessageDate: !_this8.state.showMessageDate
2033
2094
  });
2034
2095
  },
2035
2096
  rightContent: !___default['default'].isEmpty(this.state.messageDate) && /*#__PURE__*/React__default['default'].createElement(Components$1.SVGIcon, {
@@ -2046,19 +2107,19 @@
2046
2107
  className: "chat"
2047
2108
  }, /*#__PURE__*/React__default['default'].createElement("div", {
2048
2109
  className: "chat_newMessage"
2049
- }, this.renderChatInput()), /*#__PURE__*/React__default['default'].createElement("div", {
2110
+ }, this.renderChatInput()), this.renderReplyTo(), /*#__PURE__*/React__default['default'].createElement("div", {
2050
2111
  ref: function ref(_ref6) {
2051
- return _this6.chat = _ref6;
2112
+ return _this8.chat = _ref6;
2052
2113
  },
2053
2114
  className: "chat_messages"
2054
2115
  }, ___default['default'].isEmpty(this.state.messages) && !___default['default'].isEmpty(this.state.messageDate) && this.renderEmptyDate(), this.state.messages.map(function (m) {
2055
- return _this6.renderMessage(m);
2116
+ return _this8.renderMessage(m);
2056
2117
  }))))));
2057
2118
  }
2058
2119
  }]);
2059
2120
 
2060
2121
  return Circle;
2061
- }(React$1.Component);
2122
+ }(React.Component);
2062
2123
 
2063
2124
  var mapStateToProps = function mapStateToProps(state) {
2064
2125
  var circles = state[values.reducerKey].circles;
@@ -2139,7 +2200,7 @@
2139
2200
  }]);
2140
2201
 
2141
2202
  return ViewWidget;
2142
- }(React$1.Component);
2203
+ }(React.Component);
2143
2204
 
2144
2205
  var styles$3 = {
2145
2206
  image: {
@@ -2176,7 +2237,7 @@
2176
2237
  }]);
2177
2238
 
2178
2239
  return ViewFull;
2179
- }(React$1.Component);
2240
+ }(React.Component);
2180
2241
 
2181
2242
  var styles$2 = {
2182
2243
  image: {
@@ -2230,7 +2291,7 @@
2230
2291
  }]);
2231
2292
 
2232
2293
  return PreviewWidget;
2233
- }(React$1.Component);
2294
+ }(React.Component);
2234
2295
 
2235
2296
  var styles$1 = {
2236
2297
  container: {
@@ -2284,7 +2345,7 @@
2284
2345
  }]);
2285
2346
 
2286
2347
  return PreviewFull;
2287
- }(React$1.Component);
2348
+ }(React.Component);
2288
2349
 
2289
2350
  var styles = {
2290
2351
  container: {
@@ -2327,7 +2388,7 @@
2327
2388
  }]);
2328
2389
 
2329
2390
  return PreviewGrid;
2330
- }(React$1.Component);
2391
+ }(React.Component);
2331
2392
 
2332
2393
  var Components = PlussCore__namespace.Components,
2333
2394
  Colours = PlussCore__namespace.Colours;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plusscommunities/pluss-circles-web",
3
- "version": "1.0.16-beta.0",
3
+ "version": "1.0.17",
4
4
  "description": "Extension package to enable circles on Pluss Communities Platform",
5
5
  "main": "dist/index.cjs.js",
6
6
  "scripts": {
@@ -35,7 +35,7 @@
35
35
  },
36
36
  "dependencies": {
37
37
  "@babel/runtime": "^7.14.0",
38
- "@plusscommunities/pluss-core-web": "1.4.14-beta.0",
38
+ "@plusscommunities/pluss-core-web": "1.4.17",
39
39
  "lodash": "^4.17.4",
40
40
  "moment": "^2.18.1",
41
41
  "react": "^16.14.0",
@@ -1,6 +1,7 @@
1
1
  // import * as PlussCore from '../../pluss-core/src';
2
2
  import _ from 'lodash';
3
3
  import * as PlussCore from '@plusscommunities/pluss-core-web';
4
+ import React from 'react';
4
5
  import { values } from './values.config';
5
6
 
6
7
  export { PlussCore };
@@ -25,6 +25,7 @@ class Circle extends Component {
25
25
  images: [],
26
26
  files: [],
27
27
  membersExpanded: true,
28
+ replyingTo: null,
28
29
  };
29
30
  }
30
31
 
@@ -189,6 +190,16 @@ class Circle extends Component {
189
190
  });
190
191
  };
191
192
 
193
+ onReply = (m) => {
194
+ this.setState({
195
+ replyingTo: m,
196
+ });
197
+ if (m) {
198
+ const input = document.getElementById('messageInput');
199
+ if (input) input.focus();
200
+ }
201
+ };
202
+
192
203
  isMember() {
193
204
  const audience = this.getCircle().Audience || [];
194
205
  return _.some(audience, (u) => {
@@ -268,6 +279,10 @@ class Circle extends Component {
268
279
  return;
269
280
  }
270
281
 
282
+ if (this.state.replyingTo) {
283
+ message.replyingTo = this.state.replyingTo;
284
+ }
285
+
271
286
  const clonedMessage = _.cloneDeep(message);
272
287
  clonedMessage.uploading = true;
273
288
 
@@ -287,6 +302,7 @@ class Circle extends Component {
287
302
  fileInputShowing: false,
288
303
  });
289
304
  setTimeout(() => {
305
+ this.onReply(null);
290
306
  this.scrollToBottom();
291
307
  this.imageInput && this.imageInput.getWrappedInstance().setValue(null);
292
308
  this.fileInput && this.fileInput.getWrappedInstance().setValue(null);
@@ -391,7 +407,15 @@ class Circle extends Component {
391
407
  <div className="message_bubbleContainer">
392
408
  <Components.Text type="body" className="message_name">
393
409
  {m.user.name}
410
+ {m.replyingTo ? ` replied to ${m.replyingTo.user.name}` : ''}
394
411
  </Components.Text>
412
+ {m.replyingTo && (
413
+ <div className="message_replyBubble">
414
+ <Components.Text type="body" className="message_text">
415
+ {Helper.toParagraphed((m.replyingTo.text || '').substr(0, 100))}
416
+ </Components.Text>
417
+ </div>
418
+ )}
395
419
  <div className="message_bubble">
396
420
  <Components.Text type="body" className="message_text">
397
421
  {Helper.toParagraphed(m.text)}
@@ -411,6 +435,16 @@ class Circle extends Component {
411
435
  })}
412
436
  </div>
413
437
  </div>
438
+ <div className="message_reply">
439
+ <Components.Text
440
+ type="button"
441
+ onClick={() => {
442
+ this.onReply(m);
443
+ }}
444
+ >
445
+ Reply
446
+ </Components.Text>
447
+ </div>
414
448
  </div>
415
449
  </div>
416
450
  </div>
@@ -512,6 +546,31 @@ class Circle extends Component {
512
546
  );
513
547
  }
514
548
 
549
+ renderReplyTo() {
550
+ if (!this.state.replyingTo) {
551
+ return null;
552
+ }
553
+ const m = this.state.replyingTo;
554
+ return (
555
+ <div className="chat_replyTo">
556
+ <div className="chat_replyTo_container">
557
+ <Components.Text type="h5">Replying to {m && m.user && !_.isEmpty(m.user.displayName) ? m.user.displayName : ''}</Components.Text>
558
+ {m && !_.isEmpty(m.text) && <Components.Text type="body">{m.text.substr(0, 50)}</Components.Text>}
559
+ </div>
560
+ <div className="chat_replyTo_remove">
561
+ <Components.SVGIcon
562
+ className="removeIcon"
563
+ icon="close"
564
+ onClick={() => {
565
+ this.onReply(null);
566
+ }}
567
+ colour={Colours.COLOUR_DUSK}
568
+ />
569
+ </div>
570
+ </div>
571
+ );
572
+ }
573
+
515
574
  render() {
516
575
  return (
517
576
  <Components.OverlayPage fullPage fullPageStyle={{ display: 'flex', flexDirection: 'column' }}>
@@ -562,6 +621,7 @@ class Circle extends Component {
562
621
  </Components.Header>
563
622
  <div className="chat">
564
623
  <div className="chat_newMessage">{this.renderChatInput()}</div>
624
+ {this.renderReplyTo()}
565
625
  <div ref={(ref) => (this.chat = ref)} className="chat_messages">
566
626
  {_.isEmpty(this.state.messages) && !_.isEmpty(this.state.messageDate) && this.renderEmptyDate()}
567
627
  {this.state.messages.map((m) => {