@plusscommunities/pluss-circles-web-groups 1.5.3 → 1.5.5-auth.0
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.cjs.js +302 -112
- package/dist/index.esm.js +302 -112
- package/dist/index.umd.js +302 -112
- package/package.json +8 -3
- package/package.json-e +52 -0
- package/src/apis/circleActions.js +10 -0
- package/src/screens/AddCircle.js +537 -478
- package/src/screens/Circle.js +852 -751
- package/src/screens/Circles.js +558 -376
- package/src/screens/Circles.module.css +96 -0
package/dist/index.umd.js
CHANGED
|
@@ -356,12 +356,46 @@
|
|
|
356
356
|
}
|
|
357
357
|
|
|
358
358
|
return deleteMessage;
|
|
359
|
+
}(),
|
|
360
|
+
markAsRead: function () {
|
|
361
|
+
var _markAsRead = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee4(circleId, userId) {
|
|
362
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee4$(_context4) {
|
|
363
|
+
while (1) {
|
|
364
|
+
switch (_context4.prev = _context4.next) {
|
|
365
|
+
case 0:
|
|
366
|
+
return _context4.abrupt("return", Session$4.authedFunction({
|
|
367
|
+
method: 'post',
|
|
368
|
+
url: Helper$3.getUrl('groups', 'resetunread'),
|
|
369
|
+
data: {
|
|
370
|
+
groupID: circleId,
|
|
371
|
+
userID: userId
|
|
372
|
+
}
|
|
373
|
+
}));
|
|
374
|
+
|
|
375
|
+
case 1:
|
|
376
|
+
case "end":
|
|
377
|
+
return _context4.stop();
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
}, _callee4);
|
|
381
|
+
}));
|
|
382
|
+
|
|
383
|
+
function markAsRead(_x9, _x10) {
|
|
384
|
+
return _markAsRead.apply(this, arguments);
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
return markAsRead;
|
|
359
388
|
}()
|
|
360
389
|
};
|
|
361
390
|
|
|
362
391
|
var Apis$1 = PlussCore__namespace.Apis;
|
|
363
392
|
var analyticsActions = Apis$1.analyticsActions;
|
|
364
393
|
|
|
394
|
+
var e=[],t=[];function n(n,r){if(n&&"undefined"!=typeof document){var a,s=!0===r.prepend?"prepend":"append",d=!0===r.singleTag,i="string"==typeof r.container?document.querySelector(r.container):document.getElementsByTagName("head")[0];if(d){var u=e.indexOf(i);-1===u&&(u=e.push(i)-1,t[u]={}),a=t[u]&&t[u][s]?t[u][s]:t[u][s]=c();}else a=c();65279===n.charCodeAt(0)&&(n=n.substring(1)),a.styleSheet?a.styleSheet.cssText+=n:a.appendChild(document.createTextNode(n));}function c(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),r.attributes)for(var t=Object.keys(r.attributes),n=0;n<t.length;n++)e.setAttribute(t[n],r.attributes[t[n]]);var a="prepend"===s?"afterbegin":"beforeend";return i.insertAdjacentElement(a,e),e}}
|
|
395
|
+
|
|
396
|
+
var css = "/* Badge styling for unread count */\n:root {\n --badge-bg-color: #597db4; /* COLOUR_BRANDING_OFF */\n}\n\n.badgeTag {\n font-size: 11px;\n font-weight: 400;\n padding: 3px 10px;\n background-color: var(--badge-bg-color) !important;\n color: #fff !important;\n border-radius: 999px !important;\n border: none !important;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n line-height: 1;\n letter-spacing: 0.02em;\n}\n\n/* Unread filter info banner */\n.unreadFilterBanner {\n background-color: #f0f4f8;\n border-left: 3px solid var(--badge-bg-color);\n border-radius: 4px;\n padding: 12px 16px;\n margin-top: 16px;\n margin-bottom: 16px;\n display: flex;\n align-items: center;\n}\n\n.unreadFilterContent {\n display: flex;\n align-items: center;\n gap: 10px;\n width: 100%;\n}\n\n.unreadFilterIcon {\n font-size: 16px;\n color: var(--badge-bg-color);\n flex-shrink: 0;\n}\n\n.unreadFilterText {\n font-size: 14px;\n line-height: 1.5;\n color: #333333;\n}\n\n.unreadFilterButton {\n background: none;\n border: none;\n color: var(--badge-bg-color);\n font-size: 14px;\n font-weight: 500;\n text-decoration: underline;\n cursor: pointer;\n padding: 4px 8px;\n margin-left: 4px;\n min-height: 32px;\n min-width: 32px;\n transition: all 0.2s ease;\n}\n\n.unreadFilterButton:hover {\n background-color: rgba(89, 125, 180, 0.1);\n text-decoration: none;\n}\n\n.unreadFilterButton:focus {\n outline: 2px solid var(--badge-bg-color);\n outline-offset: 2px;\n border-radius: 2px;\n}\n\n/* Mobile responsiveness */\n@media (max-width: 768px) {\n .unreadFilterBanner {\n flex-direction: column;\n align-items: flex-start;\n padding: 12px;\n }\n\n .unreadFilterContent {\n flex-direction: column;\n align-items: flex-start;\n gap: 8px;\n }\n\n .unreadFilterText {\n font-size: 13px;\n }\n}\n\n";
|
|
397
|
+
n(css,{});
|
|
398
|
+
|
|
365
399
|
function _createSuper$7(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$7(); return function _createSuperInternal() { var Super = _getPrototypeOf__default['default'](Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf__default['default'](this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn__default['default'](this, result); }; }
|
|
366
400
|
|
|
367
401
|
function _isNativeReflectConstruct$7() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
@@ -398,7 +432,7 @@
|
|
|
398
432
|
|
|
399
433
|
case 3:
|
|
400
434
|
res = _context.sent;
|
|
401
|
-
console.log(
|
|
435
|
+
console.log("getData", res.data);
|
|
402
436
|
|
|
403
437
|
_this.props.circlesLoaded(res.data);
|
|
404
438
|
|
|
@@ -412,7 +446,7 @@
|
|
|
412
446
|
case 9:
|
|
413
447
|
_context.prev = 9;
|
|
414
448
|
_context.t0 = _context["catch"](0);
|
|
415
|
-
console.error(
|
|
449
|
+
console.error("getData", _context.t0);
|
|
416
450
|
|
|
417
451
|
_this.setState({
|
|
418
452
|
loadingAll: false
|
|
@@ -427,6 +461,12 @@
|
|
|
427
461
|
})));
|
|
428
462
|
});
|
|
429
463
|
|
|
464
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "selectUnreadFilter", function (showUnreadOnly) {
|
|
465
|
+
_this.setState({
|
|
466
|
+
showUnreadOnly: showUnreadOnly
|
|
467
|
+
});
|
|
468
|
+
});
|
|
469
|
+
|
|
430
470
|
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "canAddNew", function () {
|
|
431
471
|
var auth = _this.props.auth;
|
|
432
472
|
return Session$3.validateAccess(auth.site, values.permission, auth);
|
|
@@ -494,9 +534,15 @@
|
|
|
494
534
|
});
|
|
495
535
|
});
|
|
496
536
|
|
|
537
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "selectSort", function (sortType) {
|
|
538
|
+
_this.setState({
|
|
539
|
+
sortBy: sortType
|
|
540
|
+
});
|
|
541
|
+
});
|
|
542
|
+
|
|
497
543
|
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onHandleChange", function (event) {
|
|
498
544
|
var stateChange = {};
|
|
499
|
-
stateChange[event.target.getAttribute(
|
|
545
|
+
stateChange[event.target.getAttribute("id")] = event.target.value;
|
|
500
546
|
|
|
501
547
|
_this.setState(stateChange);
|
|
502
548
|
});
|
|
@@ -508,14 +554,14 @@
|
|
|
508
554
|
circleActions.delete(circle.Id).then(function (res) {
|
|
509
555
|
_this.getData();
|
|
510
556
|
}).catch(function (res) {
|
|
511
|
-
alert(
|
|
557
|
+
alert("Something went wrong with the request. Please try again.");
|
|
512
558
|
});
|
|
513
559
|
}
|
|
514
560
|
});
|
|
515
561
|
|
|
516
562
|
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "getTypeFilterText", function (type) {
|
|
517
|
-
if (type ===
|
|
518
|
-
return
|
|
563
|
+
if (type === "private") {
|
|
564
|
+
return "Private Message";
|
|
519
565
|
}
|
|
520
566
|
|
|
521
567
|
return ___default['default'].capitalize(values.entityName);
|
|
@@ -525,14 +571,17 @@
|
|
|
525
571
|
if (circle.IsPrivate) {
|
|
526
572
|
return "PM: ".concat(circle.Audience.map(function (user) {
|
|
527
573
|
return user.displayName;
|
|
528
|
-
}).join(
|
|
574
|
+
}).join(", "));
|
|
529
575
|
}
|
|
530
576
|
|
|
531
577
|
return circle.Title;
|
|
532
578
|
});
|
|
533
579
|
|
|
534
580
|
_this.state = {
|
|
535
|
-
userSearch:
|
|
581
|
+
userSearch: "",
|
|
582
|
+
sortBy: "newest",
|
|
583
|
+
showUnreadOnly: false,
|
|
584
|
+
pollingInterval: null
|
|
536
585
|
};
|
|
537
586
|
return _this;
|
|
538
587
|
}
|
|
@@ -540,27 +589,77 @@
|
|
|
540
589
|
_createClass__default['default'](Circles, [{
|
|
541
590
|
key: "componentDidMount",
|
|
542
591
|
value: function componentDidMount() {
|
|
543
|
-
this
|
|
592
|
+
var _this2 = this;
|
|
593
|
+
|
|
594
|
+
this.getData(); // Poll for updates every 10 seconds
|
|
595
|
+
|
|
596
|
+
this.pollingInterval = setInterval(function () {
|
|
597
|
+
_this2.getData();
|
|
598
|
+
}, 10000);
|
|
599
|
+
}
|
|
600
|
+
}, {
|
|
601
|
+
key: "componentWillUnmount",
|
|
602
|
+
value: function componentWillUnmount() {
|
|
603
|
+
if (this.pollingInterval) {
|
|
604
|
+
clearInterval(this.pollingInterval);
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
}, {
|
|
608
|
+
key: "isCircleUnread",
|
|
609
|
+
value: function isCircleUnread(circle) {
|
|
610
|
+
var userId = this.props.user.Id;
|
|
611
|
+
|
|
612
|
+
if (!circle.Unread || !circle.Unread[userId]) {
|
|
613
|
+
return false;
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
return circle.Unread[userId] > 0;
|
|
617
|
+
}
|
|
618
|
+
}, {
|
|
619
|
+
key: "getUnreadCount",
|
|
620
|
+
value: function getUnreadCount(circle) {
|
|
621
|
+
var userId = this.props.user.Id;
|
|
622
|
+
|
|
623
|
+
if (!circle.Unread || !circle.Unread[userId]) {
|
|
624
|
+
return 0;
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
return circle.Unread[userId];
|
|
544
628
|
}
|
|
545
629
|
}, {
|
|
546
630
|
key: "getCircles",
|
|
547
631
|
value: function getCircles() {
|
|
548
|
-
var
|
|
632
|
+
var _this3 = this;
|
|
549
633
|
|
|
550
634
|
var result = this.props.circles;
|
|
551
635
|
|
|
552
636
|
if (this.state.selectedTypeFilter) {
|
|
553
637
|
result = ___default['default'].filter(result, function (circle) {
|
|
554
|
-
return
|
|
638
|
+
return _this3.state.selectedTypeFilter === "circle" ? !circle.IsPrivate : circle.IsPrivate;
|
|
555
639
|
});
|
|
556
640
|
}
|
|
557
641
|
|
|
558
642
|
if (this.state.selectedUserFilter) {
|
|
559
643
|
result = ___default['default'].filter(result, function (circle) {
|
|
560
644
|
return ___default['default'].some(circle.Audience, function (user) {
|
|
561
|
-
return user.userId ===
|
|
645
|
+
return user.userId === _this3.state.selectedUserFilter.userId;
|
|
562
646
|
});
|
|
563
647
|
});
|
|
648
|
+
} // Apply sorting
|
|
649
|
+
|
|
650
|
+
|
|
651
|
+
result = ___default['default'].sortBy(result, function (circle) {
|
|
652
|
+
return moment__default['default'](circle.Changed).valueOf();
|
|
653
|
+
});
|
|
654
|
+
|
|
655
|
+
if (this.state.sortBy === "newest") {
|
|
656
|
+
result.reverse();
|
|
657
|
+
|
|
658
|
+
if (this.state.showUnreadOnly) {
|
|
659
|
+
result = ___default['default'].filter(result, function (circle) {
|
|
660
|
+
return _this3.isCircleUnread(circle);
|
|
661
|
+
});
|
|
662
|
+
}
|
|
564
663
|
}
|
|
565
664
|
|
|
566
665
|
return result;
|
|
@@ -568,7 +667,7 @@
|
|
|
568
667
|
}, {
|
|
569
668
|
key: "getUsers",
|
|
570
669
|
value: function getUsers() {
|
|
571
|
-
var
|
|
670
|
+
var _this4 = this;
|
|
572
671
|
|
|
573
672
|
var users = [];
|
|
574
673
|
this.props.circles.forEach(function (circle) {
|
|
@@ -578,10 +677,10 @@
|
|
|
578
677
|
});
|
|
579
678
|
users = ___default['default'].sortBy(___default['default'].uniqBy(users, function (user) {
|
|
580
679
|
return user.userId;
|
|
581
|
-
}),
|
|
680
|
+
}), "displayName");
|
|
582
681
|
return ___default['default'].filter(users, function (u) {
|
|
583
|
-
if (!___default['default'].isEmpty(
|
|
584
|
-
return (u.displayName ||
|
|
682
|
+
if (!___default['default'].isEmpty(_this4.state.userSearch)) {
|
|
683
|
+
return (u.displayName || "").toLowerCase().indexOf(_this4.state.userSearch.toLowerCase()) > -1;
|
|
585
684
|
}
|
|
586
685
|
|
|
587
686
|
return true;
|
|
@@ -590,7 +689,7 @@
|
|
|
590
689
|
}, {
|
|
591
690
|
key: "validateCircleAdmin",
|
|
592
691
|
value: function validateCircleAdmin(circle, onlyCreator) {
|
|
593
|
-
var
|
|
692
|
+
var _this5 = this;
|
|
594
693
|
|
|
595
694
|
if (Session$3.validateAccess(this.props.auth.site, values.permission, this.props.auth)) {
|
|
596
695
|
return true;
|
|
@@ -601,21 +700,31 @@
|
|
|
601
700
|
}
|
|
602
701
|
|
|
603
702
|
return ___default['default'].some(circle.Audience, function (user) {
|
|
604
|
-
return user.userId ===
|
|
703
|
+
return user.userId === _this5.props.user.Id && user.isAdmin;
|
|
605
704
|
});
|
|
606
705
|
}
|
|
607
706
|
}, {
|
|
608
707
|
key: "renderRow",
|
|
609
708
|
value: function renderRow(circle) {
|
|
610
|
-
var
|
|
709
|
+
var _this6 = this;
|
|
611
710
|
|
|
711
|
+
var unreadCount = this.getUnreadCount(circle);
|
|
712
|
+
var badge = unreadCount > 0 ? /*#__PURE__*/React__default['default'].createElement(Components$4.Tag, {
|
|
713
|
+
className: css.badgeTag,
|
|
714
|
+
text: "".concat(unreadCount, " new")
|
|
715
|
+
}) : null;
|
|
612
716
|
return /*#__PURE__*/React__default['default'].createElement("tr", {
|
|
613
717
|
key: circle.Id
|
|
614
718
|
}, /*#__PURE__*/React__default['default'].createElement("td", {
|
|
615
719
|
className: "table-TitleColumn"
|
|
720
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
721
|
+
className: "flex flex-center",
|
|
722
|
+
style: {
|
|
723
|
+
gap: "8px"
|
|
724
|
+
}
|
|
616
725
|
}, /*#__PURE__*/React__default['default'].createElement(reactRouterDom.Link, {
|
|
617
726
|
to: "/".concat(values.featureKey, "/").concat(values.entityKey, "/").concat(circle.Id)
|
|
618
|
-
}, this.getTitle(circle))), /*#__PURE__*/React__default['default'].createElement("td", null, moment__default['default'](circle.Changed).local().format(
|
|
727
|
+
}, this.getTitle(circle)), badge)), /*#__PURE__*/React__default['default'].createElement("td", null, moment__default['default'](circle.Changed).local().format("D MMM YYYY")), /*#__PURE__*/React__default['default'].createElement("td", null, circle.Audience.map(function (user) {
|
|
619
728
|
return /*#__PURE__*/React__default['default'].createElement(Components$4.ProfilePic, {
|
|
620
729
|
size: 30,
|
|
621
730
|
image: user.profilePic,
|
|
@@ -626,8 +735,8 @@
|
|
|
626
735
|
className: "table-options"
|
|
627
736
|
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
628
737
|
style: {
|
|
629
|
-
display:
|
|
630
|
-
alignItems:
|
|
738
|
+
display: "flex",
|
|
739
|
+
alignItems: "center"
|
|
631
740
|
}
|
|
632
741
|
}, this.validateCircleAdmin(circle) && !circle.IsPrivate && /*#__PURE__*/React__default['default'].createElement(reactRouterDom.Link, {
|
|
633
742
|
to: "/".concat(values.featureKey, "/edit/").concat(circle.Id)
|
|
@@ -636,31 +745,69 @@
|
|
|
636
745
|
fontSize: 20,
|
|
637
746
|
padding: 5,
|
|
638
747
|
marginLeft: 12,
|
|
639
|
-
cursor:
|
|
748
|
+
cursor: "pointer"
|
|
640
749
|
},
|
|
641
750
|
name: "pencil"
|
|
642
751
|
})), this.validateCircleAdmin(circle, true) && !circle.IsPrivate && /*#__PURE__*/React__default['default'].createElement("a", {
|
|
643
752
|
onClick: function onClick() {
|
|
644
|
-
|
|
753
|
+
_this6.removeCircle(circle);
|
|
645
754
|
}
|
|
646
755
|
}, /*#__PURE__*/React__default['default'].createElement(FontAwesome__default['default'], {
|
|
647
756
|
style: {
|
|
648
757
|
fontSize: 20,
|
|
649
758
|
padding: 5,
|
|
650
759
|
marginLeft: 12,
|
|
651
|
-
cursor:
|
|
760
|
+
cursor: "pointer"
|
|
652
761
|
},
|
|
653
762
|
name: "minus-circle"
|
|
654
763
|
})))));
|
|
655
764
|
}
|
|
765
|
+
}, {
|
|
766
|
+
key: "renderUnreadFilterInfo",
|
|
767
|
+
value: function renderUnreadFilterInfo() {
|
|
768
|
+
var _this7 = this;
|
|
769
|
+
|
|
770
|
+
var showUnreadOnly = this.state.showUnreadOnly;
|
|
771
|
+
|
|
772
|
+
if (!showUnreadOnly) {
|
|
773
|
+
return null;
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
777
|
+
className: css.unreadFilterBanner
|
|
778
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
779
|
+
className: css.unreadFilterContent
|
|
780
|
+
}, /*#__PURE__*/React__default['default'].createElement(FontAwesome__default['default'], {
|
|
781
|
+
name: "info-circle",
|
|
782
|
+
className: css.unreadFilterIcon
|
|
783
|
+
}), /*#__PURE__*/React__default['default'].createElement("span", {
|
|
784
|
+
className: css.unreadFilterText
|
|
785
|
+
}, "Showing only items with new messages.", " ", /*#__PURE__*/React__default['default'].createElement("button", {
|
|
786
|
+
className: css.unreadFilterButton,
|
|
787
|
+
onClick: function onClick() {
|
|
788
|
+
return _this7.selectUnreadFilter(false);
|
|
789
|
+
},
|
|
790
|
+
"aria-label": "Turn off unread filter"
|
|
791
|
+
}, "Turn off filter"))));
|
|
792
|
+
}
|
|
656
793
|
}, {
|
|
657
794
|
key: "renderFilters",
|
|
658
795
|
value: function renderFilters() {
|
|
796
|
+
var _this8 = this;
|
|
797
|
+
|
|
659
798
|
var userFilter = /*#__PURE__*/React__default['default'].createElement(Components$4.Tag, {
|
|
660
799
|
className: "marginRight-10",
|
|
661
800
|
onClick: this.openUserFilter,
|
|
662
801
|
text: "User"
|
|
663
802
|
});
|
|
803
|
+
var unreadFilter = /*#__PURE__*/React__default['default'].createElement(Components$4.Tag, {
|
|
804
|
+
className: "marginRight-10",
|
|
805
|
+
onClick: function onClick() {
|
|
806
|
+
return _this8.selectUnreadFilter(!_this8.state.showUnreadOnly);
|
|
807
|
+
},
|
|
808
|
+
leftIcon: this.state.showUnreadOnly ? "check" : null,
|
|
809
|
+
text: "Unread Only"
|
|
810
|
+
});
|
|
664
811
|
var typeFilter = /*#__PURE__*/React__default['default'].createElement(Components$4.Tag, {
|
|
665
812
|
className: "marginRight-10",
|
|
666
813
|
onClick: this.openTypeFilter,
|
|
@@ -695,12 +842,28 @@
|
|
|
695
842
|
}, /*#__PURE__*/React__default['default'].createElement(Components$4.Text, {
|
|
696
843
|
type: "h5",
|
|
697
844
|
className: "marginRight-20"
|
|
698
|
-
}, "Filter by"), userFilter, typeFilter
|
|
845
|
+
}, "Filter by"), userFilter, typeFilter, unreadFilter, /*#__PURE__*/React__default['default'].createElement(Components$4.Text, {
|
|
846
|
+
type: "h5",
|
|
847
|
+
className: "marginRight-20 marginLeft-20"
|
|
848
|
+
}, "Sort by:"), /*#__PURE__*/React__default['default'].createElement(Components$4.Tag, {
|
|
849
|
+
className: "marginRight-10",
|
|
850
|
+
onClick: function onClick() {
|
|
851
|
+
return _this8.selectSort("newest");
|
|
852
|
+
},
|
|
853
|
+
leftIcon: this.state.sortBy === "newest" ? "check" : null,
|
|
854
|
+
text: "Newest first"
|
|
855
|
+
}), /*#__PURE__*/React__default['default'].createElement(Components$4.Tag, {
|
|
856
|
+
onClick: function onClick() {
|
|
857
|
+
return _this8.selectSort("oldest");
|
|
858
|
+
},
|
|
859
|
+
leftIcon: this.state.sortBy === "oldest" ? "check" : null,
|
|
860
|
+
text: "Oldest first"
|
|
861
|
+
}));
|
|
699
862
|
}
|
|
700
863
|
}, {
|
|
701
864
|
key: "renderUserFilterPopup",
|
|
702
865
|
value: function renderUserFilterPopup() {
|
|
703
|
-
var
|
|
866
|
+
var _this9 = this;
|
|
704
867
|
|
|
705
868
|
if (!this.state.userFilterOpen) {
|
|
706
869
|
return null;
|
|
@@ -720,7 +883,7 @@
|
|
|
720
883
|
placeholder: "Enter name",
|
|
721
884
|
value: this.state.userSearch,
|
|
722
885
|
onChange: function onChange(e) {
|
|
723
|
-
return
|
|
886
|
+
return _this9.onHandleChange(e);
|
|
724
887
|
},
|
|
725
888
|
alwaysShowLabel: true
|
|
726
889
|
}), this.getUsers().map(function (user) {
|
|
@@ -728,7 +891,7 @@
|
|
|
728
891
|
key: user.userId,
|
|
729
892
|
user: user,
|
|
730
893
|
onClick: function onClick() {
|
|
731
|
-
|
|
894
|
+
_this9.selectUserFilter(user);
|
|
732
895
|
}
|
|
733
896
|
});
|
|
734
897
|
}));
|
|
@@ -736,7 +899,7 @@
|
|
|
736
899
|
}, {
|
|
737
900
|
key: "renderTypeFilterPopup",
|
|
738
901
|
value: function renderTypeFilterPopup() {
|
|
739
|
-
var
|
|
902
|
+
var _this10 = this;
|
|
740
903
|
|
|
741
904
|
if (!this.state.typeFilterOpen) {
|
|
742
905
|
return null;
|
|
@@ -750,13 +913,13 @@
|
|
|
750
913
|
onClose: this.closeTypeFilter
|
|
751
914
|
}, /*#__PURE__*/React__default['default'].createElement(Components$4.Tag, {
|
|
752
915
|
onClick: function onClick() {
|
|
753
|
-
|
|
916
|
+
_this10.selectTypeFilter("circle");
|
|
754
917
|
},
|
|
755
918
|
text: ___default['default'].capitalize(values.entityName),
|
|
756
919
|
className: "marginRight-10"
|
|
757
920
|
}), /*#__PURE__*/React__default['default'].createElement(Components$4.Tag, {
|
|
758
921
|
onClick: function onClick() {
|
|
759
|
-
|
|
922
|
+
_this10.selectTypeFilter("private");
|
|
760
923
|
},
|
|
761
924
|
text: "Private Message"
|
|
762
925
|
}));
|
|
@@ -764,7 +927,7 @@
|
|
|
764
927
|
}, {
|
|
765
928
|
key: "render",
|
|
766
929
|
value: function render() {
|
|
767
|
-
var
|
|
930
|
+
var _this11 = this;
|
|
768
931
|
|
|
769
932
|
return /*#__PURE__*/React__default['default'].createElement("div", null, this.renderTypeFilterPopup(), this.renderUserFilterPopup(), /*#__PURE__*/React__default['default'].createElement(Components$4.Header, null, this.canAddNew() && /*#__PURE__*/React__default['default'].createElement(Components$4.AddButton, {
|
|
770
933
|
onClick: this.onAddNew,
|
|
@@ -774,21 +937,21 @@
|
|
|
774
937
|
}, /*#__PURE__*/React__default['default'].createElement(Components$4.Text, {
|
|
775
938
|
type: "h1",
|
|
776
939
|
className: ""
|
|
777
|
-
}, values.textFeatureTitle), this.renderFilters(), /*#__PURE__*/React__default['default'].createElement(reactBootstrap.Table, {
|
|
940
|
+
}, values.textFeatureTitle), this.renderFilters(), this.renderUnreadFilterInfo(), /*#__PURE__*/React__default['default'].createElement(reactBootstrap.Table, {
|
|
778
941
|
className: "plussTable",
|
|
779
942
|
striped: true,
|
|
780
943
|
bordered: true,
|
|
781
944
|
condensed: true,
|
|
782
945
|
hover: true,
|
|
783
946
|
style: {
|
|
784
|
-
minWidth:
|
|
947
|
+
minWidth: "100%"
|
|
785
948
|
}
|
|
786
949
|
}, /*#__PURE__*/React__default['default'].createElement("thead", null, /*#__PURE__*/React__default['default'].createElement("tr", null, /*#__PURE__*/React__default['default'].createElement("th", null, "Title"), /*#__PURE__*/React__default['default'].createElement("th", null, "Last updated"), /*#__PURE__*/React__default['default'].createElement("th", null, "Members"), /*#__PURE__*/React__default['default'].createElement("th", {
|
|
787
950
|
style: {
|
|
788
951
|
width: 50
|
|
789
952
|
}
|
|
790
953
|
}))), /*#__PURE__*/React__default['default'].createElement("tbody", null, this.getCircles().map(function (circle) {
|
|
791
|
-
return
|
|
954
|
+
return _this11.renderRow(circle);
|
|
792
955
|
})))));
|
|
793
956
|
}
|
|
794
957
|
}]);
|
|
@@ -850,7 +1013,7 @@
|
|
|
850
1013
|
if (res.data != null && !___default['default'].isEmpty(res.data.results.Items)) {
|
|
851
1014
|
_this.setState({
|
|
852
1015
|
users: ___default['default'].sortBy(res.data.results.Items, function (u) {
|
|
853
|
-
return (u.displayName ||
|
|
1016
|
+
return (u.displayName || "").toLowerCase();
|
|
854
1017
|
}).map(function (u) {
|
|
855
1018
|
return _objectSpread$4(_objectSpread$4({}, u), {}, {
|
|
856
1019
|
userId: u.userId || u.Id
|
|
@@ -874,7 +1037,7 @@
|
|
|
874
1037
|
}
|
|
875
1038
|
|
|
876
1039
|
if (!___default['default'].isEmpty(_this.state.userSearch)) {
|
|
877
|
-
return (u.displayName ||
|
|
1040
|
+
return (u.displayName || "").toLowerCase().indexOf(_this.state.userSearch.toLowerCase()) > -1;
|
|
878
1041
|
}
|
|
879
1042
|
|
|
880
1043
|
return true;
|
|
@@ -928,7 +1091,7 @@
|
|
|
928
1091
|
|
|
929
1092
|
case 3:
|
|
930
1093
|
res = _context.sent;
|
|
931
|
-
console.log(
|
|
1094
|
+
console.log("getData", res.data);
|
|
932
1095
|
circle = ___default['default'].find(res.data, function (c) {
|
|
933
1096
|
return c.Id === _this.state.circleId;
|
|
934
1097
|
});
|
|
@@ -948,7 +1111,7 @@
|
|
|
948
1111
|
case 11:
|
|
949
1112
|
_context.prev = 11;
|
|
950
1113
|
_context.t0 = _context["catch"](0);
|
|
951
|
-
console.error(
|
|
1114
|
+
console.error("getData", _context.t0);
|
|
952
1115
|
|
|
953
1116
|
_this.setState({
|
|
954
1117
|
loadingAll: false
|
|
@@ -965,7 +1128,7 @@
|
|
|
965
1128
|
|
|
966
1129
|
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onHandleChange", function (event) {
|
|
967
1130
|
var stateChange = {};
|
|
968
|
-
stateChange[event.target.getAttribute(
|
|
1131
|
+
stateChange[event.target.getAttribute("id")] = event.target.value;
|
|
969
1132
|
|
|
970
1133
|
_this.setState(stateChange);
|
|
971
1134
|
});
|
|
@@ -988,7 +1151,7 @@
|
|
|
988
1151
|
};
|
|
989
1152
|
|
|
990
1153
|
if (___default['default'].isEmpty(_this.state.title) && ___default['default'].includes(newState.selectedUsers, user)) {
|
|
991
|
-
newState.title = "".concat(user.displayName.split(
|
|
1154
|
+
newState.title = "".concat(user.displayName.split(" ")[0], "'s Circle");
|
|
992
1155
|
}
|
|
993
1156
|
|
|
994
1157
|
_this.setState(newState);
|
|
@@ -1029,17 +1192,17 @@
|
|
|
1029
1192
|
updating: false
|
|
1030
1193
|
});
|
|
1031
1194
|
|
|
1032
|
-
console.log(
|
|
1195
|
+
console.log("success");
|
|
1033
1196
|
|
|
1034
1197
|
_this.props.circleUpdated(res.data);
|
|
1035
1198
|
}).catch(function (err) {
|
|
1036
|
-
console.log(
|
|
1199
|
+
console.log("error");
|
|
1037
1200
|
|
|
1038
1201
|
_this.setState({
|
|
1039
1202
|
updating: false
|
|
1040
1203
|
});
|
|
1041
1204
|
|
|
1042
|
-
alert(
|
|
1205
|
+
alert("Something went wrong with the request. Please try again.");
|
|
1043
1206
|
});
|
|
1044
1207
|
} else {
|
|
1045
1208
|
circleActions.add(_this.props.auth.site, _this.state.title, _this.state.image, audience, _this.state.isPublic).then(function (res) {
|
|
@@ -1048,17 +1211,17 @@
|
|
|
1048
1211
|
updating: false
|
|
1049
1212
|
});
|
|
1050
1213
|
|
|
1051
|
-
console.log(
|
|
1214
|
+
console.log("success");
|
|
1052
1215
|
|
|
1053
1216
|
_this.props.circleUpdated(res.data);
|
|
1054
1217
|
}).catch(function (err) {
|
|
1055
|
-
console.log(
|
|
1218
|
+
console.log("error");
|
|
1056
1219
|
|
|
1057
1220
|
_this.setState({
|
|
1058
1221
|
updating: false
|
|
1059
1222
|
});
|
|
1060
1223
|
|
|
1061
|
-
alert(
|
|
1224
|
+
alert("Something went wrong with the request. Please try again.");
|
|
1062
1225
|
});
|
|
1063
1226
|
}
|
|
1064
1227
|
});
|
|
@@ -1079,20 +1242,20 @@
|
|
|
1079
1242
|
});
|
|
1080
1243
|
});
|
|
1081
1244
|
|
|
1082
|
-
var circleId = Helper$1.safeReadParams(props,
|
|
1245
|
+
var circleId = Helper$1.safeReadParams(props, "circleId");
|
|
1083
1246
|
_this.state = {
|
|
1084
1247
|
circleId: circleId,
|
|
1085
1248
|
circle: ___default['default'].find(props.circles, function (c) {
|
|
1086
1249
|
return c.Id === circleId;
|
|
1087
1250
|
}),
|
|
1088
|
-
title:
|
|
1251
|
+
title: "",
|
|
1089
1252
|
showWarnings: false,
|
|
1090
1253
|
success: false,
|
|
1091
1254
|
users: [],
|
|
1092
1255
|
selectedUsers: [],
|
|
1093
|
-
userSearch:
|
|
1256
|
+
userSearch: "",
|
|
1094
1257
|
isPublic: false,
|
|
1095
|
-
selectedOption:
|
|
1258
|
+
selectedOption: "visibility"
|
|
1096
1259
|
};
|
|
1097
1260
|
return _this;
|
|
1098
1261
|
}
|
|
@@ -1114,7 +1277,7 @@
|
|
|
1114
1277
|
this.setState({
|
|
1115
1278
|
image: url
|
|
1116
1279
|
});
|
|
1117
|
-
this.imageInput.
|
|
1280
|
+
this.imageInput.setValue(url);
|
|
1118
1281
|
} else {
|
|
1119
1282
|
setTimeout(function () {
|
|
1120
1283
|
_this2.checkSetImage(url);
|
|
@@ -1147,9 +1310,9 @@
|
|
|
1147
1310
|
value: function renderSuccess() {
|
|
1148
1311
|
if (!this.state.success) return null;
|
|
1149
1312
|
return /*#__PURE__*/React__default['default'].createElement(Components$3.SuccessPopup, {
|
|
1150
|
-
text: "".concat(___default['default'].capitalize(values.entityName), " has been ").concat(this.state.circleId == null ?
|
|
1313
|
+
text: "".concat(___default['default'].capitalize(values.entityName), " has been ").concat(this.state.circleId == null ? "added" : "edited"),
|
|
1151
1314
|
buttons: [{
|
|
1152
|
-
type:
|
|
1315
|
+
type: "outlined",
|
|
1153
1316
|
onClick: function onClick() {
|
|
1154
1317
|
window.history.back();
|
|
1155
1318
|
},
|
|
@@ -1196,7 +1359,7 @@
|
|
|
1196
1359
|
label: "Do you want to make this ".concat(values.entityName, " a public ").concat(values.entityName, "?"),
|
|
1197
1360
|
isActive: this.state.isPublic,
|
|
1198
1361
|
options: [{
|
|
1199
|
-
Label:
|
|
1362
|
+
Label: "Yes",
|
|
1200
1363
|
Value: true,
|
|
1201
1364
|
onChange: function onChange() {
|
|
1202
1365
|
return _this5.setState({
|
|
@@ -1204,7 +1367,7 @@
|
|
|
1204
1367
|
});
|
|
1205
1368
|
}
|
|
1206
1369
|
}, {
|
|
1207
|
-
Label:
|
|
1370
|
+
Label: "No",
|
|
1208
1371
|
Value: false,
|
|
1209
1372
|
onChange: function onChange() {
|
|
1210
1373
|
return _this5.setState({
|
|
@@ -1224,7 +1387,7 @@
|
|
|
1224
1387
|
value: function renderSelectedOption() {
|
|
1225
1388
|
return /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1226
1389
|
style: {
|
|
1227
|
-
display: this.state.selectedOption ===
|
|
1390
|
+
display: this.state.selectedOption === "visibility" ? "block" : "none"
|
|
1228
1391
|
}
|
|
1229
1392
|
}, this.renderVisibility()));
|
|
1230
1393
|
}
|
|
@@ -1232,14 +1395,14 @@
|
|
|
1232
1395
|
key: "renderOptionsSection",
|
|
1233
1396
|
value: function renderOptionsSection() {
|
|
1234
1397
|
var options = [{
|
|
1235
|
-
key:
|
|
1236
|
-
icon:
|
|
1237
|
-
text:
|
|
1398
|
+
key: "visibility",
|
|
1399
|
+
icon: "people3",
|
|
1400
|
+
text: "Visibility"
|
|
1238
1401
|
}];
|
|
1239
1402
|
|
|
1240
1403
|
if (!this.props.circleAllowPublicCircles) {
|
|
1241
1404
|
options = ___default['default'].filter(options, function (o) {
|
|
1242
|
-
return o.key !==
|
|
1405
|
+
return o.key !== "visibility";
|
|
1243
1406
|
});
|
|
1244
1407
|
}
|
|
1245
1408
|
|
|
@@ -1263,7 +1426,7 @@
|
|
|
1263
1426
|
}, /*#__PURE__*/React__default['default'].createElement(Components$3.Text, {
|
|
1264
1427
|
type: "formTitleLarge",
|
|
1265
1428
|
className: "marginBottom-24"
|
|
1266
|
-
}, this.state.circleId == null ?
|
|
1429
|
+
}, this.state.circleId == null ? "New" : "Edit", " ", ___default['default'].capitalize(values.entityName)), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1267
1430
|
className: "flex flex-reverse"
|
|
1268
1431
|
}, /*#__PURE__*/React__default['default'].createElement(Components$3.ImageInput, {
|
|
1269
1432
|
ref: function ref(_ref2) {
|
|
@@ -1447,7 +1610,7 @@
|
|
|
1447
1610
|
|
|
1448
1611
|
case 3:
|
|
1449
1612
|
res = _context.sent;
|
|
1450
|
-
console.log(
|
|
1613
|
+
console.log("getData", res.data);
|
|
1451
1614
|
circle = ___default['default'].find(res.data, function (c) {
|
|
1452
1615
|
return c.Id === _this.state.circleId;
|
|
1453
1616
|
});
|
|
@@ -1465,7 +1628,7 @@
|
|
|
1465
1628
|
case 10:
|
|
1466
1629
|
_context.prev = 10;
|
|
1467
1630
|
_context.t0 = _context["catch"](0);
|
|
1468
|
-
console.error(
|
|
1631
|
+
console.error("getData", _context.t0);
|
|
1469
1632
|
|
|
1470
1633
|
_this.setState({
|
|
1471
1634
|
loadingAll: false
|
|
@@ -1497,8 +1660,8 @@
|
|
|
1497
1660
|
while (1) {
|
|
1498
1661
|
switch (_context2.prev = _context2.next) {
|
|
1499
1662
|
case 0:
|
|
1500
|
-
startOf = moment__default['default'](date,
|
|
1501
|
-
endOf = moment__default['default'](date,
|
|
1663
|
+
startOf = moment__default['default'](date, "YYYY-MM-DD").startOf("d");
|
|
1664
|
+
endOf = moment__default['default'](date, "YYYY-MM-DD").endOf("d");
|
|
1502
1665
|
_context2.next = 4;
|
|
1503
1666
|
return circleActions.getMessages(_this.state.circleId, 10000, startOf.valueOf(), endOf.valueOf());
|
|
1504
1667
|
|
|
@@ -1552,13 +1715,13 @@
|
|
|
1552
1715
|
var circle = _this.state.circle;
|
|
1553
1716
|
|
|
1554
1717
|
if (!circle) {
|
|
1555
|
-
return
|
|
1718
|
+
return "";
|
|
1556
1719
|
}
|
|
1557
1720
|
|
|
1558
1721
|
if (circle.IsPrivate) {
|
|
1559
1722
|
return "PM: ".concat(circle.Audience.map(function (user) {
|
|
1560
1723
|
return user.displayName;
|
|
1561
|
-
}).join(
|
|
1724
|
+
}).join(", "));
|
|
1562
1725
|
}
|
|
1563
1726
|
|
|
1564
1727
|
return circle.Title;
|
|
@@ -1566,13 +1729,13 @@
|
|
|
1566
1729
|
|
|
1567
1730
|
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onHandleChange", function (event) {
|
|
1568
1731
|
var stateChange = {};
|
|
1569
|
-
stateChange[event.target.getAttribute(
|
|
1732
|
+
stateChange[event.target.getAttribute("id")] = event.target.value;
|
|
1570
1733
|
|
|
1571
1734
|
_this.setState(stateChange);
|
|
1572
1735
|
});
|
|
1573
1736
|
|
|
1574
1737
|
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onImageUpdated", function (image) {
|
|
1575
|
-
console.log(
|
|
1738
|
+
console.log("updated image");
|
|
1576
1739
|
console.log(image);
|
|
1577
1740
|
|
|
1578
1741
|
_this.setState({
|
|
@@ -1588,7 +1751,7 @@
|
|
|
1588
1751
|
});
|
|
1589
1752
|
|
|
1590
1753
|
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onFileUpdated", function (url) {
|
|
1591
|
-
console.log(
|
|
1754
|
+
console.log("updated url");
|
|
1592
1755
|
console.log(url);
|
|
1593
1756
|
|
|
1594
1757
|
_this.setState({
|
|
@@ -1609,7 +1772,7 @@
|
|
|
1609
1772
|
});
|
|
1610
1773
|
|
|
1611
1774
|
if (m) {
|
|
1612
|
-
var input = document.getElementById(
|
|
1775
|
+
var input = document.getElementById("messageInput");
|
|
1613
1776
|
if (input) input.focus();
|
|
1614
1777
|
}
|
|
1615
1778
|
});
|
|
@@ -1617,7 +1780,7 @@
|
|
|
1617
1780
|
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "handleMessageDateChange", function (date) {
|
|
1618
1781
|
_this.setState({
|
|
1619
1782
|
messageDate: date,
|
|
1620
|
-
messageDateText: moment__default['default'](date,
|
|
1783
|
+
messageDateText: moment__default['default'](date, "YYYY-MM-DD").format("DD/MM/YYYY"),
|
|
1621
1784
|
showMessageDate: false,
|
|
1622
1785
|
messages: []
|
|
1623
1786
|
});
|
|
@@ -1655,7 +1818,7 @@
|
|
|
1655
1818
|
});
|
|
1656
1819
|
|
|
1657
1820
|
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onKeyDown", function (event) {
|
|
1658
|
-
if (event.key ===
|
|
1821
|
+
if (event.key === "Enter" && !event.shiftKey) {
|
|
1659
1822
|
event.preventDefault();
|
|
1660
1823
|
|
|
1661
1824
|
_this.sendMessage();
|
|
@@ -1690,7 +1853,7 @@
|
|
|
1690
1853
|
if (m._id === messageToDelete._id) {
|
|
1691
1854
|
return _objectSpread$3(_objectSpread$3({}, m), {}, {
|
|
1692
1855
|
deleted: true,
|
|
1693
|
-
text:
|
|
1856
|
+
text: " "
|
|
1694
1857
|
});
|
|
1695
1858
|
}
|
|
1696
1859
|
|
|
@@ -1720,7 +1883,7 @@
|
|
|
1720
1883
|
case 11:
|
|
1721
1884
|
_context4.prev = 11;
|
|
1722
1885
|
_context4.t0 = _context4["catch"](5);
|
|
1723
|
-
console.error(
|
|
1886
|
+
console.error("Failed to delete message:", _context4.t0); // Revert the optimistic update on failure
|
|
1724
1887
|
|
|
1725
1888
|
revertedMessages = _this.state.messages.map(function (m) {
|
|
1726
1889
|
if (m._id === messageToDelete._id) {
|
|
@@ -1735,7 +1898,7 @@
|
|
|
1735
1898
|
deletingMessageId: null
|
|
1736
1899
|
});
|
|
1737
1900
|
|
|
1738
|
-
alert(
|
|
1901
|
+
alert("Failed to delete message. Please try again.");
|
|
1739
1902
|
|
|
1740
1903
|
case 17:
|
|
1741
1904
|
case "end":
|
|
@@ -1752,6 +1915,32 @@
|
|
|
1752
1915
|
});
|
|
1753
1916
|
});
|
|
1754
1917
|
|
|
1918
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "markCircleAsRead", /*#__PURE__*/_asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee5() {
|
|
1919
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee5$(_context5) {
|
|
1920
|
+
while (1) {
|
|
1921
|
+
switch (_context5.prev = _context5.next) {
|
|
1922
|
+
case 0:
|
|
1923
|
+
_context5.prev = 0;
|
|
1924
|
+
_context5.next = 3;
|
|
1925
|
+
return circleActions.markAsRead(_this.state.circleId, _this.props.user.Id);
|
|
1926
|
+
|
|
1927
|
+
case 3:
|
|
1928
|
+
_context5.next = 8;
|
|
1929
|
+
break;
|
|
1930
|
+
|
|
1931
|
+
case 5:
|
|
1932
|
+
_context5.prev = 5;
|
|
1933
|
+
_context5.t0 = _context5["catch"](0);
|
|
1934
|
+
console.error("Failed to mark circle as read:", _context5.t0);
|
|
1935
|
+
|
|
1936
|
+
case 8:
|
|
1937
|
+
case "end":
|
|
1938
|
+
return _context5.stop();
|
|
1939
|
+
}
|
|
1940
|
+
}
|
|
1941
|
+
}, _callee5, null, [[0, 5]]);
|
|
1942
|
+
})));
|
|
1943
|
+
|
|
1755
1944
|
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "sendMessage", function () {
|
|
1756
1945
|
var message = {
|
|
1757
1946
|
_id: Helper.randomString(),
|
|
@@ -1793,7 +1982,7 @@
|
|
|
1793
1982
|
|
|
1794
1983
|
_this.setState({
|
|
1795
1984
|
messages: [].concat(_toConsumableArray__default['default'](_this.state.messages), [clonedMessage]),
|
|
1796
|
-
messageInput:
|
|
1985
|
+
messageInput: "",
|
|
1797
1986
|
imageInput: null,
|
|
1798
1987
|
imageInputShowing: false,
|
|
1799
1988
|
fileInput: null,
|
|
@@ -1805,18 +1994,18 @@
|
|
|
1805
1994
|
|
|
1806
1995
|
_this.scrollToBottom();
|
|
1807
1996
|
|
|
1808
|
-
_this.imageInput && _this.imageInput.
|
|
1809
|
-
_this.fileInput && _this.fileInput.
|
|
1997
|
+
_this.imageInput && _this.imageInput.setValue(null);
|
|
1998
|
+
_this.fileInput && _this.fileInput.setValue(null);
|
|
1810
1999
|
}, 100);
|
|
1811
2000
|
});
|
|
1812
2001
|
|
|
1813
|
-
var circleId = Helper.safeReadParams(props,
|
|
2002
|
+
var circleId = Helper.safeReadParams(props, "circleId");
|
|
1814
2003
|
_this.state = {
|
|
1815
2004
|
circleId: circleId,
|
|
1816
2005
|
circle: ___default['default'].find(props.circles, function (c) {
|
|
1817
2006
|
return c.Id === circleId;
|
|
1818
2007
|
}),
|
|
1819
|
-
messageInput:
|
|
2008
|
+
messageInput: "",
|
|
1820
2009
|
messages: [],
|
|
1821
2010
|
images: [],
|
|
1822
2011
|
files: [],
|
|
@@ -1836,6 +2025,7 @@
|
|
|
1836
2025
|
_createClass__default['default'](Circle, [{
|
|
1837
2026
|
key: "componentDidMount",
|
|
1838
2027
|
value: function componentDidMount() {
|
|
2028
|
+
this.markCircleAsRead();
|
|
1839
2029
|
this.checkGetData();
|
|
1840
2030
|
this.connect();
|
|
1841
2031
|
this.props.setNavData({
|
|
@@ -1865,7 +2055,7 @@
|
|
|
1865
2055
|
value: function mergeMessages(receivedMessages, excludePending) {
|
|
1866
2056
|
var _this2 = this;
|
|
1867
2057
|
|
|
1868
|
-
var newMessages = ___default['default'].sortBy(___default['default'].concat(this.state.messages, receivedMessages),
|
|
2058
|
+
var newMessages = ___default['default'].sortBy(___default['default'].concat(this.state.messages, receivedMessages), "createdAt");
|
|
1869
2059
|
|
|
1870
2060
|
this.setState({
|
|
1871
2061
|
messages: ___default['default'].filter(___default['default'].uniqBy(newMessages, function (m) {
|
|
@@ -1959,21 +2149,21 @@
|
|
|
1959
2149
|
},
|
|
1960
2150
|
onKeyDown: this.onKeyDown
|
|
1961
2151
|
}), /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement(FontAwesome__default['default'], {
|
|
1962
|
-
className: "chat_imageIcon".concat(this.state.imageInputShowing ?
|
|
2152
|
+
className: "chat_imageIcon".concat(this.state.imageInputShowing ? " chat_imageIcon-selected" : ""),
|
|
1963
2153
|
name: "camera",
|
|
1964
2154
|
onClick: this.showImageInput
|
|
1965
2155
|
}), /*#__PURE__*/React__default['default'].createElement(FontAwesome__default['default'], {
|
|
1966
|
-
className: "chat_imageIcon".concat(this.state.fileInputShowing ?
|
|
2156
|
+
className: "chat_imageIcon".concat(this.state.fileInputShowing ? " chat_imageIcon-selected" : ""),
|
|
1967
2157
|
name: "paperclip",
|
|
1968
2158
|
onClick: this.showFileInput
|
|
1969
2159
|
})), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1970
2160
|
className: "overflow-x",
|
|
1971
2161
|
style: {
|
|
1972
|
-
display: this.state.imageInputShowing ?
|
|
2162
|
+
display: this.state.imageInputShowing ? "block" : "none"
|
|
1973
2163
|
}
|
|
1974
2164
|
}, /*#__PURE__*/React__default['default'].createElement(Components$2.ImageInput, {
|
|
1975
|
-
ref: function ref(
|
|
1976
|
-
_this5.imageInput =
|
|
2165
|
+
ref: function ref(_ref6) {
|
|
2166
|
+
_this5.imageInput = _ref6;
|
|
1977
2167
|
},
|
|
1978
2168
|
multiple: true,
|
|
1979
2169
|
limit: 10,
|
|
@@ -1984,11 +2174,11 @@
|
|
|
1984
2174
|
})), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
1985
2175
|
className: "overflow-x",
|
|
1986
2176
|
style: {
|
|
1987
|
-
display: this.state.fileInputShowing ?
|
|
2177
|
+
display: this.state.fileInputShowing ? "block" : "none"
|
|
1988
2178
|
}
|
|
1989
2179
|
}, /*#__PURE__*/React__default['default'].createElement(Components$2.FileInput, {
|
|
1990
|
-
ref: function ref(
|
|
1991
|
-
_this5.fileInput =
|
|
2180
|
+
ref: function ref(_ref7) {
|
|
2181
|
+
_this5.fileInput = _ref7;
|
|
1992
2182
|
},
|
|
1993
2183
|
multiple: true,
|
|
1994
2184
|
limit: 10,
|
|
@@ -2018,11 +2208,11 @@
|
|
|
2018
2208
|
var isDeleting = this.state.deletingMessageId === m._id;
|
|
2019
2209
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2020
2210
|
key: m._id,
|
|
2021
|
-
className: "message".concat(isSelf ?
|
|
2211
|
+
className: "message".concat(isSelf ? " message-self" : "").concat(m.uploading ? " message-uploading" : "").concat(isDeleting ? " message-deleting" : "")
|
|
2022
2212
|
}, /*#__PURE__*/React__default['default'].createElement(Components$2.Text, {
|
|
2023
2213
|
type: "h5-noUpper",
|
|
2024
2214
|
className: "message_time"
|
|
2025
|
-
}, moment__default['default'].utc(m.createdAt).local().format(
|
|
2215
|
+
}, moment__default['default'].utc(m.createdAt).local().format("D MMM YYYY • h:mma")), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2026
2216
|
className: "message_inner"
|
|
2027
2217
|
}, /*#__PURE__*/React__default['default'].createElement(Components$2.ProfilePic, {
|
|
2028
2218
|
size: 40,
|
|
@@ -2033,17 +2223,17 @@
|
|
|
2033
2223
|
}, /*#__PURE__*/React__default['default'].createElement(Components$2.Text, {
|
|
2034
2224
|
type: "body",
|
|
2035
2225
|
className: "message_name"
|
|
2036
|
-
}, m.user.name, m.replyingTo && !isDeleted ? " replied to ".concat(m.replyingTo.user.name) :
|
|
2226
|
+
}, m.user.name, m.replyingTo && !isDeleted ? " replied to ".concat(m.replyingTo.user.name) : ""), m.replyingTo && !isDeleted && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2037
2227
|
className: "message_replyBubble"
|
|
2038
2228
|
}, /*#__PURE__*/React__default['default'].createElement(Components$2.Text, {
|
|
2039
2229
|
type: "body",
|
|
2040
2230
|
className: "message_text"
|
|
2041
|
-
}, Helper.toParagraphed((m.replyingTo.text ||
|
|
2231
|
+
}, Helper.toParagraphed((m.replyingTo.text || "").substr(0, 100)))), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2042
2232
|
className: "message_bubble"
|
|
2043
2233
|
}, /*#__PURE__*/React__default['default'].createElement(Components$2.Text, {
|
|
2044
2234
|
type: "body",
|
|
2045
2235
|
className: "message_text"
|
|
2046
|
-
}, isDeleted ?
|
|
2236
|
+
}, isDeleted ? "[Message deleted]" : Helper.toParagraphed(m.text)), !isDeleted && /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("div", null, (m.image || []).map(function (url, i) {
|
|
2047
2237
|
return /*#__PURE__*/React__default['default'].createElement("a", {
|
|
2048
2238
|
href: url,
|
|
2049
2239
|
target: "_blank",
|
|
@@ -2062,8 +2252,8 @@
|
|
|
2062
2252
|
})))), !isDeleted && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2063
2253
|
className: "message_reply",
|
|
2064
2254
|
style: {
|
|
2065
|
-
display:
|
|
2066
|
-
gap:
|
|
2255
|
+
display: "flex",
|
|
2256
|
+
gap: "16px"
|
|
2067
2257
|
}
|
|
2068
2258
|
}, /*#__PURE__*/React__default['default'].createElement(Components$2.Text, {
|
|
2069
2259
|
type: "button",
|
|
@@ -2100,7 +2290,7 @@
|
|
|
2100
2290
|
value: function renderEmptyDate() {
|
|
2101
2291
|
return this.renderMessage({
|
|
2102
2292
|
system: true,
|
|
2103
|
-
text:
|
|
2293
|
+
text: "No messages on this date"
|
|
2104
2294
|
});
|
|
2105
2295
|
}
|
|
2106
2296
|
}, {
|
|
@@ -2115,7 +2305,7 @@
|
|
|
2115
2305
|
className: "chat_section_titleSection"
|
|
2116
2306
|
}, /*#__PURE__*/React__default['default'].createElement(FontAwesome__default['default'], {
|
|
2117
2307
|
className: "chat_section_titleSection_caret",
|
|
2118
|
-
name: "chevron-".concat(this.state.membersExpanded ?
|
|
2308
|
+
name: "chevron-".concat(this.state.membersExpanded ? "up" : "down"),
|
|
2119
2309
|
onClick: this.toggleMembers
|
|
2120
2310
|
}), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2121
2311
|
className: "flex-1"
|
|
@@ -2133,7 +2323,7 @@
|
|
|
2133
2323
|
className: "chat_section_titleSection"
|
|
2134
2324
|
}, /*#__PURE__*/React__default['default'].createElement(FontAwesome__default['default'], {
|
|
2135
2325
|
className: "chat_section_titleSection_caret",
|
|
2136
|
-
name: "chevron-".concat(this.state.imagesExpanded ?
|
|
2326
|
+
name: "chevron-".concat(this.state.imagesExpanded ? "up" : "down"),
|
|
2137
2327
|
onClick: this.toggleImages
|
|
2138
2328
|
}), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2139
2329
|
className: "flex-1"
|
|
@@ -2156,7 +2346,7 @@
|
|
|
2156
2346
|
className: "chat_section_titleSection"
|
|
2157
2347
|
}, /*#__PURE__*/React__default['default'].createElement(FontAwesome__default['default'], {
|
|
2158
2348
|
className: "chat_section_titleSection_caret",
|
|
2159
|
-
name: "chevron-".concat(this.state.filesExpanded ?
|
|
2349
|
+
name: "chevron-".concat(this.state.filesExpanded ? "up" : "down"),
|
|
2160
2350
|
onClick: this.toggleFiles
|
|
2161
2351
|
}), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2162
2352
|
className: "flex-1"
|
|
@@ -2187,7 +2377,7 @@
|
|
|
2187
2377
|
className: "chat_replyTo_container"
|
|
2188
2378
|
}, /*#__PURE__*/React__default['default'].createElement(Components$2.Text, {
|
|
2189
2379
|
type: "h5"
|
|
2190
|
-
}, "Replying to ", m && m.user && !___default['default'].isEmpty(m.user.displayName) ? m.user.displayName :
|
|
2380
|
+
}, "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$2.Text, {
|
|
2191
2381
|
type: "body"
|
|
2192
2382
|
}, m.text.substr(0, 50))), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2193
2383
|
className: "chat_replyTo_remove"
|
|
@@ -2207,14 +2397,14 @@
|
|
|
2207
2397
|
return /*#__PURE__*/React__default['default'].createElement(Components$2.Popup, {
|
|
2208
2398
|
title: "Delete Message",
|
|
2209
2399
|
buttons: [{
|
|
2210
|
-
text:
|
|
2400
|
+
text: "Delete",
|
|
2211
2401
|
onClick: this.onConfirmDelete,
|
|
2212
|
-
type:
|
|
2402
|
+
type: "primary",
|
|
2213
2403
|
isActive: true
|
|
2214
2404
|
}, {
|
|
2215
|
-
text:
|
|
2405
|
+
text: "Cancel",
|
|
2216
2406
|
onClick: this.onCancelDelete,
|
|
2217
|
-
type:
|
|
2407
|
+
type: "tertiary",
|
|
2218
2408
|
isActive: true
|
|
2219
2409
|
}],
|
|
2220
2410
|
onClose: this.onCancelDelete,
|
|
@@ -2231,8 +2421,8 @@
|
|
|
2231
2421
|
return /*#__PURE__*/React__default['default'].createElement(Components$2.OverlayPage, {
|
|
2232
2422
|
fullPage: true,
|
|
2233
2423
|
fullPageStyle: {
|
|
2234
|
-
display:
|
|
2235
|
-
flexDirection:
|
|
2424
|
+
display: "flex",
|
|
2425
|
+
flexDirection: "column"
|
|
2236
2426
|
}
|
|
2237
2427
|
}, this.renderDeleteConfirmPopup(), /*#__PURE__*/React__default['default'].createElement(Components$2.Header, {
|
|
2238
2428
|
rightContent: this.renderHeaderRight()
|
|
@@ -2282,8 +2472,8 @@
|
|
|
2282
2472
|
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2283
2473
|
className: "chat_newMessage"
|
|
2284
2474
|
}, this.renderChatInput()), this.renderReplyTo(), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2285
|
-
ref: function ref(
|
|
2286
|
-
return _this8.chat =
|
|
2475
|
+
ref: function ref(_ref8) {
|
|
2476
|
+
return _this8.chat = _ref8;
|
|
2287
2477
|
},
|
|
2288
2478
|
className: "chat_messages"
|
|
2289
2479
|
}, ___default['default'].isEmpty(this.state.messages) && !___default['default'].isEmpty(this.state.messageDate) && this.renderEmptyDate(), this.state.messages.map(function (m) {
|