@plusscommunities/pluss-circles-web 1.5.6 → 1.5.7-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +232 -42
- package/dist/index.esm.js +232 -42
- package/dist/index.umd.js +232 -42
- package/package.json +1 -1
- package/src/apis/circleActions.js +10 -0
- package/src/screens/Circle.js +9 -0
- 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
|
}]);
|
|
@@ -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(),
|
|
@@ -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({
|
|
@@ -1972,8 +2162,8 @@
|
|
|
1972
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,
|
|
@@ -1987,8 +2177,8 @@
|
|
|
1987
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,
|
|
@@ -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) {
|
package/package.json
CHANGED
|
@@ -113,4 +113,14 @@ export const circleActions = {
|
|
|
113
113
|
},
|
|
114
114
|
});
|
|
115
115
|
},
|
|
116
|
+
markAsRead: async (circleId, userId) => {
|
|
117
|
+
return Session.authedFunction({
|
|
118
|
+
method: 'post',
|
|
119
|
+
url: Helper.getUrl('groups', 'resetunread'),
|
|
120
|
+
data: {
|
|
121
|
+
groupID: circleId,
|
|
122
|
+
userID: userId,
|
|
123
|
+
},
|
|
124
|
+
});
|
|
125
|
+
},
|
|
116
126
|
};
|
package/src/screens/Circle.js
CHANGED
|
@@ -37,6 +37,7 @@ class Circle extends Component {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
componentDidMount() {
|
|
40
|
+
this.markCircleAsRead();
|
|
40
41
|
this.checkGetData();
|
|
41
42
|
this.connect();
|
|
42
43
|
this.props.setNavData({ hideSideMenu: true });
|
|
@@ -332,6 +333,14 @@ class Circle extends Component {
|
|
|
332
333
|
});
|
|
333
334
|
};
|
|
334
335
|
|
|
336
|
+
|
|
337
|
+
markCircleAsRead = async () => {
|
|
338
|
+
try {
|
|
339
|
+
await circleActions.markAsRead(this.state.circleId, this.props.user.Id);
|
|
340
|
+
} catch (error) {
|
|
341
|
+
console.error("Failed to mark circle as read:", error);
|
|
342
|
+
}
|
|
343
|
+
};
|
|
335
344
|
sendMessage = () => {
|
|
336
345
|
const message = {
|
|
337
346
|
_id: Helper.randomString(),
|