@cu-mkp/editioncrafter 0.0.7 → 0.0.8

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.
@@ -1,6 +1,5 @@
1
- export default function glossaryInitialState(glossaryURL) {
1
+ export default function glossaryInitialState() {
2
2
  return {
3
- glossaryURL: glossaryURL,
4
3
  glossary: {},
5
4
  loaded: false
6
5
  };
@@ -6,18 +6,13 @@ import DiplomaticActions from './DiplomaticActions';
6
6
  import diplomaticInitialState from './initialState/diplomaticInitialState';
7
7
  import glossaryInitialState from './initialState/glossaryInitialState';
8
8
  import documentInitialState from './initialState/documentInitialState';
9
- import CommentActions from './CommentActions';
10
- import commentInitialState from './initialState/commentInitialState';
11
9
  export default function rootReducer(config) {
12
10
  var iiifManifest = config.iiifManifest,
13
11
  documentName = config.documentName,
14
- commentsURL = config.commentsURL,
15
- glossaryURL = config.glossaryURL,
16
12
  transcriptionTypes = config.transcriptionTypes;
17
13
  return combineReducers({
18
14
  diplomatic: createReducer('DiplomaticActions', DiplomaticActions, diplomaticInitialState),
19
15
  document: createReducer('DocumentActions', DocumentActions, documentInitialState(iiifManifest, documentName, transcriptionTypes)),
20
- glossary: createReducer('GlossaryActions', GlossaryActions, glossaryInitialState(glossaryURL)),
21
- comments: createReducer('CommentActions', CommentActions, commentInitialState(commentsURL))
16
+ glossary: createReducer('GlossaryActions', GlossaryActions, glossaryInitialState())
22
17
  });
23
18
  }
@@ -14,7 +14,6 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new Referen
14
14
  function _isNativeReflectConstruct() { 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; } }
15
15
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
16
16
  import React, { Component } from 'react';
17
- import { connect } from 'react-redux';
18
17
  import Typography from '@material-ui/core/Typography';
19
18
  import Popper from '@material-ui/core/Popper';
20
19
  import Fade from '@material-ui/core/Fade';
@@ -50,12 +49,8 @@ var EditorComment = /*#__PURE__*/function (_Component) {
50
49
  var _this$state = this.state,
51
50
  anchorRef = _this$state.anchorRef,
52
51
  open = _this$state.open;
53
- var id = "comment-".concat(this.props.commentID);
54
- var comments = this.props.comments.comments;
55
- var comment = comments[this.props.commentID] ? comments[this.props.commentID].comment : null;
56
- var interpreted;
57
- if (comment) interpreted = Parser(comment);
58
- var content = interpreted || comment || "ERROR: Could not find comment for id: ".concat(this.props.commentID, ".");
52
+ var interpreted = Parser(this.props.text);
53
+ var content = interpreted || "ERROR: Could not find comment for id: ".concat(this.props.commentID, ".");
59
54
  var style = {
60
55
  maxWidth: 200,
61
56
  padding: '25px 15px 15px 15px'
@@ -66,7 +61,7 @@ var EditorComment = /*#__PURE__*/function (_Component) {
66
61
  fontStyle: 'bold'
67
62
  };
68
63
  return /*#__PURE__*/React.createElement(Popper, {
69
- id: id,
64
+ id: this.props.commentID,
70
65
  open: open,
71
66
  anchorEl: anchorRef
72
67
  }, /*#__PURE__*/React.createElement(Fade, {
@@ -106,9 +101,4 @@ var EditorComment = /*#__PURE__*/function (_Component) {
106
101
  }]);
107
102
  return EditorComment;
108
103
  }(Component);
109
- function mapStateToProps(state) {
110
- return {
111
- comments: state.comments
112
- };
113
- }
114
- export default connect(mapStateToProps)(EditorComment);
104
+ export default EditorComment;
@@ -9,7 +9,6 @@ import ListItemText from '@material-ui/core/ListItemText';
9
9
  import { FaArrowCircleLeft, FaArrowCircleRight } from 'react-icons/fa';
10
10
  import asterisk from '../icons/howtouse-asterisk.png';
11
11
  import curly from '../icons/howtouse-curly.png';
12
- import beaker from '../icons/howtouse-beaker.png';
13
12
  import square from '../icons/howtouse-square.png';
14
13
  import ups from '../icons/howtouse-ups.png';
15
14
  var HelpPopper = function HelpPopper(props) {
@@ -70,9 +69,6 @@ var HelpPopper = function HelpPopper(props) {
70
69
  src: square,
71
70
  alt: "howtouse-square"
72
71
  })), /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement(Typography, null, "Editorial interventions and corrections"))), /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement("img", {
73
- src: beaker,
74
- alt: "howtouse-beaker"
75
- })), /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement(Typography, null, "Associated research essay"))), /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement("img", {
76
72
  src: asterisk,
77
73
  alt: "howtouse-asterisk"
78
74
  })), /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement(Typography, null, "Editorial Comments"))))))), /*#__PURE__*/React.createElement(Typography, null, "See \xA0", /*#__PURE__*/React.createElement("a", {
@@ -222,13 +222,11 @@ var Navigation = /*#__PURE__*/function (_React$Component) {
222
222
  value: documentView[side].transcriptionType,
223
223
  id: "doc-type",
224
224
  onClick: this.changeType
225
- }, /*#__PURE__*/React.createElement(MenuItem, {
226
- value: "tl"
227
- }, DocumentHelper.transcriptionTypeLabels.tl), /*#__PURE__*/React.createElement(MenuItem, {
228
- value: "tc"
229
- }, DocumentHelper.transcriptionTypeLabels.tc), /*#__PURE__*/React.createElement(MenuItem, {
230
- value: "tcn"
231
- }, DocumentHelper.transcriptionTypeLabels.tcn), /*#__PURE__*/React.createElement(MenuItem, {
225
+ }, Object.keys(this.props.document.transcriptionTypes).map(function (ttKey) {
226
+ return /*#__PURE__*/React.createElement(MenuItem, {
227
+ value: ttKey
228
+ }, _this2.props.document.transcriptionTypes[ttKey]);
229
+ }), /*#__PURE__*/React.createElement(MenuItem, {
232
230
  value: "f"
233
231
  }, DocumentHelper.transcriptionTypeLabels.f), /*#__PURE__*/React.createElement(MenuItem, {
234
232
  value: "glossary"
@@ -68,11 +68,25 @@ var TranscriptionView = /*#__PURE__*/function (_Component) {
68
68
  });
69
69
  }
70
70
  var transcriptionData = folio.transcription[transcriptionType];
71
+ if (!transcriptionData) {
72
+ return /*#__PURE__*/React.createElement(Watermark, {
73
+ documentView: documentView,
74
+ documentViewActions: documentViewActions,
75
+ side: side
76
+ });
77
+ }
71
78
 
72
79
  // Configure parser to replace certain tags with components
73
80
  var htmlToReactParserOptionsSide = htmlToReactParserOptions();
74
81
  var html = transcriptionData.html,
75
82
  layout = transcriptionData.layout;
83
+ if (!html) {
84
+ return /*#__PURE__*/React.createElement(Watermark, {
85
+ documentView: documentView,
86
+ documentViewActions: documentViewActions,
87
+ side: side
88
+ });
89
+ }
76
90
  var surfaceStyle = {
77
91
  gridTemplateAreas: layout
78
92
  };
@@ -104,12 +118,42 @@ function htmlToReactParserOptions() {
104
118
  var parserOptions = {
105
119
  replace: function replace(domNode) {
106
120
  switch (domNode.name) {
107
- case 'comment':
121
+ case 'tei-note':
108
122
  {
109
- var commentID = domNode.attribs.rid; // ( domNode.children && domNode.children[0] ) ? domNode.children[0].data : null
123
+ var _domNode$children$;
124
+ var text = ((_domNode$children$ = domNode.children[0]) === null || _domNode$children$ === void 0 ? void 0 : _domNode$children$.data) || '';
125
+ var id = domNode.attribs.n;
126
+
127
+ // Not sure what else to do if there's no ID
128
+ if (!id) {
129
+ return domNode;
130
+ }
110
131
  return /*#__PURE__*/React.createElement(EditorComment, {
111
- commentID: commentID
132
+ commentID: id,
133
+ text: text
134
+ });
135
+ }
136
+ case 'tei-figure':
137
+ {
138
+ var _graphicEl$attribs, _descEl$children$;
139
+ var graphicEl = domNode.children.find(function (ch) {
140
+ return ch.name === 'tei-graphic';
141
+ });
142
+ var src = graphicEl === null || graphicEl === void 0 ? void 0 : (_graphicEl$attribs = graphicEl.attribs) === null || _graphicEl$attribs === void 0 ? void 0 : _graphicEl$attribs.url;
143
+ if (!src) {
144
+ return domNode;
145
+ }
146
+ var descEl = domNode.children.find(function (ch) {
147
+ return ch.name === 'tei-figdesc';
112
148
  });
149
+ var desc = descEl === null || descEl === void 0 ? void 0 : (_descEl$children$ = descEl.children[0]) === null || _descEl$children$ === void 0 ? void 0 : _descEl$children$.data;
150
+ return /*#__PURE__*/React.createElement("figure", {
151
+ className: "inline-figure"
152
+ }, /*#__PURE__*/React.createElement("img", {
153
+ src: src,
154
+ alt: desc || '',
155
+ className: "inline-image"
156
+ }), desc ? /*#__PURE__*/React.createElement("figcaption", null, desc) : null);
113
157
  }
114
158
  default:
115
159
  /* Otherwise, Just pass through */
@@ -1,10 +1,8 @@
1
1
  var DocumentHelper = {};
2
2
  DocumentHelper.transcriptionTypeLabels = {
3
- tc: 'Diplomatic (FR)',
4
- tcn: 'Normalized (FR)',
5
- tl: 'Translation (EN)',
6
3
  f: 'Facsimile',
7
- anno: 'Research Esssay',
8
- glossary: 'Glossary'
4
+ // keep
5
+ glossary: 'Glossary' // keep
9
6
  };
7
+
10
8
  export default DocumentHelper;
@@ -22,6 +22,9 @@ export function loadFolio(folioData) {
22
22
  // promise to load all the data for this folio
23
23
  return new Promise(function (resolve, reject) {
24
24
  var transcriptionTypes = Object.keys(folio.annotationURLs);
25
+ var transcriptionTypeTracker = Object.fromEntries(transcriptionTypes.map(function (t) {
26
+ return [t, false];
27
+ }));
25
28
  if (transcriptionTypes.length > 0) {
26
29
  axios.get(folio.image_zoom_url).then(function (imageServerResponse) {
27
30
  // Handle the image server response
@@ -43,11 +46,18 @@ export function loadFolio(folioData) {
43
46
  } else {
44
47
  folio.transcription[transcriptionType] = transcription;
45
48
  folio.loading = false;
46
- resolve(folio);
49
+ transcriptionTypeTracker[transcriptionType] = true;
47
50
  }
48
51
  }))["catch"](function (error) {
49
52
  folioData.loading = false;
50
53
  reject(error);
54
+ })["finally"](function () {
55
+ // Only resolve once all transcription types have been fetched
56
+ if (Object.values(transcriptionTypeTracker).filter(function (v) {
57
+ return !v;
58
+ }).length === 0) {
59
+ resolve(folio);
60
+ }
51
61
  });
52
62
  };
53
63
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
@@ -3,8 +3,7 @@ var _marked = /*#__PURE__*/_regeneratorRuntime().mark(userNavigation),
3
3
  _marked2 = /*#__PURE__*/_regeneratorRuntime().mark(resolveDocumentManifest),
4
4
  _marked3 = /*#__PURE__*/_regeneratorRuntime().mark(resolveFolio),
5
5
  _marked4 = /*#__PURE__*/_regeneratorRuntime().mark(resolveGlossary),
6
- _marked5 = /*#__PURE__*/_regeneratorRuntime().mark(resolveComments),
7
- _marked6 = /*#__PURE__*/_regeneratorRuntime().mark(routeListenerSaga);
6
+ _marked5 = /*#__PURE__*/_regeneratorRuntime().mark(routeListenerSaga);
8
7
  import axios from 'axios';
9
8
  import { takeEvery, select } from 'redux-saga/effects';
10
9
  import { putResolveAction } from '../model/ReduxStore';
@@ -15,38 +14,33 @@ var justDocument = function justDocument(state) {
15
14
  var justGlossary = function justGlossary(state) {
16
15
  return state.glossary;
17
16
  };
18
- var justComments = function justComments(state) {
19
- return state.comments;
20
- };
21
17
  function userNavigation(action) {
22
- var pathname, pathSegments;
18
+ var pathname, pathSegments, manifest;
23
19
  return _regeneratorRuntime().wrap(function userNavigation$(_context) {
24
20
  while (1) switch (_context.prev = _context.next) {
25
21
  case 0:
26
22
  pathname = action.payload.params[0].pathname;
27
23
  pathSegments = pathname.split('/');
28
24
  if (!(pathSegments.length > 1)) {
29
- _context.next = 15;
25
+ _context.next = 14;
30
26
  break;
31
27
  }
32
28
  _context.t0 = pathSegments[1];
33
- _context.next = _context.t0 === 'ec' ? 6 : 15;
29
+ _context.next = _context.t0 === 'ec' ? 6 : 14;
34
30
  break;
35
31
  case 6:
36
32
  _context.next = 8;
37
- return resolveComments();
38
- case 8:
39
- _context.next = 10;
40
33
  return resolveDocumentManifest();
41
- case 10:
42
- _context.next = 12;
43
- return resolveGlossary();
44
- case 12:
45
- _context.next = 14;
34
+ case 8:
35
+ manifest = _context.sent;
36
+ _context.next = 11;
37
+ return resolveGlossary(manifest);
38
+ case 11:
39
+ _context.next = 13;
46
40
  return resolveFolio(pathSegments);
41
+ case 13:
42
+ return _context.abrupt("break", 14);
47
43
  case 14:
48
- return _context.abrupt("break", 15);
49
- case 15:
50
44
  case "end":
51
45
  return _context.stop();
52
46
  }
@@ -62,7 +56,7 @@ function resolveDocumentManifest() {
62
56
  case 2:
63
57
  document = _context2.sent;
64
58
  if (document.loaded) {
65
- _context2.next = 9;
59
+ _context2.next = 10;
66
60
  break;
67
61
  }
68
62
  _context2.next = 6;
@@ -72,6 +66,10 @@ function resolveDocumentManifest() {
72
66
  _context2.next = 9;
73
67
  return putResolveAction('DocumentActions.loadDocument', response.data);
74
68
  case 9:
69
+ return _context2.abrupt("return", response.data);
70
+ case 10:
71
+ return _context2.abrupt("return", null);
72
+ case 11:
75
73
  case "end":
76
74
  return _context2.stop();
77
75
  }
@@ -127,8 +125,8 @@ function resolveFolio(pathSegments) {
127
125
  }
128
126
  }, _marked3);
129
127
  }
130
- function resolveGlossary() {
131
- var glossary, response;
128
+ function resolveGlossary(manifest) {
129
+ var glossary, glossaryURL, response;
132
130
  return _regeneratorRuntime().wrap(function resolveGlossary$(_context4) {
133
131
  while (1) switch (_context4.prev = _context4.next) {
134
132
  case 0:
@@ -137,55 +135,37 @@ function resolveGlossary() {
137
135
  case 2:
138
136
  glossary = _context4.sent;
139
137
  if (glossary.loaded) {
140
- _context4.next = 9;
138
+ _context4.next = 12;
141
139
  break;
142
140
  }
143
- _context4.next = 6;
144
- return axios.get(glossary.glossaryURL);
141
+ if (!(!(manifest !== null && manifest !== void 0 && manifest.seeAlso) || manifest.seeAlso.length === 0 || !manifest.seeAlso[0].id)) {
142
+ _context4.next = 6;
143
+ break;
144
+ }
145
+ throw new Error('Missing glossary link in seeAlso array.');
145
146
  case 6:
146
- response = _context4.sent;
147
+ glossaryURL = manifest.seeAlso[0].id;
147
148
  _context4.next = 9;
148
- return putResolveAction('GlossaryActions.loadGlossary', response.data);
149
+ return axios.get(glossaryURL);
149
150
  case 9:
151
+ response = _context4.sent;
152
+ _context4.next = 12;
153
+ return putResolveAction('GlossaryActions.loadGlossary', response.data);
154
+ case 12:
150
155
  case "end":
151
156
  return _context4.stop();
152
157
  }
153
158
  }, _marked4);
154
159
  }
155
- function resolveComments() {
156
- var comments, response;
157
- return _regeneratorRuntime().wrap(function resolveComments$(_context5) {
160
+ export default function routeListenerSaga() {
161
+ return _regeneratorRuntime().wrap(function routeListenerSaga$(_context5) {
158
162
  while (1) switch (_context5.prev = _context5.next) {
159
163
  case 0:
160
164
  _context5.next = 2;
161
- return select(justComments);
165
+ return takeEvery('RouteListenerSaga.userNavigatation', userNavigation);
162
166
  case 2:
163
- comments = _context5.sent;
164
- if (comments.loaded) {
165
- _context5.next = 9;
166
- break;
167
- }
168
- _context5.next = 6;
169
- return axios.get(comments.commentsURL);
170
- case 6:
171
- response = _context5.sent;
172
- _context5.next = 9;
173
- return putResolveAction('CommentActions.loadComments', response.data);
174
- case 9:
175
167
  case "end":
176
168
  return _context5.stop();
177
169
  }
178
170
  }, _marked5);
179
- }
180
- export default function routeListenerSaga() {
181
- return _regeneratorRuntime().wrap(function routeListenerSaga$(_context6) {
182
- while (1) switch (_context6.prev = _context6.next) {
183
- case 0:
184
- _context6.next = 2;
185
- return takeEvery('RouteListenerSaga.userNavigatation', userNavigation);
186
- case 2:
187
- case "end":
188
- return _context6.stop();
189
- }
190
- }, _marked6);
191
171
  }
@@ -7,161 +7,165 @@
7
7
  @include md {
8
8
  padding: 5px 16px;
9
9
  }
10
-
10
+
11
11
  -webkit-user-select: text;
12
12
  -moz-user-select: text;
13
13
  -ms-user-select: text;
14
14
  user-select: text;
15
15
  margin-bottom:92px;
16
-
16
+
17
17
  figure {
18
- display: inline;
18
+ display: inline-flex;
19
+ flex-direction: column;
20
+ width: 100%;
21
+ align-items: center;
22
+ gap: 6px;
19
23
  }
20
-
24
+
21
25
  .block[data-layout='right-middle'] {
22
26
  max-width: 250px;
23
27
  }
24
-
28
+
25
29
  .block[data-layout='right-top'] {
26
30
  max-width: 250px;
27
31
  }
28
-
32
+
29
33
  .block[data-layout='right-bottom'] {
30
34
  max-width: 250px;
31
35
  }
32
-
36
+
33
37
  // TODO refactor to appropriate TEI element
34
38
  // .ups {
35
39
  // background: lightgray;
36
40
  // font-size: 14px;
37
41
  // }
38
-
42
+
39
43
  .x-small-inline-figure {
40
44
  margin: 5px;
41
45
  border: 1px solid gray;
42
46
  width: 30px;
43
47
  }
44
-
48
+
45
49
  .small-inline-figure {
46
50
  margin: 5px;
47
51
  border: 1px solid gray;
48
52
  width: 60px;
49
53
  }
50
-
54
+
51
55
  .medium-inline-figure {
52
56
  margin: 5px;
53
57
  border: 1px solid gray;
54
58
  width: 200px;
55
59
  }
56
-
60
+
57
61
  .large-inline-figure {
58
62
  margin: 5px;
59
63
  border: 1px solid gray;
60
64
  width: 350px;
61
65
  }
62
-
63
-
66
+
67
+
64
68
  .surface {
65
69
  grid-area: transcription;
66
70
  margin: 0;
67
71
  padding: 0;
68
72
  list-style: none;
69
73
  }
70
-
74
+
71
75
  .grid-mode {
72
76
  display: grid;
73
77
  grid-auto-rows: minmax(min-content, 0fr);
74
78
  grid-gap: 2px;
75
79
  }
76
-
80
+
77
81
  .surface > .small-font {
78
82
  font-size: 11pt;
79
83
  }
80
-
84
+
81
85
  .surface > div {
82
86
  padding: 10px;
83
87
  }
84
-
88
+
85
89
  .surface > #z0 {
86
90
  grid-area: z0;
87
91
  }
88
-
92
+
89
93
  .surface > #z1 {
90
94
  grid-area: z1;
91
95
  }
92
-
96
+
93
97
  .surface > #z2 {
94
98
  grid-area: z2;
95
99
  }
96
-
100
+
97
101
  .surface > #z3 {
98
102
  grid-area: z3;
99
103
  }
100
-
104
+
101
105
  .surface > #z4 {
102
106
  grid-area: z4;
103
107
  }
104
-
108
+
105
109
  .surface > #z5 {
106
110
  grid-area: z5;
107
111
  }
108
-
112
+
109
113
  .surface > #z6 {
110
114
  grid-area: z6;
111
115
  }
112
-
116
+
113
117
  .surface > #z7 {
114
118
  grid-area: z7;
115
119
  }
116
-
120
+
117
121
  .surface > #z8 {
118
122
  grid-area: z8;
119
123
  }
120
-
124
+
121
125
  .surface > #z9 {
122
126
  grid-area: z9;
123
127
  }
124
-
128
+
125
129
  .surface > #z10 {
126
130
  grid-area: z10;
127
131
  }
128
-
132
+
129
133
  .surface > #z11 {
130
134
  grid-area: z11;
131
135
  }
132
-
136
+
133
137
  .surface > #z12 {
134
138
  grid-area: z12;
135
139
  }
136
-
140
+
137
141
  .surface > #z13 {
138
142
  grid-area: z13;
139
143
  }
140
-
144
+
141
145
  .surface > #z14 {
142
146
  grid-area: z14;
143
147
  }
144
-
148
+
145
149
  .surface > #z15 {
146
150
  grid-area: z15;
147
151
  }
148
-
152
+
149
153
  .surface > #z16 {
150
154
  grid-area: z16;
151
155
  }
