@@ -5,65 +5,66 @@ var _alert = {
5
5
open :false ,
6
6
action :'' ,
7
7
} ;
8
+ var open = {
9
+ open :true ,
10
+ pass :true ,
11
+ } ;
8
12
var current = _alert ;
9
13
function alertReducer ( alert , action ) {
10
14
if ( alert === void 0 ) { alert = _alert ; }
11
15
var statusBarAlert = document . getElementsByClassName ( 'cr-alert-replay' ) [ 0 ] ;
12
16
switch ( action . type ) {
13
17
case _types_1 . ALERT_REPLAY :
14
- return Object . assign ( { } , current , { open : true } ) ;
18
+ return Object . assign ( { } , current , open ) ;
15
19
case _types_1 . ALERT_TOGGLE :
16
20
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 ;
17
28
case _types_1 . TEST_RESULT :
18
29
var result = action . payload . result ;
19
30
if ( result . pass && result . change > 0 ) {
20
31
statusBarAlert . style . color = '#73C990' ;
21
- current = {
32
+ current = Object . assign ( { } , {
22
33
message :result . msg ,
23
- open :true ,
24
- action :'pass' ,
25
34
duration :result . duration || 1500 ,
26
- } ;
35
+ } , open ) ;
27
36
return current ;
28
37
}
29
38
else if ( result . pass === false && result . change < 1 ) {
30
39
statusBarAlert . style . color = '#FF4081' ;
31
- current = {
40
+ current = Object . assign ( { } , {
32
41
message :result . msg ,
33
- open :true ,
34
42
action :'fail' ,
35
43
duration :result . duration || 2500 ,
36
- } ;
44
+ } , open ) ;
37
45
return current ;
38
46
}
39
47
statusBarAlert . style . color = '#9DA5B4' ;
40
- current = {
48
+ current = Object . assign ( { } , {
41
49
message :result . msg ,
42
- open :true ,
43
50
action :'note' ,
44
51
duration :result . duration || 2500 ,
45
- } ;
52
+ } , open ) ;
46
53
return current ;
47
54
case _types_1 . COMPLETE_PAGE :
48
- current = {
55
+ current = Object . assign ( { } , {
49
56
message :"Page " + ( action . payload . position . page + 1 ) + " Complete" ,
50
- open :true ,
51
- action :'pass' ,
52
- } ;
57
+ } , open ) ;
53
58
return current ;
54
59
case _types_1 . COMPLETE_CHAPTER :
55
- current = {
60
+ current = Object . assign ( { } , {
56
61
message :"Chapter " + ( action . payload . chapter + 1 ) + " Complete" ,
57
- open :true ,
58
- action :'pass' ,
59
- } ;
62
+ } , open ) ;
60
63
return current ;
61
64
case _types_1 . COMPLETE_TUTORIAL :
62
- current = {
65
+ current = Object . assign ( { } , {
63
66
message :'Tutorial Complete' ,
64
- open :true ,
65
- action :'pass' ,
66
- } ;
67
+ } , open ) ;
67
68
return current ;
68
69
default :
69
70
return alert ;