@plusscommunities/pluss-newsletter-web-sharing 1.4.36 → 1.4.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -12,9 +12,9 @@ var _defineProperty = require('@babel/runtime/helpers/defineProperty');
12
12
  var React = require('react');
13
13
  var reactRedux = require('react-redux');
14
14
  var _ = require('lodash');
15
- var moment = require('moment');
16
15
  var FontAwesome = require('react-fontawesome');
17
16
  var PlussCore = require('@plusscommunities/pluss-core-web');
17
+ var moment = require('moment');
18
18
  var reactBootstrap = require('react-bootstrap');
19
19
  var reactRouterDom = require('react-router-dom');
20
20
  var reactRouter = require('react-router');
@@ -57,9 +57,9 @@ var _getPrototypeOf__default = /*#__PURE__*/_interopDefaultLegacy(_getPrototypeO
57
57
  var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
58
58
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
59
59
  var ___default = /*#__PURE__*/_interopDefaultLegacy(_);
60
- var moment__default = /*#__PURE__*/_interopDefaultLegacy(moment);
61
60
  var FontAwesome__default = /*#__PURE__*/_interopDefaultLegacy(FontAwesome);
62
61
  var PlussCore__namespace = /*#__PURE__*/_interopNamespace(PlussCore);
62
+ var moment__default = /*#__PURE__*/_interopDefaultLegacy(moment);
63
63
  var _toConsumableArray__default = /*#__PURE__*/_interopDefaultLegacy(_toConsumableArray);
64
64
  var $__default = /*#__PURE__*/_interopDefaultLegacy($);
65
65
  var _asyncToGenerator__default = /*#__PURE__*/_interopDefaultLegacy(_asyncToGenerator);
@@ -158,7 +158,13 @@ var values = {
158
158
  textTheNewsSectionUsesCondensedNewsItems: 'The Sharing section uses condensed Sharing items - smaller images, less information and less scrolling.',
159
159
  textMenuTitle: 'Sharing',
160
160
  textPermissionNewsletterManagement: 'Sharing Management',
161
- textPermissionNewsletterSubmission: 'Sharing Submission (Approval Required)'
161
+ textPermissionNewsletterSubmission: 'Sharing Submission (Approval Required)',
162
+ // Comment subscription notification preference
163
+ notificationPreference: {
164
+ key: 'newsSharingComments',
165
+ label: 'Sharing comments',
166
+ permission: 'newsletterSharing'
167
+ }
162
168
  };
163
169
 
164
170
  // import * as PlussCore from '../../pluss-core/src';
@@ -322,7 +328,8 @@ var FeatureConfig = {
322
328
  init: function init(environment) {
323
329
  FeatureConfig.env = environment;
324
330
  PlussCore__namespace.Config.init(environment);
325
- }
331
+ },
332
+ notificationPreference: values.notificationPreference
326
333
  };
327
334
 
328
335
  var Components$2 = PlussCore__namespace.Components;
@@ -704,7 +711,7 @@ var COLOUR_BRANDING_MAIN = Colours.COLOUR_BRANDING_MAIN;
704
711
  var COLOUR_BRANDING_OFF = Colours.COLOUR_BRANDING_OFF;
705
712
  Colours.COLOUR_BRANDING_ACTION;
706
713
  var COLOUR_BRANDING_APP = Colours.COLOUR_BRANDING_APP;
707
- Colours.TEXT_LIGHT;
714
+ var TEXT_LIGHT = Colours.TEXT_LIGHT;
708
715
  var hexToRGBAstring = Colours.hexToRGBAstring; // Misc
709
716
 
710
717
  var hideChat = Helper$1.hideChat;
@@ -715,6 +722,7 @@ var Text = Components$1.Text;
715
722
  function _createSuper$g(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$g(); 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); }; }
716
723
 
717
724
  function _isNativeReflectConstruct$g() { 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; } }
725
+ var PAGE_SIZE = 100;
718
726
 