152
-
156
+
153
157
  .surface > #z17 {
154
158
  grid-area: z17;
155
159
  }
156
-
160
+
157
161
  .surface > #z18 {
158
162
  grid-area: z18;
159
163
  }
160
-
164
+
161
165
  .surface > #z19 {
162
166
  grid-area: z19;
163
167
  }
164
-
168
+
165
169
  .surface > #z20 {
166
170
  grid-area: z20;
167
171
  }
@@ -175,4 +179,9 @@
175
179
  word-wrap:break-word;
176
180
  }
177
181
 
178
-
182
+ .inline-image {
183
+ max-width: 90%;
184
+ max-height: 360px;
185
+ margin: auto;
186
+ text-align: center;
187
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cu-mkp/editioncrafter",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "description": "",
5
5
  "private": false,
6
6
  "main": "dist/editioncrafter.min.js",
@@ -1,13 +0,0 @@
1
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
2
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
3
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
5
- function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
6
- var CommentsActions = {};
7
- CommentsActions.loadComments = function loadComments(state, commentData) {
8
- return _objectSpread(_objectSpread({}, state), {}, {
9
- loaded: true,
10
- comments: commentData
11
- });
12
- };
13
- export default CommentsActions;
@@ -1,7 +0,0 @@
1
- export default function commentInitialState(commentsURL) {
2
- return {
3
- commentsURL: commentsURL,
4
- comments: {},
5
- loaded: false
6
- };
7
- }