@@ -10,6 +10,7 @@ var actions_1 = require('../../actions');
10
10
var ProgressPage_1 = require ( './ProgressPage' ) ;
11
11
var List_1 = require ( 'material-ui/List' ) ;
12
12
var Paper_1 = require ( 'material-ui/Paper' ) ;
13
+ var RaisedButton_1 = require ( 'material-ui/RaisedButton' ) ;
13
14
var Subheader_1 = require ( 'material-ui/Subheader' ) ;
14
15
var styles = {
15
16
page :{
@@ -18,19 +19,35 @@ var styles = {
18
19
list :{
19
20
margin :'5px' ,
20
21
} ,
22
+ options :{
23
+ display :'flex' ,
24
+ justifyContent :'center' ,
25
+ marginTop :'10px' ,
26
+ opacity :'0.6' ,
27
+ } ,
21
28
} ;
22
29
var Progress = ( function ( _super ) {
23
30
__extends ( Progress , _super ) ;
24
31
function Progress ( ) {
25
32
_super . apply ( this , arguments ) ;
26
33
}
34
+ Progress . prototype . verifyReset = function ( ) {
35
+ var reset = confirm ( 'Are you sure you want to erase your progress?' ) ;
36
+ if ( reset ) {
37
+ this . props . progressReset ( ) ;
38
+ }
39
+ } ;
27
40
Progress . prototype . render = function ( ) {
28
41
var _a = this . props , info = _a . info , tutorial = _a . tutorial ;
29
- return ( React . createElement ( Paper_1 . default , { style :styles . page } ,
30
- React . createElement ( List_1 . List , { style :styles . list } ,
31
- React . createElement ( Subheader_1 . default , null , info . title ) ,
32
- tutorial . pages . map ( function ( page , index ) { return ( React . createElement ( ProgressPage_1 . default , { key :index , index :index , page :page } ) ) ; } ) )
33
- ) ) ;
42
+ return ( React . createElement ( "div" , null ,
43
+ React . createElement ( Paper_1 . default , { style :styles . page } ,
44
+ React . createElement ( List_1 . List , { style :styles . list } ,
45
+ React . createElement ( Subheader_1 . default , null , info . title ) ,
46
+ tutorial . pages . map ( function ( page , index ) { return ( React . createElement ( ProgressPage_1 . default , { key :index , index :index , page :page } ) ) ; } ) )
47
+ ) ,
48
+ React . createElement ( "div" , { style :styles . options } ,
49
+ React . createElement ( RaisedButton_1 . default , { label :"Reset" , onClick :this . verifyReset . bind ( this ) } )
50
+ ) ) ) ;
34
51
} ;
35
52
Progress . prototype . componentWillMount = function ( ) {
36
53
this . props . progressLoad ( ) ;
@@ -42,7 +59,8 @@ var mapStateToProps = function (state) { return ({
42
59
tutorial :state . tutorial ,
43
60
} ) ; } ;
44
61
var mapDispatchToProps = {
45
- progressLoad :actions_1 . progressLoad
62
+ progressLoad :actions_1 . progressLoad ,
63
+ progressReset :actions_1 . progressReset
46
64
} ;
47
65
Object . defineProperty ( exports , "__esModule" , { value :true } ) ;
48
66
exports . default = react_redux_1 . connect ( mapStateToProps , mapDispatchToProps ) ( Progress ) ;