719
727
  var ListNewsletter$1 = /*#__PURE__*/function (_Component) {
720
728
  _inherits__default['default'](ListNewsletter, _Component);
@@ -734,12 +742,43 @@ var ListNewsletter$1 = /*#__PURE__*/function (_Component) {
734
742
 
735
743
  _defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "state", {
736
744
  newsletterEntries: [],
737
- sortColumn: 'DateUnix',
738
- // column to sort by
739
- sortDesc: false,
740
- // if true, sort descending rather than ascending
745
+ // Date column sorts on the real UnixTimestamp; defaults to descending so newest posts appear first.
746
+ sortColumn: 'UnixTimestamp',
747
+ sortDesc: true,
741
748
  now: moment__default['default'].utc(),
742
- onlyFuture: true
749
+ search: '',
750
+ startIndex: 0,
751
+ endIndex: PAGE_SIZE
752
+ });
753
+
754
+ _defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "onSearchChange", function (e) {
755
+ _this.setState({
756
+ search: e.target.value,
757
+ startIndex: 0,
758
+ endIndex: PAGE_SIZE
759
+ });
760
+ });
761
+
762
+ _defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "prevPage", function () {
763
+ if (_this.state.startIndex === 0) {
764
+ return;
765
+ }
766
+
767
+ _this.setState({
768
+ startIndex: _this.state.startIndex - PAGE_SIZE,
769
+ endIndex: Math.ceil(_this.state.endIndex / PAGE_SIZE) * PAGE_SIZE - PAGE_SIZE
770
+ });
771
+ });
772
+
773
+ _defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "nextPage", function (filteredCount) {
774
+ if (_this.state.startIndex + PAGE_SIZE >= filteredCount) {
775
+ return;
776
+ }
777
+
778
+ _this.setState({
779
+ startIndex: _this.state.startIndex + PAGE_SIZE,
780
+ endIndex: Math.ceil(_this.state.endIndex / PAGE_SIZE) * PAGE_SIZE + PAGE_SIZE
781
+ });
743
782
  });
744
783
 
745
784
  return _this;
