@@ -5,65 +5,66 @@ var _alert = {
55 open : false ,
66 action : '' ,
77} ;
8+ var open = {
9+ open : true ,
10+ pass : true ,
11+ } ;
812var current = _alert ;
913function alertReducer ( alert , action ) {
1014 if ( alert === void 0 ) { alert = _alert ; }
1115 var statusBarAlert = document . getElementsByClassName ( 'cr-alert-replay' ) [ 0 ] ;
1216 switch ( action . type ) {
1317 case _types_1 . ALERT_REPLAY :
14- return Object . assign ( { } , current , { open : true } ) ;
18+ return Object . assign ( { } , current , open ) ;
1519 case _types_1 . ALERT_TOGGLE :
1620 return action . payload . alert || _alert ;
21+ case _types_1 . TUTORIAL_UPDATE :
22+ current = Object . assign ( { } , {
23+ message : "run `npm install --save-dev " + action . payload . name + "`" ,
24+ action : 'note' ,
25+ duration : 4000 ,
26+ } , open ) ;
27+ return current ;
1728 case _types_1 . TEST_RESULT :
1829 var result = action . payload . result ;
1930 if ( result . pass && result . change > 0 ) {
2031 statusBarAlert . style . color = '#73C990' ;
21- current = {
32+ current = Object . assign ( { } , {
2233 message : result . msg ,
23- open : true ,
24- action : 'pass' ,
2534 duration : result . duration || 1500 ,
26- } ;
35+ } , open ) ;
2736 return current ;
2837 }
2938 else if ( result . pass === false && result . change < 1 ) {
3039 statusBarAlert . style . color = '#FF4081' ;
31- current = {
40+ current = Object . assign ( { } , {
3241 message : result . msg ,
33- open : true ,
3442 action : 'fail' ,
3543 duration : result . duration || 2500 ,
36- } ;
44+ } , open ) ;
3745 return current ;
3846 }
3947 statusBarAlert . style . color = '#9DA5B4' ;
40- current = {
48+ current = Object . assign ( { } , {
4149 message : result . msg ,
42- open : true ,
4350 action : 'note' ,
4451 duration : result . duration || 2500 ,
45- } ;
52+ } , open ) ;
4653 return current ;
4754 case _types_1 . COMPLETE_PAGE :
48- current = {
55+ current = Object . assign ( { } , {
4956 message : "Page " + ( action . payload . position . page + 1 ) + " Complete" ,
50- open : true ,
51- action : 'pass' ,
52- } ;
57+ } , open ) ;
5358 return current ;
5459 case _types_1 . COMPLETE_CHAPTER :
55- current = {
60+ current = Object . assign ( { } , {
5661 message : "Chapter " + ( action . payload . chapter + 1 ) + " Complete" ,
57- open : true ,
58- action : 'pass' ,
59- } ;
62+ } , open ) ;
6063 return current ;
6164 case _types_1 . COMPLETE_TUTORIAL :
62- current = {
65+ current = Object . assign ( { } , {
6366 message : 'Tutorial Complete' ,
64- open : true ,
65- action : 'pass' ,
66- } ;
67+ } , open ) ;
6768 return current ;
6869 default :
6970 return alert ;
0 commit comments