@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.esm.js
CHANGED
|
@@ -333,12 +333,46 @@ var circleActions = {
|
|
|
333
333
|
}
|
|
334
334
|
|
|
335
335
|
return deleteMessage;
|
|
336
|
+
}(),
|
|
337
|
+
markAsRead: function () {
|
|
338
|
+
var _markAsRead = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(circleId, userId) {
|
|
339
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
340
|
+
while (1) {
|
|
341
|
+
switch (_context4.prev = _context4.next) {
|
|
342
|
+
case 0:
|
|
343
|
+
return _context4.abrupt("return", Session$4.authedFunction({
|
|
344
|
+
method: 'post',
|
|
345
|
+
url: Helper$3.getUrl('groups', 'resetunread'),
|
|
346
|
+
data: {
|
|
347
|
+
groupID: circleId,
|
|
348
|
+
userID: userId
|
|
349
|
+
}
|
|
350
|
+
}));
|
|
351
|
+
|
|
352
|
+
case 1:
|
|
353
|
+
case "end":
|
|
354
|
+
return _context4.stop();
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
}, _callee4);
|
|
358
|
+
}));
|
|
359
|
+
|
|
360
|
+
function markAsRead(_x9, _x10) {
|
|
361
|
+
return _markAsRead.apply(this, arguments);
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
return markAsRead;
|
|
336
365
|
}()
|
|
337
366
|
};
|
|
338
367
|
|
|
339
368
|
var Apis$1 = PlussCore.Apis;
|
|
340
369
|
var analyticsActions = Apis$1.analyticsActions;
|
|
341
370
|
|
|
371
|
+
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}}
|
|
372
|
+
|
|
373
|
+
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";
|
|
374
|
+
n(css,{});
|
|
375
|
+
|
|
342
376
|
function _createSuper$7(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$7(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
343
377
|
|
|
344
378
|
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; } }
|
|
@@ -375,7 +409,7 @@ var Circles = /*#__PURE__*/function (_Component) {
|
|
|
375
409
|
|
|
376
410
|
case 3:
|
|
377
411
|
res = _context.sent;
|
|
378
|
-
console.log(
|
|
412
|
+
console.log("getData", res.data);
|
|
379
413
|
|
|
380
414
|
_this.props.circlesLoaded(res.data);
|
|
381
415
|
|
|
@@ -389,7 +423,7 @@ var Circles = /*#__PURE__*/function (_Component) {
|
|
|
389
423
|
case 9:
|
|
390
424
|
_context.prev = 9;
|
|
391
425
|
_context.t0 = _context["catch"](0);
|
|
392
|
-
console.error(
|
|
426
|
+
console.error("getData", _context.t0);
|
|
393
427
|
|
|
394
428
|
_this.setState({
|
|
395
429
|
loadingAll: false
|
|
@@ -404,6 +438,12 @@ var Circles = /*#__PURE__*/function (_Component) {
|
|
|
404
438
|
})));
|
|
405
439
|
});
|
|
406
440
|
|
|
441
|
+
_defineProperty(_assertThisInitialized(_this), "selectUnreadFilter", function (showUnreadOnly) {
|
|
442
|
+
_this.setState({
|
|
443
|
+
showUnreadOnly: showUnreadOnly
|
|
444
|
+
});
|
|
445
|
+
});
|
|
446
|
+
|
|
407
447
|
_defineProperty(_assertThisInitialized(_this), "canAddNew", function () {
|
|
408
448
|
var auth = _this.props.auth;
|
|
409
449
|
return Session$3.validateAccess(auth.site, values.permission, auth);
|
|
@@ -471,9 +511,15 @@ var Circles = /*#__PURE__*/function (_Component) {
|
|
|
471
511
|
});
|
|
472
512
|
});
|
|
473
513
|
|
|
514
|
+
_defineProperty(_assertThisInitialized(_this), "selectSort", function (sortType) {
|
|
515
|
+
_this.setState({
|
|
516
|
+
sortBy: sortType
|
|
517
|
+
});
|
|
518
|
+
});
|
|
519
|
+
|
|
474
520
|
_defineProperty(_assertThisInitialized(_this), "onHandleChange", function (event) {
|
|
475
521
|
var stateChange = {};
|
|
476
|
-
stateChange[event.target.getAttribute(
|
|
522
|
+
stateChange[event.target.getAttribute("id")] = event.target.value;
|
|
477
523
|
|
|
478
524
|
_this.setState(stateChange);
|
|
479
525
|
});
|
|
@@ -485,14 +531,14 @@ var Circles = /*#__PURE__*/function (_Component) {
|
|
|
485
531
|
circleActions.delete(circle.Id).then(function (res) {
|
|
486
532
|
_this.getData();
|
|
487
533
|
}).catch(function (res) {
|
|
488
|
-
alert(
|
|
534
|
+
alert("Something went wrong with the request. Please try again.");
|
|
489
535
|
});
|
|
490
536
|
}
|
|
491
537
|
});
|
|
492
538
|
|
|
493
539
|
_defineProperty(_assertThisInitialized(_this), "getTypeFilterText", function (type) {
|
|
494
|
-
if (type ===
|
|
495
|
-
return
|
|
540
|
+
if (type === "private") {
|
|
541
|
+
return "Private Message";
|
|
496
542
|
}
|
|
497
543
|
|
|
498
544
|
return _.capitalize(values.entityName);
|
|
@@ -502,14 +548,17 @@ var Circles = /*#__PURE__*/function (_Component) {
|
|
|
502
548
|
if (circle.IsPrivate) {
|
|
503
549
|
return "PM: ".concat(circle.Audience.map(function (user) {
|
|
504
550
|
return user.displayName;
|
|
505
|
-
}).join(
|
|
551
|
+
}).join(", "));
|
|
506
552
|
}
|
|
507
553
|
|
|
508
554
|
return circle.Title;
|
|
509
555
|
});
|
|
510
556
|
|
|
511
557
|
_this.state = {
|
|
512
|
-
userSearch:
|
|
558
|
+
userSearch: "",
|
|
559
|
+
sortBy: "newest",
|
|
560
|
+
showUnreadOnly: false,
|
|
561
|
+
pollingInterval: null
|
|
513
562
|
};
|
|
514
563
|
return _this;
|
|
515
564
|
}
|
|
@@ -517,27 +566,77 @@ var Circles = /*#__PURE__*/function (_Component) {
|
|
|
517
566
|
_createClass(Circles, [{
|
|
518
567
|
key: "componentDidMount",
|
|
519
568
|
value: function componentDidMount() {
|
|
520
|
-
this
|
|
569
|
+
var _this2 = this;
|
|
570
|
+
|
|
571
|
+
this.getData(); // Poll for updates every 10 seconds
|
|
572
|
+
|
|
573
|
+
this.pollingInterval = setInterval(function () {
|
|
574
|
+
_this2.getData();
|
|
575
|
+
}, 10000);
|
|
576
|
+
}
|
|
577
|
+
}, {
|
|
578
|
+
key: "componentWillUnmount",
|
|
579
|
+
value: function componentWillUnmount() {
|
|
580
|
+
if (this.pollingInterval) {
|
|
581
|
+
clearInterval(this.pollingInterval);
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
}, {
|
|
585
|
+
key: "isCircleUnread",
|
|
586
|
+
value: function isCircleUnread(circle) {
|
|
587
|
+
var userId = this.props.user.Id;
|
|
588
|
+
|
|
589
|
+
if (!circle.Unread || !circle.Unread[userId]) {
|
|
590
|
+
return false;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
return circle.Unread[userId] > 0;
|
|
594
|
+
}
|
|
595
|
+
}, {
|
|
596
|
+
key: "getUnreadCount",
|
|
597
|
+
value: function getUnreadCount(circle) {
|
|
598
|
+
var userId = this.props.user.Id;
|
|
599
|
+
|
|
600
|
+
if (!circle.Unread || !circle.Unread[userId]) {
|
|
601
|
+
return 0;
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
return circle.Unread[userId];
|
|
521
605
|
}
|
|
522
606
|
}, {
|
|
523
607
|
key: "getCircles",
|
|
524
608
|
value: function getCircles() {
|
|
525
|
-
var
|
|
609
|
+
var _this3 = this;
|
|
526
610
|
|
|
527
611
|
var result = this.props.circles;
|
|
528
612
|
|
|
529
613
|
if (this.state.selectedTypeFilter) {
|
|
530
614
|
result = _.filter(result, function (circle) {
|
|
531
|
-
return
|
|
615
|
+
return _this3.state.selectedTypeFilter === "circle" ? !circle.IsPrivate : circle.IsPrivate;
|
|
532
616
|
});
|
|
533
617
|
}
|
|
534
618
|
|
|
535
619
|
if (this.state.selectedUserFilter) {
|
|
536
620
|
result = _.filter(result, function (circle) {
|
|
537
621
|
return _.some(circle.Audience, function (user) {
|
|
538
|
-
return user.userId ===
|
|
622
|
+
return user.userId === _this3.state.selectedUserFilter.userId;
|
|
539
623
|
});
|
|
540
624
|
});
|
|
625
|
+
} // Apply sorting
|
|
626
|
+
|
|
627
|
+
|
|
628
|
+
result = _.sortBy(result, function (circle) {
|
|
629
|
+
return moment(circle.Changed).valueOf();
|
|
630
|
+
});
|
|
631
|
+
|
|
632
|
+
if (this.state.sortBy === "newest") {
|
|
633
|
+
result.reverse();
|
|
634
|
+
|
|
635
|
+
if (this.state.showUnreadOnly) {
|
|
636
|
+
result = _.filter(result, function (circle) {
|
|
637
|
+
return _this3.isCircleUnread(circle);
|
|
638
|
+
});
|
|
639
|
+
}
|
|
541
640
|
}
|
|
542
641
|
|
|
543
642
|
return result;
|
|
@@ -545,7 +644,7 @@ var Circles = /*#__PURE__*/function (_Component) {
|
|
|
545
644
|
}, {
|
|
546
645
|
key: "getUsers",
|
|
547
646
|
value: function getUsers() {
|
|
548
|
-
var
|
|
647
|
+
var _this4 = this;
|
|
549
648
|
|
|
550
649
|
var users = [];
|
|
551
650
|
this.props.circles.forEach(function (circle) {
|
|
@@ -555,10 +654,10 @@ var Circles = /*#__PURE__*/function (_Component) {
|
|
|
555
654
|
});
|
|
556
655
|
users = _.sortBy(_.uniqBy(users, function (user) {
|
|
557
656
|
return user.userId;
|
|
558
|
-
}),
|
|
657
|
+
}), "displayName");
|
|
559
658
|
return _.filter(users, function (u) {
|
|
560
|
-
if (!_.isEmpty(
|
|
561
|
-
return (u.displayName ||
|
|
659
|
+
if (!_.isEmpty(_this4.state.userSearch)) {
|
|
660
|
+
return (u.displayName || "").toLowerCase().indexOf(_this4.state.userSearch.toLowerCase()) > -1;
|
|
562
661
|
}
|
|
563
662
|
|
|
564
663
|
return true;
|
|
@@ -567,7 +666,7 @@ var Circles = /*#__PURE__*/function (_Component) {
|
|
|
567
666
|
}, {
|
|
568
667
|
key: "validateCircleAdmin",
|
|
569
668
|
value: function validateCircleAdmin(circle, onlyCreator) {
|
|
570
|
-
var
|
|
669
|
+
var _this5 = this;
|
|
571
670
|
|
|
572
671
|
if (Session$3.validateAccess(this.props.auth.site, values.permission, this.props.auth)) {
|
|
573
672
|
return true;
|
|
@@ -578,21 +677,31 @@ var Circles = /*#__PURE__*/function (_Component) {
|
|
|
578
677
|
}
|
|
579
678
|
|
|
580
679
|
return _.some(circle.Audience, function (user) {
|
|
581
|
-
return user.userId ===
|
|
680
|
+
return user.userId === _this5.props.user.Id && user.isAdmin;
|
|
582
681
|
});
|
|
583
682
|
}
|
|
584
683
|
}, {
|
|
585
684
|
key: "renderRow",
|
|
586
685
|
value: function renderRow(circle) {
|
|
587
|
-
var
|
|
686
|
+
var _this6 = this;
|
|
588
687
|
|
|
688
|
+
var unreadCount = this.getUnreadCount(circle);
|
|
689
|
+
var badge = unreadCount > 0 ? /*#__PURE__*/React.createElement(Components$4.Tag, {
|
|
690
|
+
className: css.badgeTag,
|
|
691
|
+
text: "".concat(unreadCount, " new")
|
|
692
|
+
}) : null;
|
|
589
693
|
return /*#__PURE__*/React.createElement("tr", {
|
|
590
694
|
key: circle.Id
|
|
591
695
|
}, /*#__PURE__*/React.createElement("td", {
|
|
592
696
|
className: "table-TitleColumn"
|
|
697
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
698
|
+
className: "flex flex-center",
|
|
699
|
+
style: {
|
|
700
|
+
gap: "8px"
|
|
701
|
+
}
|
|
593
702
|
}, /*#__PURE__*/React.createElement(Link, {
|
|
594
703
|
to: "/".concat(values.featureKey, "/").concat(values.entityKey, "/").concat(circle.Id)
|
|
595
|
-
}, this.getTitle(circle))), /*#__PURE__*/React.createElement("td", null, moment(circle.Changed).local().format(
|
|
704
|
+
}, this.getTitle(circle)), badge)), /*#__PURE__*/React.createElement("td", null, moment(circle.Changed).local().format("D MMM YYYY")), /*#__PURE__*/React.createElement("td", null, circle.Audience.map(function (user) {
|
|
596
705
|
return /*#__PURE__*/React.createElement(Components$4.ProfilePic, {
|
|
597
706
|
size: 30,
|
|
598
707
|
image: user.profilePic,
|
|
@@ -603,8 +712,8 @@ var Circles = /*#__PURE__*/function (_Component) {
|
|
|
603
712
|
className: "table-options"
|
|
604
713
|
}, /*#__PURE__*/React.createElement("div", {
|
|
605
714
|
style: {
|
|
606
|
-
display:
|
|
607
|
-
alignItems:
|
|
715
|
+
display: "flex",
|
|
716
|
+
alignItems: "center"
|
|
608
717
|
}
|
|
609
718
|
}, this.validateCircleAdmin(circle) && !circle.IsPrivate && /*#__PURE__*/React.createElement(Link, {
|
|
610
719
|
to: "/".concat(values.featureKey, "/edit/").concat(circle.Id)
|
|
@@ -613,31 +722,69 @@ var Circles = /*#__PURE__*/function (_Component) {
|
|
|
613
722
|
fontSize: 20,
|
|
614
723
|
padding: 5,
|
|
615
724
|
marginLeft: 12,
|
|
616
|
-
cursor:
|
|
725
|
+
cursor: "pointer"
|
|
617
726
|
},
|
|
618
727
|
name: "pencil"
|
|
619
728
|
})), this.validateCircleAdmin(circle, true) && !circle.IsPrivate && /*#__PURE__*/React.createElement("a", {
|
|
620
729
|
onClick: function onClick() {
|
|
621
|
-
|
|
730
|
+
_this6.removeCircle(circle);
|
|
622
731
|
}
|
|
623
732
|
}, /*#__PURE__*/React.createElement(FontAwesome, {
|
|
624
733
|
style: {
|
|
625
734
|
fontSize: 20,
|
|
626
735
|
padding: 5,
|
|
627
736
|
marginLeft: 12,
|
|
628
|
-
cursor:
|
|
737
|
+
cursor: "pointer"
|
|
629
738
|
},
|
|
630
739
|
name: "minus-circle"
|
|
631
740
|
})))));
|
|
632
741
|
}
|
|
742
|
+
}, {
|
|
743
|
+
key: "renderUnreadFilterInfo",
|
|
744
|
+
value: function renderUnreadFilterInfo() {
|
|
745
|
+
var _this7 = this;
|
|
746
|
+
|
|
747
|
+
var showUnreadOnly = this.state.showUnreadOnly;
|
|
748
|
+
|
|
749
|
+
if (!showUnreadOnly) {
|
|
750
|
+
return null;
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
754
|
+
className: css.unreadFilterBanner
|
|
755
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
756
|
+
className: css.unreadFilterContent
|
|
757
|
+
}, /*#__PURE__*/React.createElement(FontAwesome, {
|
|
758
|
+
name: "info-circle",
|
|
759
|
+
className: css.unreadFilterIcon
|
|
760
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
761
|
+
className: css.unreadFilterText
|
|
762
|
+
}, "Showing only items with new messages.", " ", /*#__PURE__*/React.createElement("button", {
|
|
763
|
+
className: css.unreadFilterButton,
|
|
764
|
+
onClick: function onClick() {
|
|
765
|
+
return _this7.selectUnreadFilter(false);
|
|
766
|
+
},
|
|
767
|
+
"aria-label": "Turn off unread filter"
|
|
768
|
+
}, "Turn off filter"))));
|
|
769
|
+
}
|
|
633
770
|
}, {
|
|
634
771
|
key: "renderFilters",
|
|
635
772
|
value: function renderFilters() {
|
|
773
|
+
var _this8 = this;
|
|
774
|
+
|
|
636
775
|
var userFilter = /*#__PURE__*/React.createElement(Components$4.Tag, {
|
|
637
776
|
className: "marginRight-10",
|
|
638
777
|
onClick: this.openUserFilter,
|
|
639
778
|
text: "User"
|
|
640
779
|
});
|
|
780
|
+
var unreadFilter = /*#__PURE__*/React.createElement(Components$4.Tag, {
|
|
781
|
+
className: "marginRight-10",
|
|
782
|
+
onClick: function onClick() {
|
|
783
|
+
return _this8.selectUnreadFilter(!_this8.state.showUnreadOnly);
|
|
784
|
+
},
|
|
785
|
+
leftIcon: this.state.showUnreadOnly ? "check" : null,
|
|
786
|
+
text: "Unread Only"
|
|
787
|
+
});
|
|
641
788
|
var typeFilter = /*#__PURE__*/React.createElement(Components$4.Tag, {
|
|
642
789
|
className: "marginRight-10",
|
|
643
790
|
onClick: this.openTypeFilter,
|
|
@@ -672,12 +819,28 @@ var Circles = /*#__PURE__*/function (_Component) {
|
|
|
672
819
|
}, /*#__PURE__*/React.createElement(Components$4.Text, {
|
|
673
820
|
type: "h5",
|
|
674
821
|
className: "marginRight-20"
|
|
675
|
-
}, "Filter by"), userFilter, typeFilter
|
|
822
|
+
}, "Filter by"), userFilter, typeFilter, unreadFilter, /*#__PURE__*/React.createElement(Components$4.Text, {
|
|
823
|
+
type: "h5",
|
|
824
|
+
className: "marginRight-20 marginLeft-20"
|
|
825
|
+
}, "Sort by:"), /*#__PURE__*/React.createElement(Components$4.Tag, {
|
|
826
|
+
className: "marginRight-10",
|
|
827
|
+
onClick: function onClick() {
|
|
828
|
+
return _this8.selectSort("newest");
|
|
829
|
+
},
|
|
830
|
+
leftIcon: this.state.sortBy === "newest" ? "check" : null,
|
|
831
|
+
text: "Newest first"
|
|
832
|
+
}), /*#__PURE__*/React.createElement(Components$4.Tag, {
|
|
833
|
+
onClick: function onClick() {
|
|
834
|
+
return _this8.selectSort("oldest");
|
|
835
|
+
},
|
|
836
|
+
leftIcon: this.state.sortBy === "oldest" ? "check" : null,
|
|
837
|
+
text: "Oldest first"
|
|
838
|
+
}));
|
|
676
839
|
}
|
|
677
840
|
}, {
|
|
678
841
|
key: "renderUserFilterPopup",
|
|
679
842
|
value: function renderUserFilterPopup() {
|
|
680
|
-
var
|
|
843
|
+
var _this9 = this;
|
|
681
844
|
|
|
682
845
|
if (!this.state.userFilterOpen) {
|
|
683
846
|
return null;
|
|
@@ -697,7 +860,7 @@ var Circles = /*#__PURE__*/function (_Component) {
|
|
|
697
860
|
placeholder: "Enter name",
|
|
698
861
|
value: this.state.userSearch,
|
|
699
862
|
onChange: function onChange(e) {
|
|
700
|
-
return
|
|
863
|
+
return _this9.onHandleChange(e);
|
|
701
864
|
},
|
|
702
865
|
alwaysShowLabel: true
|
|
703
866
|
}), this.getUsers().map(function (user) {
|
|
@@ -705,7 +868,7 @@ var Circles = /*#__PURE__*/function (_Component) {
|
|
|
705
868
|
key: user.userId,
|
|
706
869
|
user: user,
|
|
707
870
|
onClick: function onClick() {
|
|
708
|
-
|
|
871
|
+
_this9.selectUserFilter(user);
|
|
709
872
|
}
|
|
710
873
|
});
|
|
711
874
|
}));
|
|
@@ -713,7 +876,7 @@ var Circles = /*#__PURE__*/function (_Component) {
|
|
|
713
876
|
}, {
|
|
714
877
|
key: "renderTypeFilterPopup",
|
|
715
878
|
value: function renderTypeFilterPopup() {
|
|
716
|
-
var
|
|
879
|
+
var _this10 = this;
|
|
717
880
|
|
|
718
881
|
if (!this.state.typeFilterOpen) {
|
|
719
882
|
return null;
|
|
@@ -727,13 +890,13 @@ var Circles = /*#__PURE__*/function (_Component) {
|
|
|
727
890
|
onClose: this.closeTypeFilter
|
|
728
891
|
}, /*#__PURE__*/React.createElement(Components$4.Tag, {
|
|
729
892
|
onClick: function onClick() {
|
|
730
|
-
|
|
893
|
+
_this10.selectTypeFilter("circle");
|
|
731
894
|
},
|
|
732
895
|
text: _.capitalize(values.entityName),
|
|
733
896
|
className: "marginRight-10"
|
|
734
897
|
}), /*#__PURE__*/React.createElement(Components$4.Tag, {
|
|
735
898
|
onClick: function onClick() {
|
|
736
|
-
|
|
899
|
+
_this10.selectTypeFilter("private");
|
|
737
900
|
},
|
|
738
901
|
text: "Private Message"
|
|
739
902
|
}));
|
|
@@ -741,7 +904,7 @@ var Circles = /*#__PURE__*/function (_Component) {
|
|
|
741
904
|
}, {
|
|
742
905
|
key: "render",
|
|
743
906
|
value: function render() {
|
|
744
|
-
var
|
|
907
|
+
var _this11 = this;
|
|
745
908
|
|
|
746
909
|
return /*#__PURE__*/React.createElement("div", null, this.renderTypeFilterPopup(), this.renderUserFilterPopup(), /*#__PURE__*/React.createElement(Components$4.Header, null, this.canAddNew() && /*#__PURE__*/React.createElement(Components$4.AddButton, {
|
|
747
910
|
onClick: this.onAddNew,
|
|
@@ -751,21 +914,21 @@ var Circles = /*#__PURE__*/function (_Component) {
|
|
|
751
914
|
}, /*#__PURE__*/React.createElement(Components$4.Text, {
|
|
752
915
|
type: "h1",
|
|
753
916
|
className: ""
|
|
754
|
-
}, values.textFeatureTitle), this.renderFilters(), /*#__PURE__*/React.createElement(Table, {
|
|
917
|
+
}, values.textFeatureTitle), this.renderFilters(), this.renderUnreadFilterInfo(), /*#__PURE__*/React.createElement(Table, {
|
|
755
918
|
className: "plussTable",
|
|
756
919
|
striped: true,
|
|
757
920
|
bordered: true,
|
|
758
921
|
condensed: true,
|
|
759
922
|
hover: true,
|
|
760
923
|
style: {
|
|
761
|
-
minWidth:
|
|
924
|
+
minWidth: "100%"
|
|
762
925
|
}
|
|
763
926
|
}, /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("th", null, "Title"), /*#__PURE__*/React.createElement("th", null, "Last updated"), /*#__PURE__*/React.createElement("th", null, "Members"), /*#__PURE__*/React.createElement("th", {
|
|
764
927
|
style: {
|
|
765
928
|
width: 50
|
|
766
929
|
}
|
|
767
930
|
}))), /*#__PURE__*/React.createElement("tbody", null, this.getCircles().map(function (circle) {
|
|
768
|
-
return
|
|
931
|
+
return _this11.renderRow(circle);
|
|
769
932
|
})))));
|
|
770
933
|
}
|
|
771
934
|
}]);
|
|
@@ -827,7 +990,7 @@ var AddCircle = /*#__PURE__*/function (_Component) {
|
|
|
827
990
|
if (res.data != null && !_.isEmpty(res.data.results.Items)) {
|
|
828
991
|
_this.setState({
|
|
829
992
|
users: _.sortBy(res.data.results.Items, function (u) {
|
|
830
|
-
return (u.displayName ||
|
|
993
|
+
return (u.displayName || "").toLowerCase();
|
|
831
994
|
}).map(function (u) {
|
|
832
995
|
return _objectSpread$4(_objectSpread$4({}, u), {}, {
|
|
833
996
|
userId: u.userId || u.Id
|
|
@@ -851,7 +1014,7 @@ var AddCircle = /*#__PURE__*/function (_Component) {
|
|
|
851
1014
|
}
|
|
852
1015
|
|
|
853
1016
|
if (!_.isEmpty(_this.state.userSearch)) {
|
|
854
|
-
return (u.displayName ||
|
|
1017
|
+
return (u.displayName || "").toLowerCase().indexOf(_this.state.userSearch.toLowerCase()) > -1;
|
|
855
1018
|
}
|
|
856
1019
|
|
|
857
1020
|
return true;
|
|
@@ -905,7 +1068,7 @@ var AddCircle = /*#__PURE__*/function (_Component) {
|
|
|
905
1068
|
|
|
906
1069
|
case 3:
|
|
907
1070
|
res = _context.sent;
|
|
908
|
-
console.log(
|
|
1071
|
+
console.log("getData", res.data);
|
|
909
1072
|
circle = _.find(res.data, function (c) {
|
|
910
1073
|
return c.Id === _this.state.circleId;
|
|
911
1074
|
});
|
|
@@ -925,7 +1088,7 @@ var AddCircle = /*#__PURE__*/function (_Component) {
|
|
|
925
1088
|
case 11:
|
|
926
1089
|
_context.prev = 11;
|
|
927
1090
|
_context.t0 = _context["catch"](0);
|
|
928
|
-
console.error(
|
|
1091
|
+
console.error("getData", _context.t0);
|
|
929
1092
|
|
|
930
1093
|
_this.setState({
|
|
931
1094
|
loadingAll: false
|
|
@@ -942,7 +1105,7 @@ var AddCircle = /*#__PURE__*/function (_Component) {
|
|
|
942
1105
|
|
|
943
1106
|
_defineProperty(_assertThisInitialized(_this), "onHandleChange", function (event) {
|
|
944
1107
|
var stateChange = {};
|
|
945
|
-
stateChange[event.target.getAttribute(
|
|
1108
|
+
stateChange[event.target.getAttribute("id")] = event.target.value;
|
|
946
1109
|
|
|
947
1110
|
_this.setState(stateChange);
|
|
948
1111
|
});
|
|
@@ -965,7 +1128,7 @@ var AddCircle = /*#__PURE__*/function (_Component) {
|
|
|
965
1128
|
};
|
|
966
1129
|
|
|
967
1130
|
if (_.isEmpty(_this.state.title) && _.includes(newState.selectedUsers, user)) {
|
|
968
|
-
newState.title = "".concat(user.displayName.split(
|
|
1131
|
+
newState.title = "".concat(user.displayName.split(" ")[0], "'s Circle");
|
|
969
1132
|
}
|
|
970
1133
|
|
|
971
1134
|
_this.setState(newState);
|
|
@@ -1006,17 +1169,17 @@ var AddCircle = /*#__PURE__*/function (_Component) {
|
|
|
1006
1169
|
updating: false
|
|
1007
1170
|
});
|
|
1008
1171
|
|
|
1009
|
-
console.log(
|
|
1172
|
+
console.log("success");
|
|
1010
1173
|
|
|
1011
1174
|
_this.props.circleUpdated(res.data);
|
|
1012
1175
|
}).catch(function (err) {
|
|
1013
|
-
console.log(
|
|
1176
|
+
console.log("error");
|
|
1014
1177
|
|
|
1015
1178
|
_this.setState({
|
|
1016
1179
|
updating: false
|
|
1017
1180
|
});
|
|
1018
1181
|
|
|
1019
|
-
alert(
|
|
1182
|
+
alert("Something went wrong with the request. Please try again.");
|
|
1020
1183
|
});
|
|
1021
1184
|
} else {
|
|
1022
1185
|
circleActions.add(_this.props.auth.site, _this.state.title, _this.state.image, audience, _this.state.isPublic).then(function (res) {
|
|
@@ -1025,17 +1188,17 @@ var AddCircle = /*#__PURE__*/function (_Component) {
|
|
|
1025
1188
|
updating: false
|
|
1026
1189
|
});
|
|
1027
1190
|
|
|
1028
|
-
console.log(
|
|
1191
|
+
console.log("success");
|
|
1029
1192
|
|
|
1030
1193
|
_this.props.circleUpdated(res.data);
|
|
1031
1194
|
}).catch(function (err) {
|
|
1032
|
-
console.log(
|
|
1195
|
+
console.log("error");
|
|
1033
1196
|
|
|
1034
1197
|
_this.setState({
|
|
1035
1198
|
updating: false
|
|
1036
1199
|
});
|
|
1037
1200
|
|
|
1038
|
-
alert(
|
|
1201
|
+
alert("Something went wrong with the request. Please try again.");
|
|
1039
1202
|
});
|
|
1040
1203
|
}
|
|
1041
1204
|
});
|
|
@@ -1056,20 +1219,20 @@ var AddCircle = /*#__PURE__*/function (_Component) {
|
|
|
1056
1219
|
});
|
|
1057
1220
|
});
|
|
1058
1221
|
|
|
1059
|
-
var circleId = Helper$1.safeReadParams(props,
|
|
1222
|
+
var circleId = Helper$1.safeReadParams(props, "circleId");
|
|
1060
1223
|
_this.state = {
|
|
1061
1224
|
circleId: circleId,
|
|
1062
1225
|
circle: _.find(props.circles, function (c) {
|
|
1063
1226
|
return c.Id === circleId;
|
|
1064
1227
|
}),
|
|
1065
|
-
title:
|
|
1228
|
+
title: "",
|
|
1066
1229
|
showWarnings: false,
|
|
1067
1230
|
success: false,
|
|
1068
1231
|
users: [],
|
|
1069
1232
|
selectedUsers: [],
|
|
1070
|
-
userSearch:
|
|
1233
|
+
userSearch: "",
|
|
1071
1234
|
isPublic: false,
|
|
1072
|
-
selectedOption:
|
|
1235
|
+
selectedOption: "visibility"
|
|
1073
1236
|
};
|
|
1074
1237
|
return _this;
|
|
1075
1238
|
}
|
|
@@ -1091,7 +1254,7 @@ var AddCircle = /*#__PURE__*/function (_Component) {
|
|
|
1091
1254
|
this.setState({
|
|
1092
1255
|
image: url
|
|
1093
1256
|
});
|
|
1094
|
-
this.imageInput.
|
|
1257
|
+
this.imageInput.setValue(url);
|
|
1095
1258
|
} else {
|
|
1096
1259
|
setTimeout(function () {
|
|
1097
1260
|
_this2.checkSetImage(url);
|
|
@@ -1124,9 +1287,9 @@ var AddCircle = /*#__PURE__*/function (_Component) {
|
|
|
1124
1287
|
value: function renderSuccess() {
|
|
1125
1288
|
if (!this.state.success) return null;
|
|
1126
1289
|
return /*#__PURE__*/React.createElement(Components$3.SuccessPopup, {
|
|
1127
|
-
text: "".concat(_.capitalize(values.entityName), " has been ").concat(this.state.circleId == null ?
|
|
1290
|
+
text: "".concat(_.capitalize(values.entityName), " has been ").concat(this.state.circleId == null ? "added" : "edited"),
|
|
1128
1291
|
buttons: [{
|
|
1129
|
-
type:
|
|
1292
|
+
type: "outlined",
|
|
1130
1293
|
onClick: function onClick() {
|
|
1131
1294
|
window.history.back();
|
|
1132
1295
|
},
|
|
@@ -1173,7 +1336,7 @@ var AddCircle = /*#__PURE__*/function (_Component) {
|
|
|
1173
1336
|
label: "Do you want to make this ".concat(values.entityName, " a public ").concat(values.entityName, "?"),
|
|
1174
1337
|
isActive: this.state.isPublic,
|
|
1175
1338
|
options: [{
|
|
1176
|
-
Label:
|
|
1339
|
+
Label: "Yes",
|
|
1177
1340
|
Value: true,
|
|
1178
1341
|
onChange: function onChange() {
|
|
1179
1342
|
return _this5.setState({
|
|
@@ -1181,7 +1344,7 @@ var AddCircle = /*#__PURE__*/function (_Component) {
|
|
|
1181
1344
|
});
|
|
1182
1345
|
}
|
|
1183
1346
|
}, {
|
|
1184
|
-
Label:
|
|
1347
|
+
Label: "No",
|
|
1185
1348
|
Value: false,
|
|
1186
1349
|
onChange: function onChange() {
|
|
1187
1350
|
return _this5.setState({
|
|
@@ -1201,7 +1364,7 @@ var AddCircle = /*#__PURE__*/function (_Component) {
|
|
|
1201
1364
|
value: function renderSelectedOption() {
|
|
1202
1365
|
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
1203
1366
|
style: {
|
|
1204
|
-
display: this.state.selectedOption ===
|
|
1367
|
+
display: this.state.selectedOption === "visibility" ? "block" : "none"
|
|
1205
1368
|
}
|
|
1206
1369
|
}, this.renderVisibility()));
|
|
1207
1370
|
}
|
|
@@ -1209,14 +1372,14 @@ var AddCircle = /*#__PURE__*/function (_Component) {
|
|
|
1209
1372
|
key: "renderOptionsSection",
|
|
1210
1373
|
value: function renderOptionsSection() {
|
|
1211
1374
|
var options = [{
|
|
1212
|
-
key:
|
|
1213
|
-
icon:
|
|
1214
|
-
text:
|
|
1375
|
+
key: "visibility",
|
|
1376
|
+
icon: "people3",
|
|
1377
|
+
text: "Visibility"
|
|
1215
1378
|
}];
|
|
1216
1379
|
|
|
1217
1380
|
if (!this.props.circleAllowPublicCircles) {
|
|
1218
1381
|
options = _.filter(options, function (o) {
|
|
1219
|
-
return o.key !==
|
|
1382
|
+
return o.key !== "visibility";
|
|
1220
1383
|
});
|
|
1221
1384
|
}
|
|
1222
1385
|
|
|
@@ -1240,7 +1403,7 @@ var AddCircle = /*#__PURE__*/function (_Component) {
|
|
|
1240
1403
|
}, /*#__PURE__*/React.createElement(Components$3.Text, {
|
|
1241
1404
|
type: "formTitleLarge",
|
|
1242
1405
|
className: "marginBottom-24"
|
|
1243
|
-
}, this.state.circleId == null ?
|
|
1406
|
+
}, this.state.circleId == null ? "New" : "Edit", " ", _.capitalize(values.entityName)), /*#__PURE__*/React.createElement("div", {
|
|
1244
1407
|
className: "flex flex-reverse"
|
|
1245
1408
|
}, /*#__PURE__*/React.createElement(Components$3.ImageInput, {
|
|
1246
1409
|
ref: function ref(_ref2) {
|
|
@@ -1424,7 +1587,7 @@ var Circle = /*#__PURE__*/function (_Component) {
|
|
|
1424
1587
|
|
|
1425
1588
|
case 3:
|
|
1426
1589
|
res = _context.sent;
|
|
1427
|
-
console.log(
|
|
1590
|
+
console.log("getData", res.data);
|
|
1428
1591
|
circle = _.find(res.data, function (c) {
|
|
1429
1592
|
return c.Id === _this.state.circleId;
|
|
1430
1593
|
});
|
|
@@ -1442,7 +1605,7 @@ var Circle = /*#__PURE__*/function (_Component) {
|
|
|
1442
1605
|
case 10:
|
|
1443
1606
|
_context.prev = 10;
|
|
1444
1607
|
_context.t0 = _context["catch"](0);
|
|
1445
|
-
console.error(
|
|
1608
|
+
console.error("getData", _context.t0);
|
|
1446
1609
|
|
|
1447
1610
|
_this.setState({
|
|
1448
1611
|
loadingAll: false
|
|
@@ -1474,8 +1637,8 @@ var Circle = /*#__PURE__*/function (_Component) {
|
|
|
1474
1637
|
while (1) {
|
|
1475
1638
|
switch (_context2.prev = _context2.next) {
|
|
1476
1639
|
case 0:
|
|
1477
|
-
startOf = moment(date,
|
|
1478
|
-
endOf = moment(date,
|
|
1640
|
+
startOf = moment(date, "YYYY-MM-DD").startOf("d");
|
|
1641
|
+
endOf = moment(date, "YYYY-MM-DD").endOf("d");
|
|
1479
1642
|
_context2.next = 4;
|
|
1480
1643
|
return circleActions.getMessages(_this.state.circleId, 10000, startOf.valueOf(), endOf.valueOf());
|
|
1481
1644
|
|
|
@@ -1529,13 +1692,13 @@ var Circle = /*#__PURE__*/function (_Component) {
|
|
|
1529
1692
|
var circle = _this.state.circle;
|
|
1530
1693
|
|
|
1531
1694
|
if (!circle) {
|
|
1532
|
-
return
|
|
1695
|
+
return "";
|
|
1533
1696
|
}
|
|
1534
1697
|
|
|
1535
1698
|
if (circle.IsPrivate) {
|
|
1536
1699
|
return "PM: ".concat(circle.Audience.map(function (user) {
|
|
1537
1700
|
return user.displayName;
|
|
1538
|
-
}).join(
|
|
1701
|
+
}).join(", "));
|
|
1539
1702
|
}
|
|
1540
1703
|
|
|
1541
1704
|
return circle.Title;
|
|
@@ -1543,13 +1706,13 @@ var Circle = /*#__PURE__*/function (_Component) {
|
|
|
1543
1706
|
|
|
1544
1707
|
_defineProperty(_assertThisInitialized(_this), "onHandleChange", function (event) {
|
|
1545
1708
|
var stateChange = {};
|
|
1546
|
-
stateChange[event.target.getAttribute(
|
|
1709
|
+
stateChange[event.target.getAttribute("id")] = event.target.value;
|
|
1547
1710
|
|
|
1548
1711
|
_this.setState(stateChange);
|
|
1549
1712
|
});
|
|
1550
1713
|
|
|
1551
1714
|
_defineProperty(_assertThisInitialized(_this), "onImageUpdated", function (image) {
|
|
1552
|
-
console.log(
|
|
1715
|
+
console.log("updated image");
|
|
1553
1716
|
console.log(image);
|
|
1554
1717
|
|
|
1555
1718
|
_this.setState({
|
|
@@ -1565,7 +1728,7 @@ var Circle = /*#__PURE__*/function (_Component) {
|
|
|
1565
1728
|
});
|
|
1566
1729
|
|
|
1567
1730
|
_defineProperty(_assertThisInitialized(_this), "onFileUpdated", function (url) {
|
|
1568
|
-
console.log(
|
|
1731
|
+
console.log("updated url");
|
|
1569
1732
|
console.log(url);
|
|
1570
1733
|
|
|
1571
1734
|
_this.setState({
|
|
@@ -1586,7 +1749,7 @@ var Circle = /*#__PURE__*/function (_Component) {
|
|
|
1586
1749
|
});
|
|
1587
1750
|
|
|
1588
1751
|
if (m) {
|
|
1589
|
-
var input = document.getElementById(
|
|
1752
|
+
var input = document.getElementById("messageInput");
|
|
1590
1753
|
if (input) input.focus();
|
|
1591
1754
|
}
|
|
1592
1755
|
});
|
|
@@ -1594,7 +1757,7 @@ var Circle = /*#__PURE__*/function (_Component) {
|
|
|
1594
1757
|
_defineProperty(_assertThisInitialized(_this), "handleMessageDateChange", function (date) {
|
|
1595
1758
|
_this.setState({
|
|
1596
1759
|
messageDate: date,
|
|
1597
|
-
messageDateText: moment(date,
|
|
1760
|
+
messageDateText: moment(date, "YYYY-MM-DD").format("DD/MM/YYYY"),
|
|
1598
1761
|
showMessageDate: false,
|
|
1599
1762
|
messages: []
|
|
1600
1763
|
});
|
|
@@ -1632,7 +1795,7 @@ var Circle = /*#__PURE__*/function (_Component) {
|
|
|
1632
1795
|
});
|
|
1633
1796
|
|
|
1634
1797
|
_defineProperty(_assertThisInitialized(_this), "onKeyDown", function (event) {
|
|
1635
|
-
if (event.key ===
|
|
1798
|
+
if (event.key === "Enter" && !event.shiftKey) {
|
|
1636
1799
|
event.preventDefault();
|
|
1637
1800
|
|
|
1638
1801
|
_this.sendMessage();
|
|
@@ -1667,7 +1830,7 @@ var Circle = /*#__PURE__*/function (_Component) {
|
|
|
1667
1830
|
if (m._id === messageToDelete._id) {
|
|
1668
1831
|
return _objectSpread$3(_objectSpread$3({}, m), {}, {
|
|
1669
1832
|
deleted: true,
|
|
1670
|
-
text:
|
|
1833
|
+
text: " "
|
|
1671
1834
|
});
|
|
1672
1835
|
}
|
|
1673
1836
|
|
|
@@ -1697,7 +1860,7 @@ var Circle = /*#__PURE__*/function (_Component) {
|
|
|
1697
1860
|
case 11:
|
|
1698
1861
|
_context4.prev = 11;
|
|
1699
1862
|
_context4.t0 = _context4["catch"](5);
|
|
1700
|
-
console.error(
|
|
1863
|
+
console.error("Failed to delete message:", _context4.t0); // Revert the optimistic update on failure
|
|
1701
1864
|
|
|
1702
1865
|
revertedMessages = _this.state.messages.map(function (m) {
|
|
1703
1866
|
if (m._id === messageToDelete._id) {
|
|
@@ -1712,7 +1875,7 @@ var Circle = /*#__PURE__*/function (_Component) {
|
|
|
1712
1875
|
deletingMessageId: null
|
|
1713
1876
|
});
|
|
1714
1877
|
|
|
1715
|
-
alert(
|
|
1878
|
+
alert("Failed to delete message. Please try again.");
|
|
1716
1879
|
|
|
1717
1880
|
case 17:
|
|
1718
1881
|
case "end":
|
|
@@ -1729,6 +1892,32 @@ var Circle = /*#__PURE__*/function (_Component) {
|
|
|
1729
1892
|
});
|
|
1730
1893
|
});
|
|
1731
1894
|
|
|
1895
|
+
_defineProperty(_assertThisInitialized(_this), "markCircleAsRead", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
|
|
1896
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
1897
|
+
while (1) {
|
|
1898
|
+
switch (_context5.prev = _context5.next) {
|
|
1899
|
+
case 0:
|
|
1900
|
+
_context5.prev = 0;
|
|
1901
|
+
_context5.next = 3;
|
|
1902
|
+
return circleActions.markAsRead(_this.state.circleId, _this.props.user.Id);
|
|
1903
|
+
|
|
1904
|
+
case 3:
|
|
1905
|
+
_context5.next = 8;
|
|
1906
|
+
break;
|
|
1907
|
+
|
|
1908
|
+
case 5:
|
|
1909
|
+
_context5.prev = 5;
|
|
1910
|
+
_context5.t0 = _context5["catch"](0);
|
|
1911
|
+
console.error("Failed to mark circle as read:", _context5.t0);
|
|
1912
|
+
|
|
1913
|
+
case 8:
|
|
1914
|
+
case "end":
|
|
1915
|
+
return _context5.stop();
|
|
1916
|
+
}
|
|
1917
|
+
}
|
|
1918
|
+
}, _callee5, null, [[0, 5]]);
|
|
1919
|
+
})));
|
|
1920
|
+
|
|
1732
1921
|
_defineProperty(_assertThisInitialized(_this), "sendMessage", function () {
|
|
1733
1922
|
var message = {
|
|
1734
1923
|
_id: Helper.randomString(),
|
|
@@ -1770,7 +1959,7 @@ var Circle = /*#__PURE__*/function (_Component) {
|
|
|
1770
1959
|
|
|
1771
1960
|
_this.setState({
|
|
1772
1961
|
messages: [].concat(_toConsumableArray(_this.state.messages), [clonedMessage]),
|
|
1773
|
-
messageInput:
|
|
1962
|
+
messageInput: "",
|
|
1774
1963
|
imageInput: null,
|
|
1775
1964
|
imageInputShowing: false,
|
|
1776
1965
|
fileInput: null,
|
|
@@ -1782,18 +1971,18 @@ var Circle = /*#__PURE__*/function (_Component) {
|
|
|
1782
1971
|
|
|
1783
1972
|
_this.scrollToBottom();
|
|
1784
1973
|
|
|
1785
|
-
_this.imageInput && _this.imageInput.
|
|
1786
|
-
_this.fileInput && _this.fileInput.
|
|
1974
|
+
_this.imageInput && _this.imageInput.setValue(null);
|
|
1975
|
+
_this.fileInput && _this.fileInput.setValue(null);
|
|
1787
1976
|
}, 100);
|
|
1788
1977
|
});
|
|
1789
1978
|
|
|
1790
|
-
var circleId = Helper.safeReadParams(props,
|
|
1979
|
+
var circleId = Helper.safeReadParams(props, "circleId");
|
|
1791
1980
|
_this.state = {
|
|
1792
1981
|
circleId: circleId,
|
|
1793
1982
|
circle: _.find(props.circles, function (c) {
|
|
1794
1983
|
return c.Id === circleId;
|
|
1795
1984
|
}),
|
|
1796
|
-
messageInput:
|
|
1985
|
+
messageInput: "",
|
|
1797
1986
|
messages: [],
|
|
1798
1987
|
images: [],
|
|
1799
1988
|
files: [],
|
|
@@ -1813,6 +2002,7 @@ var Circle = /*#__PURE__*/function (_Component) {
|
|
|
1813
2002
|
_createClass(Circle, [{
|
|
1814
2003
|
key: "componentDidMount",
|
|
1815
2004
|
value: function componentDidMount() {
|
|
2005
|
+
this.markCircleAsRead();
|
|
1816
2006
|
this.checkGetData();
|
|
1817
2007
|
this.connect();
|
|
1818
2008
|
this.props.setNavData({
|
|
@@ -1842,7 +2032,7 @@ var Circle = /*#__PURE__*/function (_Component) {
|
|
|
1842
2032
|
value: function mergeMessages(receivedMessages, excludePending) {
|
|
1843
2033
|
var _this2 = this;
|
|
1844
2034
|
|
|
1845
|
-
var newMessages = _.sortBy(_.concat(this.state.messages, receivedMessages),
|
|
2035
|
+
var newMessages = _.sortBy(_.concat(this.state.messages, receivedMessages), "createdAt");
|
|
1846
2036
|
|
|
1847
2037
|
this.setState({
|
|
1848
2038
|
messages: _.filter(_.uniqBy(newMessages, function (m) {
|
|
@@ -1936,21 +2126,21 @@ var Circle = /*#__PURE__*/function (_Component) {
|
|
|
1936
2126
|
},
|
|
1937
2127
|
onKeyDown: this.onKeyDown
|
|
1938
2128
|
}), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(FontAwesome, {
|
|
1939
|
-
className: "chat_imageIcon".concat(this.state.imageInputShowing ?
|
|
2129
|
+
className: "chat_imageIcon".concat(this.state.imageInputShowing ? " chat_imageIcon-selected" : ""),
|
|
1940
2130
|
name: "camera",
|
|
1941
2131
|
onClick: this.showImageInput
|
|
1942
2132
|
}), /*#__PURE__*/React.createElement(FontAwesome, {
|
|
1943
|
-
className: "chat_imageIcon".concat(this.state.fileInputShowing ?
|
|
2133
|
+
className: "chat_imageIcon".concat(this.state.fileInputShowing ? " chat_imageIcon-selected" : ""),
|
|
1944
2134
|
name: "paperclip",
|
|
1945
2135
|
onClick: this.showFileInput
|
|
1946
2136
|
})), /*#__PURE__*/React.createElement("div", {
|
|
1947
2137
|
className: "overflow-x",
|
|
1948
2138
|
style: {
|
|
1949
|
-
display: this.state.imageInputShowing ?
|
|
2139
|
+
display: this.state.imageInputShowing ? "block" : "none"
|
|
1950
2140
|
}
|
|
1951
2141
|
}, /*#__PURE__*/React.createElement(Components$2.ImageInput, {
|
|
1952
|
-
ref: function ref(
|
|
1953
|
-
_this5.imageInput =
|
|
2142
|
+
ref: function ref(_ref6) {
|
|
2143
|
+
_this5.imageInput = _ref6;
|
|
1954
2144
|
},
|
|
1955
2145
|
multiple: true,
|
|
1956
2146
|
limit: 10,
|
|
@@ -1961,11 +2151,11 @@ var Circle = /*#__PURE__*/function (_Component) {
|
|
|
1961
2151
|
})), /*#__PURE__*/React.createElement("div", {
|
|
1962
2152
|
className: "overflow-x",
|
|
1963
2153
|
style: {
|
|
1964
|
-
display: this.state.fileInputShowing ?
|
|
2154
|
+
display: this.state.fileInputShowing ? "block" : "none"
|
|
1965
2155
|
}
|
|
1966
2156
|
}, /*#__PURE__*/React.createElement(Components$2.FileInput, {
|
|
1967
|
-
ref: function ref(
|
|
1968
|
-
_this5.fileInput =
|
|
2157
|
+
ref: function ref(_ref7) {
|
|
2158
|
+
_this5.fileInput = _ref7;
|
|
1969
2159
|
},
|
|
1970
2160
|
multiple: true,
|
|
1971
2161
|
limit: 10,
|
|
@@ -1995,11 +2185,11 @@ var Circle = /*#__PURE__*/function (_Component) {
|
|
|
1995
2185
|
var isDeleting = this.state.deletingMessageId === m._id;
|
|
1996
2186
|
return /*#__PURE__*/React.createElement("div", {
|
|
1997
2187
|
key: m._id,
|
|
1998
|
-
className: "message".concat(isSelf ?
|
|
2188
|
+
className: "message".concat(isSelf ? " message-self" : "").concat(m.uploading ? " message-uploading" : "").concat(isDeleting ? " message-deleting" : "")
|
|
1999
2189
|
}, /*#__PURE__*/React.createElement(Components$2.Text, {
|
|
2000
2190
|
type: "h5-noUpper",
|
|
2001
2191
|
className: "message_time"
|
|
2002
|
-
}, moment.utc(m.createdAt).local().format(
|
|
2192
|
+
}, moment.utc(m.createdAt).local().format("D MMM YYYY • h:mma")), /*#__PURE__*/React.createElement("div", {
|
|
2003
2193
|
className: "message_inner"
|
|
2004
2194
|
}, /*#__PURE__*/React.createElement(Components$2.ProfilePic, {
|
|
2005
2195
|
size: 40,
|
|
@@ -2010,17 +2200,17 @@ var Circle = /*#__PURE__*/function (_Component) {
|
|
|
2010
2200
|
}, /*#__PURE__*/React.createElement(Components$2.Text, {
|
|
2011
2201
|
type: "body",
|
|
2012
2202
|
className: "message_name"
|
|
2013
|
-
}, m.user.name, m.replyingTo && !isDeleted ? " replied to ".concat(m.replyingTo.user.name) :
|
|
2203
|
+
}, m.user.name, m.replyingTo && !isDeleted ? " replied to ".concat(m.replyingTo.user.name) : ""), m.replyingTo && !isDeleted && /*#__PURE__*/React.createElement("div", {
|
|
2014
2204
|
className: "message_replyBubble"
|
|
2015
2205
|
}, /*#__PURE__*/React.createElement(Components$2.Text, {
|
|
2016
2206
|
type: "body",
|
|
2017
2207
|
className: "message_text"
|
|
2018
|
-
}, Helper.toParagraphed((m.replyingTo.text ||
|
|
2208
|
+
}, Helper.toParagraphed((m.replyingTo.text || "").substr(0, 100)))), /*#__PURE__*/React.createElement("div", {
|
|
2019
2209
|
className: "message_bubble"
|
|
2020
2210
|
}, /*#__PURE__*/React.createElement(Components$2.Text, {
|
|
2021
2211
|
type: "body",
|
|
2022
2212
|
className: "message_text"
|
|
2023
|
-
}, isDeleted ?
|
|
2213
|
+
}, isDeleted ? "[Message deleted]" : Helper.toParagraphed(m.text)), !isDeleted && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", null, (m.image || []).map(function (url, i) {
|
|
2024
2214
|
return /*#__PURE__*/React.createElement("a", {
|
|
2025
2215
|
href: url,
|
|
2026
2216
|
target: "_blank",
|
|
@@ -2039,8 +2229,8 @@ var Circle = /*#__PURE__*/function (_Component) {
|
|
|
2039
2229
|
})))), !isDeleted && /*#__PURE__*/React.createElement("div", {
|
|
2040
2230
|
className: "message_reply",
|
|
2041
2231
|
style: {
|
|
2042
|
-
display:
|
|
2043
|
-
gap:
|
|
2232
|
+
display: "flex",
|
|
2233
|
+
gap: "16px"
|
|
2044
2234
|
}
|
|
2045
2235
|
}, /*#__PURE__*/React.createElement(Components$2.Text, {
|
|
2046
2236
|
type: "button",
|
|
@@ -2077,7 +2267,7 @@ var Circle = /*#__PURE__*/function (_Component) {
|
|
|
2077
2267
|
value: function renderEmptyDate() {
|
|
2078
2268
|
return this.renderMessage({
|
|
2079
2269
|
system: true,
|
|
2080
|
-
text:
|
|
2270
|
+
text: "No messages on this date"
|
|
2081
2271
|
});
|
|
2082
2272
|
}
|
|
2083
2273
|
}, {
|
|
@@ -2092,7 +2282,7 @@ var Circle = /*#__PURE__*/function (_Component) {
|
|
|
2092
2282
|
className: "chat_section_titleSection"
|
|
2093
2283
|
}, /*#__PURE__*/React.createElement(FontAwesome, {
|
|
2094
2284
|
className: "chat_section_titleSection_caret",
|
|
2095
|
-
name: "chevron-".concat(this.state.membersExpanded ?
|
|
2285
|
+
name: "chevron-".concat(this.state.membersExpanded ? "up" : "down"),
|
|
2096
2286
|
onClick: this.toggleMembers
|
|
2097
2287
|
}), /*#__PURE__*/React.createElement("div", {
|
|
2098
2288
|
className: "flex-1"
|
|
@@ -2110,7 +2300,7 @@ var Circle = /*#__PURE__*/function (_Component) {
|
|
|
2110
2300
|
className: "chat_section_titleSection"
|
|
2111
2301
|
}, /*#__PURE__*/React.createElement(FontAwesome, {
|
|
2112
2302
|
className: "chat_section_titleSection_caret",
|
|
2113
|
-
name: "chevron-".concat(this.state.imagesExpanded ?
|
|
2303
|
+
name: "chevron-".concat(this.state.imagesExpanded ? "up" : "down"),
|
|
2114
2304
|
onClick: this.toggleImages
|
|
2115
2305
|
}), /*#__PURE__*/React.createElement("div", {
|
|
2116
2306
|
className: "flex-1"
|
|
@@ -2133,7 +2323,7 @@ var Circle = /*#__PURE__*/function (_Component) {
|
|
|
2133
2323
|
className: "chat_section_titleSection"
|
|
2134
2324
|
}, /*#__PURE__*/React.createElement(FontAwesome, {
|
|
2135
2325
|
className: "chat_section_titleSection_caret",
|
|
2136
|
-
name: "chevron-".concat(this.state.filesExpanded ?
|
|
2326
|
+
name: "chevron-".concat(this.state.filesExpanded ? "up" : "down"),
|
|
2137
2327
|
onClick: this.toggleFiles
|
|
2138
2328
|
}), /*#__PURE__*/React.createElement("div", {
|
|
2139
2329
|
className: "flex-1"
|
|
@@ -2164,7 +2354,7 @@ var Circle = /*#__PURE__*/function (_Component) {
|
|
|
2164
2354
|
className: "chat_replyTo_container"
|
|
2165
2355
|
}, /*#__PURE__*/React.createElement(Components$2.Text, {
|
|
2166
2356
|
type: "h5"
|
|
2167
|
-
}, "Replying to ", m && m.user && !_.isEmpty(m.user.displayName) ? m.user.displayName :
|
|
2357
|
+
}, "Replying to", " ", m && m.user && !_.isEmpty(m.user.displayName) ? m.user.displayName : ""), m && !_.isEmpty(m.text) && /*#__PURE__*/React.createElement(Components$2.Text, {
|
|
2168
2358
|
type: "body"
|
|
2169
2359
|
}, m.text.substr(0, 50))), /*#__PURE__*/React.createElement("div", {
|
|
2170
2360
|
className: "chat_replyTo_remove"
|
|
@@ -2184,14 +2374,14 @@ var Circle = /*#__PURE__*/function (_Component) {
|
|
|
2184
2374
|
return /*#__PURE__*/React.createElement(Components$2.Popup, {
|
|
2185
2375
|
title: "Delete Message",
|
|
2186
2376
|
buttons: [{
|
|
2187
|
-
text:
|
|
2377
|
+
text: "Delete",
|
|
2188
2378
|
onClick: this.onConfirmDelete,
|
|
2189
|
-
type:
|
|
2379
|
+
type: "primary",
|
|
2190
2380
|
isActive: true
|
|
2191
2381
|
}, {
|
|
2192
|
-
text:
|
|
2382
|
+
text: "Cancel",
|
|
2193
2383
|
onClick: this.onCancelDelete,
|
|
2194
|
-
type:
|
|
2384
|
+
type: "tertiary",
|
|
2195
2385
|
isActive: true
|
|
2196
2386
|
}],
|
|
2197
2387
|
onClose: this.onCancelDelete,
|
|
@@ -2208,8 +2398,8 @@ var Circle = /*#__PURE__*/function (_Component) {
|
|
|
2208
2398
|
return /*#__PURE__*/React.createElement(Components$2.OverlayPage, {
|
|
2209
2399
|
fullPage: true,
|
|
2210
2400
|
fullPageStyle: {
|
|
2211
|
-
display:
|
|
2212
|
-
flexDirection:
|
|
2401
|
+
display: "flex",
|
|
2402
|
+
flexDirection: "column"
|
|
2213
2403
|
}
|
|
2214
2404
|
}, this.renderDeleteConfirmPopup(), /*#__PURE__*/React.createElement(Components$2.Header, {
|
|
2215
2405
|
rightContent: this.renderHeaderRight()
|
|
@@ -2259,8 +2449,8 @@ var Circle = /*#__PURE__*/function (_Component) {
|
|
|
2259
2449
|
}, /*#__PURE__*/React.createElement("div", {
|
|
2260
2450
|
className: "chat_newMessage"
|
|
2261
2451
|
}, this.renderChatInput()), this.renderReplyTo(), /*#__PURE__*/React.createElement("div", {
|
|
2262
|
-
ref: function ref(
|
|
2263
|
-
return _this8.chat =
|
|
2452
|
+
ref: function ref(_ref8) {
|
|
2453
|
+
return _this8.chat = _ref8;
|
|
2264
2454
|
},
|
|
2265
2455
|
className: "chat_messages"
|
|
2266
2456
|
}, _.isEmpty(this.state.messages) && !_.isEmpty(this.state.messageDate) && this.renderEmptyDate(), this.state.messages.map(function (m) {
|