@@ -784,15 +823,24 @@ var ListNewsletter$1 = /*#__PURE__*/function (_Component) {
784
823
  value: function sortByCol(col) {
785
824
  if (this.state.sortColumn === col) {
786
825
  this.setState({
787
- sortDesc: !this.state.sortDesc
826
+ sortDesc: !this.state.sortDesc,
827
+ startIndex: 0,
828
+ endIndex: PAGE_SIZE
788
829
  });
789
830
  } else {
790
831
  this.setState({
791
832
  sortColumn: col,
792
- sortDesc: false
833
+ sortDesc: false,
834
+ startIndex: 0,
835
+ endIndex: PAGE_SIZE
793
836
  });
794
837
  }
795
838
  }
839
+ }, {
840
+ key: "getPaginationText",
841
+ value: function getPaginationText(filteredCount) {
842
+ return "".concat(Math.min(this.state.startIndex + 1, filteredCount), "-").concat(Math.min(this.state.endIndex, filteredCount), "/").concat(filteredCount);
843
+ }
796
844
  }, {
797
845
  key: "removeNewsletterEntry",
798
846
  value: function removeNewsletterEntry(newsletter) {
@@ -812,22 +860,6 @@ var ListNewsletter$1 = /*#__PURE__*/function (_Component) {
812
860
  value: function renderNewsletter(source) {
813
861
  var _this4 = this;
814
862
 
815
- // let source = _.sortBy(this.state.newsletterEntries, this.state.sortColumn);
816
- // if (this.state.sortDesc) {
817
- // source.reverse();
818
- // }
819
- // source = _.filter(source, (ev) => {
820
- // if (!ev) {
821
- // return false
822
- // }
823
- // return true;
824
- // });
825
- // if (this.props.onlyFuture) {
826
- // const nownow = moment().startOf('month');
827
- // source = _.filter(source, (ev) => {
828
- // return nownow.isSameOrBefore(moment.utc(ev.UnixTimestamp).local());
829
- // });
830
- // }
831
863
  return source.map(function (ev) {
832
864
  if (ev != null) {
833
865
  return /*#__PURE__*/React__default['default'].createElement("tr", {
@@ -916,15 +948,15 @@ var ListNewsletter$1 = /*#__PURE__*/function (_Component) {
916
948
  condensed: true,
917
949
  hover: true
918
950
  }, /*#__PURE__*/React__default['default'].createElement("thead", null, /*#__PURE__*/React__default['default'].createElement("tr", null, /*#__PURE__*/React__default['default'].createElement("th", {
919
- className: "".concat(this.sortIsActive('DateUnix')),
951
+ className: "".concat(this.sortIsActive('UnixTimestamp')),
920
952
  style: {
921
953
  cursor: 'pointer',
922
954
  width: 140
923
955
  },
924
956
  onClick: function onClick() {
925
- _this5.sortByCol('DateUnix');
957
+ _this5.sortByCol('UnixTimestamp');
926
958
  }
927
- }, "Date published", this.renderSort('DateUnix')), /*#__PURE__*/React__default['default'].createElement("th", {
959
+ }, "Date published", this.renderSort('UnixTimestamp')), /*#__PURE__*/React__default['default'].createElement("th", {
928
960
  className: "".concat(this.sortIsActive('Title')),
929
961
  style: {
930
962
  cursor: 'pointer'
@@ -962,9 +994,57 @@ var ListNewsletter$1 = /*#__PURE__*/function (_Component) {
962
994
  type: "h3"
963
995
  }, values.textThereAreNoNews)));
964
996
  }
997
+ }, {
998
+ key: "renderPager",
999
+ value: function renderPager(filteredCount) {
1000
+ var _this6 = this;
1001
+
1002
+ if (filteredCount <= PAGE_SIZE) {
1003
+ return null;
1004
+ }
1005
+
1006
+ return /*#__PURE__*/React__default['default'].createElement("div", {
1007
+ className: "paginationContainer",
1008
+ style: {
1009
+ margin: '8px 0'
1010
+ }
1011
+ }, /*#__PURE__*/React__default['default'].createElement(FontAwesome__default['default'], {
1012
+ className: "pagination__left",
1013
+ name: "chevron-left",
1014
+ style: {
1015
+ cursor: 'pointer',
1016
+ fontSize: 20,
1017
+ color: TEXT_LIGHT
1018
+ },
1019
+ onClick: this.prevPage
1020
+ }), /*#__PURE__*/React__default['default'].createElement("p", {
1021
+ className: "pagination__text",
1022
+ style: {
1023
+ display: 'inline-block',
1024
+ margin: 0,
1025
+ padding: '0 16px',
1026
+ minWidth: 120,
1027
+ textAlign: 'center',
1028
+ color: TEXT_LIGHT
1029
+ }
1030
+ }, this.getPaginationText(filteredCount)), /*#__PURE__*/React__default['default'].createElement(FontAwesome__default['default'], {
1031
+ className: "pagination__right",
1032
+ name: "chevron-right",
1033
+ style: {
1034
+ cursor: 'pointer',
1035
+ fontSize: 20,
1036
+ color: TEXT_LIGHT
1037
+ },
1038
+ onClick: function onClick() {
1039
+ return _this6.nextPage(filteredCount);
1040
+ }
1041
+ }));
1042
+ }
965
1043
  }, {
966
1044
  key: "renderContent",
967
1045
  value: function renderContent() {
1046
+ var _this7 = this;
1047
+
968
1048
  var source = ___default['default'].sortBy(this.state.newsletterEntries, this.state.sortColumn);
969
1049
 
970
1050
  if (this.state.sortDesc) {
@@ -978,20 +1058,25 @@ var ListNewsletter$1 = /*#__PURE__*/function (_Component) {
978
1058
 
979
1059
  return true;
980
1060
  });
1061
+ var search = this.state.search;
981
1062
 
982
- if (this.props.onlyFuture) {
983
- var nownow = moment__default['default']().startOf('month');
1063
+ if (!___default['default'].isEmpty(search)) {
1064
+ var lowSearch = search.toLowerCase();
984
1065
  source = ___default['default'].filter(source, function (ev) {
985
- return nownow.isSameOrBefore(moment__default['default'].utc(ev.UnixTimestamp).local());
986
- });
987
- } // source = []
1066
+ if (!ev.Title) {
1067
+ return false;
1068
+ }
988
1069
 
1070
+ return ev.Title.toLowerCase().indexOf(lowSearch) > -1;
1071
+ });
1072
+ } // Total matching the search/sort BEFORE the page slice — drives the pager text.
989
1073
 
990
- if (___default['default'].isEmpty(source)) {
991
- return this.renderEmpty();
992
- }
993
1074
 
994
- return this.renderView(source);
1075
+ var filteredCount = source.length;
1076
+ source = ___default['default'].filter(source, function (ev, i) {
1077
+ return i >= _this7.state.startIndex && i < _this7.state.endIndex;
1078
+ });
1079
+ return /*#__PURE__*/React__default['default'].createElement("div", null, ___default['default'].isEmpty(source) ? this.renderEmpty() : this.renderView(source), this.renderPager(filteredCount));
995
1080
  }
996
1081
  }, {
997
1082
  key: "render",
@@ -1000,7 +1085,16 @@ var ListNewsletter$1 = /*#__PURE__*/function (_Component) {
1000
1085
  style: {
1001
1086
  minWidth: '100%'
1002
1087
  }
1003
- }, this.renderContent());
1088
+ }, /*#__PURE__*/React__default['default'].createElement(reactBootstrap.FormControl, {
1089
+ type: "text",
1090
+ placeholder: "Search news",
1091
+ value: this.state.search,
1092
+ onChange: this.onSearchChange,
1093
+ style: {
1094
+ marginBottom: 16,
1095
+ maxWidth: 360
1096
+ }
1097
+ }), this.renderContent());
1004
1098
  }
1005
1099
  }]);
1006
1100
 
@@ -1981,9 +2075,6 @@ var NewsHub = /*#__PURE__*/function (_Component) {
1981
2075
  loadingSubmissions: false,
1982
2076
  submissionEntries: [],
1983
2077
  allList: [],
1984
- thisMonth: [],
1985
- now: moment__default['default'].utc(),
1986
- onlyFuture: true,
1987
2078
  search: ''
1988
2079
  };
1989
2080
  return _this;
@@ -2008,18 +2099,8 @@ var NewsHub = /*#__PURE__*/function (_Component) {
2008
2099
  }, {
2009
2100
  key: "updateProps",
2010
2101
  value: function updateProps(props) {
2011
- var thisMonth = [];
2012
- var nownow = moment__default['default']().startOf('month');
2013
- props.news.forEach(function (rep) {
2014
- var isThisMonth = nownow.isSameOrBefore(moment__default['default'].utc(rep.UnixTimestamp).local());
2015
-
2016
- if (isThisMonth) {
2017
- thisMonth.push(rep);
2018
- }
2019
- });
2020
2102
  this.setState({
2021
2103
  allList: props.news,
2022
- thisMonth: thisMonth,
2023
2104
  submissionEntries: props.submissions
2024
2105
  });
2025
2106
  }
@@ -2223,9 +2304,7 @@ var NewsHub = /*#__PURE__*/function (_Component) {
2223
2304
  return /*#__PURE__*/React__default['default'].createElement(AvailableNews, null);
2224
2305
  }
2225
2306
 
2226
- return /*#__PURE__*/React__default['default'].createElement(ListNewsletterEntries, {
2227
- onlyFuture: this.state.selectedSection === 'thisMonth'
2228
- });
2307
+ return /*#__PURE__*/React__default['default'].createElement(ListNewsletterEntries, null);
2229
2308
  }
2230
2309
  }, {
2231
2310
  key: "render",
package/dist/index.esm.js CHANGED
@@ -8,10 +8,10 @@ import _defineProperty from '@babel/runtime/helpers/defineProperty';
8
8
  import React, { Component, useState, useEffect } from 'react';
9
9
  import { connect } from 'react-redux';
10
10
  import _ from 'lodash';
11
- import moment from 'moment';
12
11
  import FontAwesome from 'react-fontawesome';
13
12
  import * as PlussCore from '@plusscommunities/pluss-core-web';
14
- import { Table, FormGroup } from 'react-bootstrap';
13
+ import moment from 'moment';
14
+ import { Table, FormControl, FormGroup } from 'react-bootstrap';
15
15
  import { Link } from 'react-router-dom';
16
16
  import { withRouter } from 'react-router';
17
17
  import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
@@ -114,7 +114,13 @@ var values = {
114
114
  textTheNewsSectionUsesCondensedNewsItems: 'The Sharing section uses condensed Sharing items - smaller images, less information and less scrolling.',
115
115
  textMenuTitle: 'Sharing',
116
116
  textPermissionNewsletterManagement: 'Sharing Management',
117
- textPermissionNewsletterSubmission: 'Sharing Submission (Approval Required)'
117
+ textPermissionNewsletterSubmission: 'Sharing Submission (Approval Required)',
118
+ // Comment subscription notification preference
119
+ notificationPreference: {
120
+ key: 'newsSharingComments',
121
+ label: 'Sharing comments',
122
+ permission: 'newsletterSharing'
123
+ }
118
124
  };
119
125
 
120
126
  // import * as PlussCore from '../../pluss-core/src';
@@ -278,7 +284,8 @@ var FeatureConfig = {
278
284
  init: function init(environment) {
279
285
  FeatureConfig.env = environment;
280
286
  PlussCore.Config.init(environment);
281
- }
287
+ },
288
+ notificationPreference: values.notificationPreference
282
289
  };
