@@ -21,41 +21,41 @@ var RaisedButton_1 = require('material-ui/RaisedButton');
2121var actions_1 = require ( '../../actions' ) ;
2222var Top_1 = require ( '../TopPanel/Top' ) ;
2323var styles = {
24- margin : '10px' ,
25- padding : '30px 20px' ,
26- textAlign : 'center' ,
27- } ;
28- var buttonStyles = {
29- margin : '30px 10px 20px 10px' ,
24+ card : {
25+ margin : '10px' ,
26+ padding : '30px 20px' ,
27+ textAlign : 'center' ,
28+ } ,
29+ button : {
30+ margin : '30px 10px 20px 10px' ,
31+ } ,
3032} ;
3133var TutorialInfo = ( function ( _super ) {
3234 __extends ( TutorialInfo , _super ) ;
3335 function TutorialInfo ( props ) {
3436 _super . call ( this , props ) ;
37+ var _a = this . props . packageJson , description = _a . description , version = _a . version , keywords = _a . keywords ;
3538 this . state = {
36- pj : this . props . packageJson
39+ description : description || '' ,
40+ version : version || '0.1.0' ,
41+ keywords : keywords || [ ] ,
3742 } ;
3843 }
3944 TutorialInfo . prototype . componentDidMount = function ( ) {
4045 Top_1 . default . toggle ( false ) ;
4146 } ;
42- TutorialInfo . prototype . handleText = function ( prop , event ) {
43- this . handleChange ( prop , event . target . value ) ;
44- } ;
45- TutorialInfo . prototype . handleSelect = function ( prop , event , index , value ) {
46- this . handleChange ( prop , value ) ;
47- } ;
48- TutorialInfo . prototype . handleChange = function ( prop , val ) {
49- var obj = { } ;
50- obj [ prop ] = val ;
51- this . setState ( { pj : Object . assign ( { } , this . state , obj ) } ) ;
47+ TutorialInfo . prototype . handleText = function ( prop , event , value ) {
48+ var next = { } ;
49+ next [ prop ] = value ;
50+ this . setState ( Object . assign ( { } , this . state , next ) ) ;
5251 } ;
53- TutorialInfo . prototype . save = function ( ) {
54- this . props . save ( this . state . pj ) ;
52+ TutorialInfo . prototype . submit = function ( ) {
53+ var _a = this . state , description = _a . description , version = _a . version , keywords = _a . keywords ;
54+ this . props . save ( Object . assign ( { } , this . props . packageJson , { description : description , version : version , keywords : keywords } ) ) ;
5555 } ;
5656 TutorialInfo . prototype . render = function ( ) {
57- var pj = this . state . pj ;
58- return ( React . createElement ( Card_1 . Card , { style : styles } , React . createElement ( Card_1 . CardHeader , { title : 'Tutorial Info' } ) , React . createElement ( TextField_1 . default , { floatingLabelText : 'Title' , defaultValue : pj . name , onChange : this . handleText . bind ( this , 'name' ) } ) , React . createElement ( "br" , null ) , React . createElement ( TextField_1 . default , { floatingLabelText : 'Description' , defaultValue : pj . description , onChange : this . handleText . bind ( this , 'description' ) } ) , React . createElement ( "br" , null ) , React . createElement ( TextField_1 . default , { floatingLabelText : 'Version' , defaultValue : pj . version , disabled : true , onChange : this . handleText . bind ( this , 'version' ) } ) , React . createElement ( "br" , null ) , React . createElement ( TextField_1 . default , { floatingLabelText : 'Keywords' , defaultValue : 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 ) } ) ) ) ;
57+ var _a = this . state , description = _a . description , version = _a . version , keywords = _a . keywords ;
58+ return ( React . createElement ( Card_1 . Card , { style : styles . card } , React . createElement ( Card_1 . CardHeader , { title : 'Tutorial Info' } ) , React . createElement ( TextField_1 . default , { className : 'native-key-bindings' , floatingLabelText : 'Description' , defaultValue : description , onChange : this . handleText . bind ( this , 'description' ) } ) , React . createElement ( "br" , null ) , React . createElement ( TextField_1 . default , { className : 'native-key-bindings' , floatingLabelText : 'Version' , defaultValue : version , disabled : true , onChange : this . handleText . bind ( this , 'version' ) } ) , React . createElement ( "br" , null ) , React . createElement ( "br" , null ) , React . createElement ( RaisedButton_1 . default , { type : 'submit' , style : styles . button , label : 'Save' , primary : true , onTouchTap : this . submit . bind ( this ) } ) , React . createElement ( RaisedButton_1 . default , { style : styles . button , label : 'Continue' , secondary : true , onTouchTap : this . props . routeToTutorial . bind ( this ) } ) ) ) ;
5959 } ;
6060 TutorialInfo = __decorate ( [
6161 react_redux_1 . connect ( function ( state ) { return ( {
0 commit comments