@@ -15,13 +15,11 @@ var __metadata = (this && this.__metadata) || function (k, v) {
1515} ;
1616var React = require ( 'react' ) ;
1717var react_redux_1 = require ( 'react-redux' ) ;
18- var redux_form_1 = require ( 'redux-form ' ) ;
18+ var Table_1 = require ( 'material-ui/Table ' ) ;
1919var Card_1 = require ( 'material-ui/Card' ) ;
2020var RaisedButton_1 = require ( 'material-ui/RaisedButton' ) ;
2121var actions_1 = require ( '../../actions' ) ;
2222var TopPanel_1 = require ( '../TopPanel' ) ;
23- var textField_1 = require ( '../Form/textField' ) ;
24- var validate_1 = require ( './validate' ) ;
2523var styles = {
2624 card : {
2725 margin : '10px' ,
@@ -32,6 +30,15 @@ var styles = {
3230 margin : '30px 10px 20px 10px' ,
3331 } ,
3432} ;
33+ var fields = [ {
34+ name : 'author(s)' ,
35+ example : 'Shawn McKay <my@email.com>' ,
36+ status : true ,
37+ } , {
38+ name : 'keywords' ,
39+ example : '["CodeRoad", "JS", "React"]' ,
40+ status : false ,
41+ } ] ;
3542var TutorialPublish = ( function ( _super ) {
3643 __extends ( TutorialPublish , _super ) ;
3744 function TutorialPublish ( ) {
@@ -42,50 +49,21 @@ var TutorialPublish = (function (_super) {
4249 this . props . editorPjOpen ( ) ;
4350 } ;
4451 TutorialPublish . prototype . componentDidMount = function ( ) {
45- var _this = this ;
4652 TopPanel_1 . topElement . toggle ( false ) ;
47- setTimeout ( function ( ) {
48- var _a = _this . props . packageJson , description = _a . description , version = _a . version , keywords = _a . keywords ;
49- _this . props . initialize ( {
50- description : description ,
51- version : version ,
52- keywords : keywords ,
53- } ) ;
54- } ) ;
55- document . getElementsByTagName ( 'input' ) [ 0 ] . focus ( ) ;
56- } ;
57- TutorialPublish . prototype . shouldComponentUpdate = function ( ) {
58- if ( document . activeElement &&
59- typeof document . activeElement . value === 'string' ) {
60- return false ;
61- }
62- } ;
63- TutorialPublish . prototype . onSubmit = function ( values ) {
64- var description = values . description , version = values . version , author = values . author , keywords = values . keywords ;
65- this . props . pjSave ( Object . assign ( { } , this . props . packageJson , {
66- description : description , version : version , author : author ,
67- } ) ) ;
6853 } ;
6954 TutorialPublish . prototype . render = function ( ) {
70- var _a = this . props , pristine = _a . pristine , submitting = _a . submitting , handleSubmit = _a . handleSubmit , invalid = _a . invalid ;
7155 return ( React . createElement ( Card_1 . Card , { style : styles . card } ,
7256 React . createElement ( Card_1 . CardHeader , { title : 'Tutorial Info' } ) ,
73- React . createElement ( "form" , { onSubmit : handleSubmit ( this . onSubmit . bind ( this ) ) } ,
74- React . createElement ( redux_form_1 . Field , { name : 'author' , component : textField_1 . default . bind ( null , {
75- hintText : 'Shawn McKay <my@email.com>' ,
76- floatingLabelText : 'Author <email>' ,
77- } ) , tabIndex : '1' } ) ,
78- React . createElement ( redux_form_1 . Field , { name : 'description' , component : textField_1 . default . bind ( null , {
79- hintText : 'Tutorial description' ,
80- floatingLabelText : 'Description' ,
81- } ) , tabIndex : '1' } ) ,
82- React . createElement ( redux_form_1 . Field , { name : 'version' , component : textField_1 . default . bind ( null , {
83- hintText : '0.1.0' ,
84- floatingLabelText : 'Version' ,
85- disabled : true ,
86- } ) , tabIndex : '2' } ) ,
87- React . createElement ( RaisedButton_1 . default , { type : 'submit' , style : styles . button , label : 'Save' , primary : true , disabled : invalid } ) ,
88- React . createElement ( RaisedButton_1 . default , { style : styles . button , label : 'Publish' , secondary : true , disabled : invalid , onTouchTap : function ( ) { return alert ( 'Publish not yet implemented' ) ; } } ) ) ) ) ;
57+ React . createElement ( Table_1 . Table , { fixedHeader : true , selectable : false } ,
58+ React . createElement ( Table_1 . TableHeader , { displaySelectAll : false , adjustForCheckbox : false } ,
59+ React . createElement ( Table_1 . TableRow , null ,
60+ React . createElement ( Table_1 . TableHeaderColumn , null , "Field" ) ,
61+ React . createElement ( Table_1 . TableHeaderColumn , null , "Description" ) )
62+ ) ,
63+ React . createElement ( Table_1 . TableBody , { displayRowCheckbox : false } , fields . map ( function ( field , index ) { return ( React . createElement ( Table_1 . TableRow , { key : index } ,
64+ React . createElement ( Table_1 . TableRowColumn , null , field . name ) ,
65+ React . createElement ( Table_1 . TableRowColumn , null , field . example ) ) ) ; } ) ) ) ,
66+ React . createElement ( RaisedButton_1 . default , { style : styles . button , label : 'Publish' , secondary : true , disabled : true , onTouchTap : function ( ) { return alert ( 'Publish not yet implemented' ) ; } } ) ) ) ;
8967 } ;
9068 TutorialPublish = __decorate ( [
9169 react_redux_1 . connect ( function ( state ) { return ( {
@@ -96,7 +74,4 @@ var TutorialPublish = (function (_super) {
9674 return TutorialPublish ;
9775} ( React . Component ) ) ;
9876Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
99- exports . default = redux_form_1 . reduxForm ( {
100- form : 'tutorialPublish' ,
101- validate : validate_1 . default ,
102- } ) ( TutorialPublish ) ;
77+ exports . default = TutorialPublish ;
0 commit comments