283
290
 
284
291
  var Components$2 = PlussCore.Components;
@@ -660,7 +667,7 @@ var COLOUR_BRANDING_MAIN = Colours.COLOUR_BRANDING_MAIN;
660
667
  var COLOUR_BRANDING_OFF = Colours.COLOUR_BRANDING_OFF;
661
668
  Colours.COLOUR_BRANDING_ACTION;
662
669
  var COLOUR_BRANDING_APP = Colours.COLOUR_BRANDING_APP;
663
- Colours.TEXT_LIGHT;
670
+ var TEXT_LIGHT = Colours.TEXT_LIGHT;
664
671
  var hexToRGBAstring = Colours.hexToRGBAstring; // Misc
665
672
 
666
673
  var hideChat = Helper$1.hideChat;
@@ -671,6 +678,7 @@ var Text = Components$1.Text;
671
678
  function _createSuper$g(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$g(); 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); }; }
672
679
 
673
680
  function _isNativeReflectConstruct$g() { 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; } }
681
+ var PAGE_SIZE = 100;
674
682
 
675
683
  var ListNewsletter$1 = /*#__PURE__*/function (_Component) {
676
684
  _inherits(ListNewsletter, _Component);
@@ -690,12 +698,43 @@ var ListNewsletter$1 = /*#__PURE__*/function (_Component) {
690
698
 
691
699
  _defineProperty(_assertThisInitialized(_this), "state", {
692
700
  newsletterEntries: [],
693
- sortColumn: 'DateUnix',
694
- // column to sort by
695
- sortDesc: false,
696
- // if true, sort descending rather than ascending
701
+ // Date column sorts on the real UnixTimestamp; defaults to descending so newest posts appear first.
702
+ sortColumn: 'UnixTimestamp',
703
+ sortDesc: true,
697
704
  now: moment.utc(),
698
- onlyFuture: true
705
+ search: '',
706
+ startIndex: 0,
707
+ endIndex: PAGE_SIZE
708
+ });
709
+
710
+ _defineProperty(_assertThisInitialized(_this), "onSearchChange", function (e) {
711
+ _this.setState({
712
+ search: e.target.value,
713
+ startIndex: 0,
714
+ endIndex: PAGE_SIZE
715
+ });
716
+ });
717
+
718
+ _defineProperty(_assertThisInitialized(_this), "prevPage", function () {
719
+ if (_this.state.startIndex === 0) {
720
+ return;
721
+ }
722
+
723
+ _this.setState({
724
+ startIndex: _this.state.startIndex - PAGE_SIZE,
725
+ endIndex: Math.ceil(_this.state.endIndex / PAGE_SIZE) * PAGE_SIZE - PAGE_SIZE
726
+ });
727
+ });
728
+
729
+ _defineProperty(_assertThisInitialized(_this), "nextPage", function (filteredCount) {
730
+ if (_this.state.startIndex + PAGE_SIZE >= filteredCount) {
731
+ return;
732
+ }
733
+
734
+ _this.setState({
735
+ startIndex: _this.state.startIndex + PAGE_SIZE,
736
+ endIndex: Math.ceil(_this.state.endIndex / PAGE_SIZE) * PAGE_SIZE + PAGE_SIZE
737
+ });
699
738
  });
700
739
 
701
740
  return _this;
@@ -740,15 +779,24 @@ var ListNewsletter$1 = /*#__PURE__*/function (_Component) {
740
779
  value: function sortByCol(col) {
741
780
  if (this.state.sortColumn === col) {
742
781
  this.setState({
743
- sortDesc: !this.state.sortDesc
782
+ sortDesc: !this.state.sortDesc,
783
+ startIndex: 0,
784
+ endIndex: PAGE_SIZE
744
785
  });
745
786
  } else {
746
787
  this.setState({
747
788
  sortColumn: col,
748
- sortDesc: false
789
+ sortDesc: false,
790
+ startIndex: 0,
791
+ endIndex: PAGE_SIZE
749
792
  });
750
793
  }
751
794
  }
795
+ }, {
796
+ key: "getPaginationText",
797
+ value: function getPaginationText(filteredCount) {
798
+ return "".concat(Math.min(this.state.startIndex + 1, filteredCount), "-").concat(Math.min(this.state.endIndex, filteredCount), "/").concat(filteredCount);
799
+ }
752
800
  }, {
753
801
  key: "removeNewsletterEntry",
754
802
  value: function removeNewsletterEntry(newsletter) {
@@ -768,22 +816,6 @@ var ListNewsletter$1 = /*#__PURE__*/function (_Component) {
768
816
  value: function renderNewsletter(source) {
769
817
  var _this4 = this;
770
818
 
771
- // let source = _.sortBy(this.state.newsletterEntries, this.state.sortColumn);
772
- // if (this.state.sortDesc) {
773
- // source.reverse();
774
- // }
775
- // source = _.filter(source, (ev) => {
776
- // if (!ev) {
777
- // return false
778
- // }
779
- // return true;
780
- // });
781
- // if (this.props.onlyFuture) {
782
- // const nownow = moment().startOf('month');
783
- // source = _.filter(source, (ev) => {
784
- // return nownow.isSameOrBefore(moment.utc(ev.UnixTimestamp).local());
785
- // });
786
- // }
787
819
  return source.map(function (ev) {
788
820
  if (ev != null) {
789
821
  return /*#__PURE__*/React.createElement("tr", {
@@ -872,15 +904,15 @@ var ListNewsletter$1 = /*#__PURE__*/function (_Component) {
872
904
  condensed: true,
873
905
  hover: true
874
906
  }, /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("th", {
875
- className: "".concat(this.sortIsActive('DateUnix')),
907
+ className: "".concat(this.sortIsActive('UnixTimestamp')),
876
908
  style: {
877
909
  cursor: 'pointer',
878
910
  width: 140
879
911
  },
880
912
  onClick: function onClick() {
881
- _this5.sortByCol('DateUnix');
913
+ _this5.sortByCol('UnixTimestamp');
882
914
  }
883
- }, "Date published", this.renderSort('DateUnix')), /*#__PURE__*/React.createElement("th", {
915
+ }, "Date published", this.renderSort('UnixTimestamp')), /*#__PURE__*/React.createElement("th", {
884
916
  className: "".concat(this.sortIsActive('Title')),
885
917
  style: {
886
918
  cursor: 'pointer'
@@ -918,9 +950,57 @@ var ListNewsletter$1 = /*#__PURE__*/function (_Component) {
918
950
  type: "h3"
919
951
  }, values.textThereAreNoNews)));
920
952
  }
953
+ }, {
954
+ key: "renderPager",
955
+ value: function renderPager(filteredCount) {
956
+ var _this6 = this;
957
+
958
+ if (filteredCount <= PAGE_SIZE) {
959
+ return null;
960
+ }
961
+
962
+ return /*#__PURE__*/React.createElement("div", {
963
+ className: "paginationContainer",
964
+ style: {
965
+ margin: '8px 0'
966
+ }
967
+ }, /*#__PURE__*/React.createElement(FontAwesome, {
968
+ className: "pagination__left",
969
+ name: "chevron-left",
970
+ style: {
971
+ cursor: 'pointer',
972
+ fontSize: 20,
973
+ color: TEXT_LIGHT
974
+ },
975
+ onClick: this.prevPage
976
+ }), /*#__PURE__*/React.createElement("p", {
977
+ className: "pagination__text",
978
+ style: {
979
+ display: 'inline-block',
980
+ margin: 0,
981
+ padding: '0 16px',
982
+ minWidth: 120,
983
+ textAlign: 'center',
984
+ color: TEXT_LIGHT
985
+ }
986
+ }, this.getPaginationText(filteredCount)), /*#__PURE__*/React.createElement(FontAwesome, {
987
+ className: "pagination__right",
988
+ name: "chevron-right",
989
+ style: {
990
+ cursor: 'pointer',
991
+ fontSize: 20,
992
+ color: TEXT_LIGHT
993
+ },
994
+ onClick: function onClick() {
995
+ return _this6.nextPage(filteredCount);
996
+ }
997
+ }));
998
+ }
921
999
  }, {
922
1000
  key: "renderContent",
923
1001
  value: function renderContent() {
1002
+ var _this7 = this;
1003
+
924
1004
  var source = _.sortBy(this.state.newsletterEntries, this.state.sortColumn);
925
1005
 
926
1006
  if (this.state.sortDesc) {
@@ -934,20 +1014,25 @@ var ListNewsletter$1 = /*#__PURE__*/function (_Component) {
934
1014
 
935
1015
  return true;
936
1016
  });
1017
+ var search = this.state.search;
937
1018
 
938
- if (this.props.onlyFuture) {
939
- var nownow = moment().startOf('month');
1019
+ if (!_.isEmpty(search)) {
1020
+ var lowSearch = search.toLowerCase();
940
1021
  source = _.filter(source, function (ev) {
941
- return nownow.isSameOrBefore(moment.utc(ev.UnixTimestamp).local());
942
- });
943
- } // source = []
1022
+ if (!ev.Title) {
1023
+ return false;
1024
+ }
944
1025
 
1026
+ return ev.Title.toLowerCase().indexOf(lowSearch) > -1;
1027
+ });
1028
+ } // Total matching the search/sort BEFORE the page slice — drives the pager text.
945
1029
 
946
- if (_.isEmpty(source)) {
947
- return this.renderEmpty();
948
- }
949
1030
 
950
- return this.renderView(source);
1031
+ var filteredCount = source.length;
1032
+ source = _.filter(source, function (ev, i) {
1033
+ return i >= _this7.state.startIndex && i < _this7.state.endIndex;
1034
+ });
1035
+ return /*#__PURE__*/React.createElement("div", null, _.isEmpty(source) ? this.renderEmpty() : this.renderView(source), this.renderPager(filteredCount));
951
1036
  }
952
1037
  }, {
953
1038
  key: "render",
@@ -956,7 +1041,16 @@ var ListNewsletter$1 = /*#__PURE__*/function (_Component) {
956
1041
  style: {
957
1042
  minWidth: '100%'
958
1043
  }
959
- }, this.renderContent());
1044
+ }, /*#__PURE__*/React.createElement(FormControl, {
1045
+ type: "text",
1046
+ placeholder: "Search news",
1047
+ value: this.state.search,
1048
+ onChange: this.onSearchChange,
1049
+ style: {
1050
+ marginBottom: 16,
1051
+ maxWidth: 360
1052
+ }
1053
+ }), this.renderContent());
960
1054
  }
961
1055
  }]);
962
1056
 
@@ -1937,9 +2031,6 @@ var NewsHub = /*#__PURE__*/function (_Component) {
1937
2031
  loadingSubmissions: false,
1938
2032
  submissionEntries: [],
1939
2033
  allList: [],
1940
- thisMonth: [],
1941
- now: moment.utc(),
1942
- onlyFuture: true,
1943
2034
  search: ''
1944
2035
  };
1945
2036
  return _this;
@@ -1964,18 +2055,8 @@ var NewsHub = /*#__PURE__*/function (_Component) {
1964
2055
  }, {
1965
2056
  key: "updateProps",
1966
2057
  value: function updateProps(props) {
1967
- var thisMonth = [];
1968
- var nownow = moment().startOf('month');
1969
- props.news.forEach(function (rep) {
1970
- var isThisMonth = nownow.isSameOrBefore(moment.utc(rep.UnixTimestamp).local());
1971
-
1972
- if (isThisMonth) {
1973
- thisMonth.push(rep);
1974
- }
1975
- });
1976
2058
  this.setState({
1977
2059
  allList: props.news,
1978
- thisMonth: thisMonth,
1979
2060
  submissionEntries: props.submissions
1980
2061
  });
1981
2062
  }
@@ -2179,9 +2260,7 @@ var NewsHub = /*#__PURE__*/function (_Component) {
2179
2260
  return /*#__PURE__*/React.createElement(AvailableNews, null);
2180
2261
  }
2181
2262
 
2182
- return /*#__PURE__*/React.createElement(ListNewsletterEntries, {
2183
- onlyFuture: this.state.selectedSection === 'thisMonth'
2184
- });
2263
+ return /*#__PURE__*/React.createElement(ListNewsletterEntries, null);
2185
2264
  }
2186
2265
  }, {
2187
2266
  key: "render",