@@ -31,7 +31,9 @@ var TutorialInfo = (function (_super) {
31
31
__extends ( TutorialInfo , _super ) ;
32
32
function TutorialInfo ( props ) {
33
33
_super . call ( this , props ) ;
34
- this . state = this . props . packageJson ;
34
+ this . state = {
35
+ pj : this . props . packageJson
36
+ } ;
35
37
}
36
38
TutorialInfo . prototype . handleText = function ( prop , event ) {
37
39
this . handleChange ( prop , event . target . value ) ;
@@ -42,18 +44,18 @@ var TutorialInfo = (function (_super) {
42
44
TutorialInfo . prototype . handleChange = function ( prop , val ) {
43
45
var obj = { } ;
44
46
obj [ prop ] = val ;
45
- this . setState ( Object . assign ( { } , this . state , obj ) ) ;
47
+ this . setState ( { pj : Object . assign ( { } , this . state , obj ) } ) ;
46
48
} ;
47
49
TutorialInfo . prototype . save = function ( ) {
48
- this . props . save ( this . state ) ;
50
+ this . props . save ( this . state . pj ) ;
49
51
} ;
50
52
TutorialInfo . prototype . render = function ( ) {
51
- return ( React . createElement ( Card_1 . Card , { style : styles } , React . createElement ( Card_1 . CardHeader , { title : 'Tutorial Info' } ) , React . createElement ( TextField_1 . default , { floatingLabelText : 'Title' , defaultValue : this . state . name , onChange : this . handleText . bind ( this , 'name' ) } ) , React . createElement ( "br" , null ) , React . createElement ( TextField_1 . default , { floatingLabelText : 'Description' , defaultValue : this . state . description , onChange : this . handleText . bind ( this , 'description' ) } ) , React . createElement ( "br" , null ) , React . createElement ( TextField_1 . default , { floatingLabelText : 'Version' , defaultValue : this . state . version . join ( '.' ) , disabled : true , onChange : this . handleText . bind ( this , 'version' ) } ) , React . createElement ( "br" , null ) , React . createElement ( TextField_1 . default , { floatingLabelText : 'Keywords' , defaultValue : this . state . keywords . join ( ', ' ) , multiLine : true , onChange : this . handleText . bind ( this , 'keywords' ) } ) , React . createElement ( "br" , null ) , React . createElement ( RaisedButton_1 . default , { style : buttonStyles , label : 'Save' , primary : true , onTouchTap : this . save . bind ( this ) } ) , React . createElement ( RaisedButton_1 . default , { style : buttonStyles , label : 'Continue' , secondary : true , onTouchTap : this . props . routeToTutorial . bind ( this ) } ) ) ) ;
53
+ return ( React . createElement ( Card_1 . Card , { style : styles } , React . createElement ( Card_1 . CardHeader , { title : 'Tutorial Info' } ) , React . createElement ( TextField_1 . default , { floatingLabelText : 'Title' , defaultValue : this . state . pj . name , onChange : this . handleText . bind ( this , 'name' ) } ) , React . createElement ( "br" , null ) , React . createElement ( TextField_1 . default , { floatingLabelText : 'Description' , defaultValue : this . state . pj . description , onChange : this . handleText . bind ( this , 'description' ) } ) , React . createElement ( "br" , null ) , React . createElement ( TextField_1 . default , { floatingLabelText : 'Version' , defaultValue : this . state . pj . version , disabled : true , onChange : this . handleText . bind ( this , 'version' ) } ) , React . createElement ( "br" , null ) , React . createElement ( TextField_1 . default , { floatingLabelText : 'Keywords' , defaultValue : this . state . pj . keywords . join ( ', ' ) , multiLine : true , onChange : this . handleText . bind ( this , 'keywords' ) } ) , React . createElement ( "br" , null ) , React . createElement ( RaisedButton_1 . default , { style : buttonStyles , label : 'Save' , primary : true , onTouchTap : this . save . bind ( this ) } ) , React . createElement ( RaisedButton_1 . default , { style : buttonStyles , label : 'Continue' , secondary : true , onTouchTap : this . props . routeToTutorial . bind ( this ) } ) ) ) ;
52
54
} ;
53
55
TutorialInfo = __decorate ( [
54
56
react_redux_1 . connect ( null , function ( dispatch ) {
55
57
return {
56
- save : function ( config ) { return dispatch ( tutorialConfigSave ( config ) ) ; } ,
58
+ save : function ( pj ) { return dispatch ( actions_1 . pjSave ( pj ) ) ; } ,
57
59
routeToTutorial : function ( ) { return dispatch ( actions_1 . routeSet ( 'page' ) ) ; }
58
60
} ;
59
61
} ) ,
0 commit comments