-
Notifications
You must be signed in to change notification settings - Fork 0
/
bundle.9d8fcf0159cc64d3a8b1.js
2398 lines (1857 loc) · 229 KB
/
bundle.9d8fcf0159cc64d3a8b1.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
webpackJsonp([4,5],{
/***/ 127:
/***/ function(module, exports) {
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
var stylesInDom = {},
memoize = function(fn) {
var memo;
return function () {
if (typeof memo === "undefined") memo = fn.apply(this, arguments);
return memo;
};
},
isOldIE = memoize(function() {
return /msie [6-9]\b/.test(self.navigator.userAgent.toLowerCase());
}),
getHeadElement = memoize(function () {
return document.head || document.getElementsByTagName("head")[0];
}),
singletonElement = null,
singletonCounter = 0,
styleElementsInsertedAtTop = [];
module.exports = function(list, options) {
if(typeof DEBUG !== "undefined" && DEBUG) {
if(typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment");
}
options = options || {};
// Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
// tags it will allow on a page
if (typeof options.singleton === "undefined") options.singleton = isOldIE();
// By default, add <style> tags to the bottom of <head>.
if (typeof options.insertAt === "undefined") options.insertAt = "bottom";
var styles = listToStyles(list);
addStylesToDom(styles, options);
return function update(newList) {
var mayRemove = [];
for(var i = 0; i < styles.length; i++) {
var item = styles[i];
var domStyle = stylesInDom[item.id];
domStyle.refs--;
mayRemove.push(domStyle);
}
if(newList) {
var newStyles = listToStyles(newList);
addStylesToDom(newStyles, options);
}
for(var i = 0; i < mayRemove.length; i++) {
var domStyle = mayRemove[i];
if(domStyle.refs === 0) {
for(var j = 0; j < domStyle.parts.length; j++)
domStyle.parts[j]();
delete stylesInDom[domStyle.id];
}
}
};
}
function addStylesToDom(styles, options) {
for(var i = 0; i < styles.length; i++) {
var item = styles[i];
var domStyle = stylesInDom[item.id];
if(domStyle) {
domStyle.refs++;
for(var j = 0; j < domStyle.parts.length; j++) {
domStyle.parts[j](item.parts[j]);
}
for(; j < item.parts.length; j++) {
domStyle.parts.push(addStyle(item.parts[j], options));
}
} else {
var parts = [];
for(var j = 0; j < item.parts.length; j++) {
parts.push(addStyle(item.parts[j], options));
}
stylesInDom[item.id] = {id: item.id, refs: 1, parts: parts};
}
}
}
function listToStyles(list) {
var styles = [];
var newStyles = {};
for(var i = 0; i < list.length; i++) {
var item = list[i];
var id = item[0];
var css = item[1];
var media = item[2];
var sourceMap = item[3];
var part = {css: css, media: media, sourceMap: sourceMap};
if(!newStyles[id])
styles.push(newStyles[id] = {id: id, parts: [part]});
else
newStyles[id].parts.push(part);
}
return styles;
}
function insertStyleElement(options, styleElement) {
var head = getHeadElement();
var lastStyleElementInsertedAtTop = styleElementsInsertedAtTop[styleElementsInsertedAtTop.length - 1];
if (options.insertAt === "top") {
if(!lastStyleElementInsertedAtTop) {
head.insertBefore(styleElement, head.firstChild);
} else if(lastStyleElementInsertedAtTop.nextSibling) {
head.insertBefore(styleElement, lastStyleElementInsertedAtTop.nextSibling);
} else {
head.appendChild(styleElement);
}
styleElementsInsertedAtTop.push(styleElement);
} else if (options.insertAt === "bottom") {
head.appendChild(styleElement);
} else {
throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'.");
}
}
function removeStyleElement(styleElement) {
styleElement.parentNode.removeChild(styleElement);
var idx = styleElementsInsertedAtTop.indexOf(styleElement);
if(idx >= 0) {
styleElementsInsertedAtTop.splice(idx, 1);
}
}
function createStyleElement(options) {
var styleElement = document.createElement("style");
styleElement.type = "text/css";
insertStyleElement(options, styleElement);
return styleElement;
}
function createLinkElement(options) {
var linkElement = document.createElement("link");
linkElement.rel = "stylesheet";
insertStyleElement(options, linkElement);
return linkElement;
}
function addStyle(obj, options) {
var styleElement, update, remove;
if (options.singleton) {
var styleIndex = singletonCounter++;
styleElement = singletonElement || (singletonElement = createStyleElement(options));
update = applyToSingletonTag.bind(null, styleElement, styleIndex, false);
remove = applyToSingletonTag.bind(null, styleElement, styleIndex, true);
} else if(obj.sourceMap &&
typeof URL === "function" &&
typeof URL.createObjectURL === "function" &&
typeof URL.revokeObjectURL === "function" &&
typeof Blob === "function" &&
typeof btoa === "function") {
styleElement = createLinkElement(options);
update = updateLink.bind(null, styleElement);
remove = function() {
removeStyleElement(styleElement);
if(styleElement.href)
URL.revokeObjectURL(styleElement.href);
};
} else {
styleElement = createStyleElement(options);
update = applyToTag.bind(null, styleElement);
remove = function() {
removeStyleElement(styleElement);
};
}
update(obj);
return function updateStyle(newObj) {
if(newObj) {
if(newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap)
return;
update(obj = newObj);
} else {
remove();
}
};
}
var replaceText = (function () {
var textStore = [];
return function (index, replacement) {
textStore[index] = replacement;
return textStore.filter(Boolean).join('\n');
};
})();
function applyToSingletonTag(styleElement, index, remove, obj) {
var css = remove ? "" : obj.css;
if (styleElement.styleSheet) {
styleElement.styleSheet.cssText = replaceText(index, css);
} else {
var cssNode = document.createTextNode(css);
var childNodes = styleElement.childNodes;
if (childNodes[index]) styleElement.removeChild(childNodes[index]);
if (childNodes.length) {
styleElement.insertBefore(cssNode, childNodes[index]);
} else {
styleElement.appendChild(cssNode);
}
}
}
function applyToTag(styleElement, obj) {
var css = obj.css;
var media = obj.media;
if(media) {
styleElement.setAttribute("media", media)
}
if(styleElement.styleSheet) {
styleElement.styleSheet.cssText = css;
} else {
while(styleElement.firstChild) {
styleElement.removeChild(styleElement.firstChild);
}
styleElement.appendChild(document.createTextNode(css));
}
}
function updateLink(linkElement, obj) {
var css = obj.css;
var sourceMap = obj.sourceMap;
if(sourceMap) {
// http://stackoverflow.com/a/26603875
css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */";
}
var blob = new Blob([css], { type: "text/css" });
var oldSrc = linkElement.href;
linkElement.href = URL.createObjectURL(blob);
if(oldSrc)
URL.revokeObjectURL(oldSrc);
}
/***/ },
/***/ 1510:
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _react = __webpack_require__(3);
var _react2 = _interopRequireDefault(_react);
var _reactDom = __webpack_require__(74);
var _reactDom2 = _interopRequireDefault(_reactDom);
var _redux = __webpack_require__(29);
var _reactRedux = __webpack_require__(14);
var _reduxThunk = __webpack_require__(75);
var _reduxThunk2 = _interopRequireDefault(_reduxThunk);
var _reducers = __webpack_require__(207);
var _reducers2 = _interopRequireDefault(_reducers);
var _router = __webpack_require__(208);
var _router2 = _interopRequireDefault(_router);
__webpack_require__(209);
__webpack_require__(210);
__webpack_require__(211);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
console.log("hey there how are you doing!");
var App = function App() {
var store = (0, _redux.createStore)(_reducers2.default, {}, (0, _redux.applyMiddleware)(_reduxThunk2.default));
return _react2.default.createElement(
_reactRedux.Provider,
{ store: store },
_react2.default.createElement(_router2.default, null)
);
};
_reactDom2.default.render(_react2.default.createElement(App, null), document.getElementById('root'));
/***/ },
/***/ 16:
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _ = __webpack_require__(10);
var Artist = __webpack_require__(17);
var artists = _.times(20, function () {
return Artist();
});
module.exports = artists;
/***/ },
/***/ 17:
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _lodash = __webpack_require__(10);
var _lodash2 = _interopRequireDefault(_lodash);
var _faker = __webpack_require__(128);
var _faker2 = _interopRequireDefault(_faker);
var _constants = __webpack_require__(212);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
module.exports = function () {
return {
_id: _lodash2.default.uniqueId(),
name: _faker2.default.name.findName(),
age: randomBetween(15, 45),
yearsActive: randomBetween(0, 15),
image: _faker2.default.image.avatar(),
genre: getGenre(),
website: _faker2.default.internet.url(),
netWorth: randomBetween(0, 5000000),
labelName: _faker2.default.company.companyName(),
retired: _faker2.default.random.boolean(),
albums: getAlbums()
};
};
function getAlbums() {
return _lodash2.default.times(randomBetween(0, 5), function () {
var copiesSold = randomBetween(0, 1000000);
return {
title: _lodash2.default.capitalize(_faker2.default.random.words()),
date: _faker2.default.date.past(),
copiesSold: copiesSold,
numberTracks: randomBetween(1, 20),
image: getAlbumImage(),
revenue: copiesSold * 12.99
};
});
}
function getAlbumImage() {
var types = _lodash2.default.keys(_faker2.default.image);
var method = randomEntry(types);
return _faker2.default.image[method]();
}
function getGenre() {
return randomEntry(_constants.GENRES);
}
function randomEntry(array) {
return array[~~(Math.random() * array.length)];
}
function randomBetween(min, max) {
return ~~(Math.random() * (max - min)) + min;
}
/***/ },
/***/ 207:
/***/ function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _redux = __webpack_require__(29);
var _reduxForm = __webpack_require__(71);
var _FilterCriteriaReducer = __webpack_require__(234);
var _FilterCriteriaReducer2 = _interopRequireDefault(_FilterCriteriaReducer);
var _ArtistsReducer = __webpack_require__(232);
var _ArtistsReducer2 = _interopRequireDefault(_ArtistsReducer);
var _ErrorReducer = __webpack_require__(233);
var _ErrorReducer2 = _interopRequireDefault(_ErrorReducer);
var _SelectionReducer = __webpack_require__(235);
var _SelectionReducer2 = _interopRequireDefault(_SelectionReducer);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = (0, _redux.combineReducers)({
form: _reduxForm.reducer,
filterCriteria: _FilterCriteriaReducer2.default,
artists: _ArtistsReducer2.default,
errors: _ErrorReducer2.default,
selection: _SelectionReducer2.default
});
/***/ },
/***/ 208:
/***/ function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = __webpack_require__(3);
var _react2 = _interopRequireDefault(_react);
var _reactRouter = __webpack_require__(41);
var _Home = __webpack_require__(223);
var _Home2 = _interopRequireDefault(_Home);
var _ArtistMain = __webpack_require__(226);
var _ArtistMain2 = _interopRequireDefault(_ArtistMain);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var componentRoutes = {
component: _Home2.default,
path: '/',
indexRoute: { component: _ArtistMain2.default },
childRoutes: [{
path: 'artists/new',
getComponent: function getComponent(location, cb) {
__webpack_require__.e/* import() */(2).then(__webpack_require__.bind(null, 1512)).then(function (module) {
return cb(null, module.default);
});
}
}, {
path: 'artists/:id',
getComponent: function getComponent(location, cb) {
__webpack_require__.e/* import() */(1).then(__webpack_require__.bind(null, 1513)).then(function (module) {
return cb(null, module.default);
});
}
}, {
path: 'artists/:id/edit',
getComponent: function getComponent(location, cb) {
__webpack_require__.e/* import() */(0).then(__webpack_require__.bind(null, 1514)).then(function (module) {
return cb(null, module.default);
});
}
}]
};
var Routes = function Routes() {
return _react2.default.createElement(_reactRouter.Router, { history: _reactRouter.hashHistory, routes: componentRoutes });
};
exports.default = Routes;
/***/ },
/***/ 209:
/***/ function(module, exports, __webpack_require__) {
// style-loader: Adds some css to the DOM by adding a <style> tag
// load the styles
var content = __webpack_require__(237);
if(typeof content === 'string') content = [[module.i, content, '']];
// add the styles to the DOM
var update = __webpack_require__(127)(content, {});
if(content.locals) module.exports = content.locals;
// Hot Module Replacement
if(false) {
// When the styles change, update the <style> tags
if(!content.locals) {
module.hot.accept("!!../node_modules/css-loader/index.js!./materialize.css", function() {
var newContent = require("!!../node_modules/css-loader/index.js!./materialize.css");
if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
update(newContent);
});
}
// When the module is disposed, remove the <style> tags
module.hot.dispose(function() { update(); });
}
/***/ },
/***/ 210:
/***/ function(module, exports, __webpack_require__) {
// style-loader: Adds some css to the DOM by adding a <style> tag
// load the styles
var content = __webpack_require__(238);
if(typeof content === 'string') content = [[module.i, content, '']];
// add the styles to the DOM
var update = __webpack_require__(127)(content, {});
if(content.locals) module.exports = content.locals;
// Hot Module Replacement
if(false) {
// When the styles change, update the <style> tags
if(!content.locals) {
module.hot.accept("!!../node_modules/css-loader/index.js!./react-range.css", function() {
var newContent = require("!!../node_modules/css-loader/index.js!./react-range.css");
if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
update(newContent);
});
}
// When the module is disposed, remove the <style> tags
module.hot.dispose(function() { update(); });
}
/***/ },
/***/ 211:
/***/ function(module, exports, __webpack_require__) {
// style-loader: Adds some css to the DOM by adding a <style> tag
// load the styles
var content = __webpack_require__(239);
if(typeof content === 'string') content = [[module.i, content, '']];
// add the styles to the DOM
var update = __webpack_require__(127)(content, {});
if(content.locals) module.exports = content.locals;
// Hot Module Replacement
if(false) {
// When the styles change, update the <style> tags
if(!content.locals) {
module.hot.accept("!!../node_modules/css-loader/index.js!./style.css", function() {
var newContent = require("!!../node_modules/css-loader/index.js!./style.css");
if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
update(newContent);
});
}
// When the module is disposed, remove the <style> tags
module.hot.dispose(function() { update(); });
}
/***/ },
/***/ 212:
/***/ function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var GENRES = exports.GENRES = ['Acceptable Country', 'Acceptable Emo', 'Acceptable Pop', 'Acceptable Pop-Punk', 'Alt-Country', 'Alt-Rap', 'Bloghaus', 'Blog Rap', 'Blog Rock', 'Cold Wave', 'Cool Jazz', 'Digital Punk', 'Doom Metal', 'Freak Folk', 'Garage Rock', 'Hypnagogic Pop', 'Noise Pop', 'Power Electronics', 'Serialism', 'Witch House', 'Ye Olde Timey Rock And Roll Music of Indeterminate Hipster Variety'];
/***/ },
/***/ 213:
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _ = __webpack_require__(10);
var Artist = __webpack_require__(17);
var db = __webpack_require__(16);
/**
* Create a single artist in the artist collection.
* @param {object} artistProps - Object containing a name, age, yearsActive, and genre
* @return {promise} A promise that resolves with the Artist that was created
*/
module.exports = function (artistProps) {
var artist = _.extend({}, artistProps, {
_id: _.uniqueId(),
age: parseInt(artistProps.age) || 20,
yearsActive: parseInt(artistProps.yearsActive) || 5
});
db.push(artist);
return new Promise(function (resolve, reject) {
resolve(artist);
});
};
/***/ },
/***/ 214:
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _ = __webpack_require__(10);
var Artist = __webpack_require__(17);
var db = __webpack_require__(16);
/**
* Deletes a single artist from the Artists collection
* @param {string} _id - The ID of the artist to delete.
* @return {promise} A promise that resolves when the record is deleted
*/
module.exports = function (_id) {
_.each(db, function (artist, index) {
if (artist && artist._id === _id) {
db.splice(index, 1);
}
});
return new Promise(function (resolve, reject) {
return resolve();
});
};
/***/ },
/***/ 215:
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _ = __webpack_require__(10);
var Artist = __webpack_require__(17);
var db = __webpack_require__(16);
/**
* Edits a single artist in the Artists collection
* @param {string} _id - The ID of the artist to edit.
* @param {object} artistProps - An object with a name, age, yearsActive, and genre
* @return {promise} A promise that resolves when the record is edited
*/
module.exports = function (_id, artistProps) {
var artist = _.find(db, function (a) {
return a._id === _id;
});
_.extend(artist, artistProps);
return new Promise(function (resolve, reject) {
resolve();
});
};
/***/ },
/***/ 216:
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _ = __webpack_require__(10);
var Artist = __webpack_require__(17);
var db = __webpack_require__(16);
/**
* Finds a single artist in the artist collection.
* @param {string} _id - The ID of the record to find.
* @return {promise} A promise that resolves with the Artist that matches the id
*/
module.exports = function (_id) {
var artist = _.find(db, function (a) {
return a._id === _id;
});
return new Promise(function (resolve, reject) {
resolve(artist);
});
};
/***/ },
/***/ 217:
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _ = __webpack_require__(10);
var Artist = __webpack_require__(17);
var db = __webpack_require__(16);
/**
* Finds the lowest and highest age of artists in the Artist collection
* @return {promise} A promise that resolves with an object
* containing the min and max ages, like { min: 16, max: 45 }.
*/
module.exports = function () {
return new Promise(function (resolve, reject) {
var range = {
max: _.maxBy(db, function (a) {
return a.age;
}).age,
min: _.minBy(db, function (a) {
return a.age;
}).age
};
resolve(range);
});
};
/***/ },
/***/ 218:
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _ = __webpack_require__(10);
var Artist = __webpack_require__(17);
var db = __webpack_require__(16);
/**
* Finds the lowest and highest yearsActive of artists in the Artist collection
* @return {promise} A promise that resolves with an object
* containing the min and max yearsActive, like { min: 0, max: 14 }.
*/
module.exports = function () {
return new Promise(function (resolve, reject) {
var range = {
max: _.maxBy(db, function (a) {
return a.yearsActive;
}).yearsActive,
min: _.minBy(db, function (a) {
return a.yearsActive;
}).yearsActive
};
resolve(range);
});
};
/***/ },
/***/ 219:
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _ = __webpack_require__(10);
var Artist = __webpack_require__(17);
var db = __webpack_require__(16);
/**
* Searches through the Artist collection
* @param {object} criteria An object with a name, age, and yearsActive
* @param {string} sortProperty The property to sort the results by
* @param {integer} offset How many records to skip in the result set
* @param {integer} limit How many records to return in the result set
* @return {promise} A promise that resolves with the artists, count, offset, and limit
*/
module.exports = function (_criteria, sortProperty) {
var offset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
var limit = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 20;
var criteria = _.extend({
age: { min: 0, max: 100 },
yearsActive: { min: 0, max: 100 },
name: ''
}, _criteria);
var artists = _.chain(db).filter(function (a) {
return _.includes(_.lowerCase(a.name), _.lowerCase(criteria.name));
}).filter(function (a) {
return a.age > criteria.age.min && a.age < criteria.age.max;
}).filter(function (a) {
return a.yearsActive > criteria.yearsActive.min && a.yearsActive < criteria.yearsActive.max;
}).sortBy(function (a) {
return a[sortProperty];
}).value();
return new Promise(function (resolve, reject) {
resolve(artists);
});
};
/***/ },
/***/ 220:
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _ = __webpack_require__(10);
var Artist = __webpack_require__(17);
var db = __webpack_require__(16);
/**
* Sets a group of Artists as not retired
* @param {array} _ids - An array of the _id's of of artists to update
* @return {promise} A promise that resolves after the update
*/
module.exports = function (_ids) {
return new Promise(function (resolve, reject) {
var artists = _.chain(_ids).map(function (_id) {
return _.find(db, function (a) {
return a._id === _id;
});
}).tap(function (ids) {
return console.log(ids);
}).compact().each(function (a) {
return a.retired = false;
}).value();
resolve();
});
};
/***/ },
/***/ 221:
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _ = __webpack_require__(10);
var Artist = __webpack_require__(17);
var db = __webpack_require__(16);
/**
* Sets a group of Artists as retired
* @param {array} _ids - An array of the _id's of of artists to update
* @return {promise} A promise that resolves after the update
*/
module.exports = function (_ids) {
return new Promise(function (resolve, reject) {
var artists = _.chain(_ids).map(function (_id) {
return _.find(db, function (a) {
return a._id === _id;
});
}).compact().each(function (a) {
return a.retired = true;
}).value();
resolve(artists);
});
};
/***/ },
/***/ 222:
/***/ function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _react = __webpack_require__(3);
var _react2 = _interopRequireDefault(_react);
var _reactRouter = __webpack_require__(41);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var db = __webpack_require__(16);
var Header = function (_Component) {
_inherits(Header, _Component);
function Header(props) {
_classCallCheck(this, Header);
var _this = _possibleConstructorReturn(this, (Header.__proto__ || Object.getPrototypeOf(Header)).call(this, props));
_this.state = { id: null };
return _this;
}
_createClass(Header, [{
key: 'componentWillMount',
value: function componentWillMount() {
this.setLink();
}
}, {
key: 'setLink',
value: function setLink() {
var index = _.random(0, db.length);
this.setState({ id: index });
}
}, {
key: 'render',
value: function render() {
return _react2.default.createElement(
'div',
{ className: 'row' },
_react2.default.createElement(
'nav',
null,
_react2.default.createElement(
'div',
{ className: 'nav-wrapper' },
_react2.default.createElement(
'div',
{ className: 'col s12' },
_react2.default.createElement(
'a',
{ href: '#', className: 'brand-logo' },
'UpStar Music'
),
_react2.default.createElement(
'ul',
{ id: 'nav-mobile', className: 'right hide-on-med-and-down' },
_react2.default.createElement(
'li',
null,
_react2.default.createElement(
_reactRouter.Link,
{
to: '/artists/' + this.state.id,
onClick: this.setLink.bind(this)
},
'Random Artist'
)
),
_react2.default.createElement(
'li',
null,
_react2.default.createElement(
_reactRouter.Link,
{ to: '/artists/new' },
'Create Artist'
)
)
)
)
)
)
);
}
}]);
return Header;
}(_react.Component);
;
exports.default = Header;
/***/ },
/***/ 223:
/***/ function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {