@@ -30,15 +30,6 @@ var styles = {
3030 margin : '30px 10px 20px 10px' ,
3131 } ,
3232} ;
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- } ] ;
4233var TutorialPublish = ( function ( _super ) {
4334 __extends ( TutorialPublish , _super ) ;
4435 function TutorialPublish ( ) {
@@ -52,23 +43,32 @@ var TutorialPublish = (function (_super) {
5243 TopPanel_1 . topElement . toggle ( false ) ;
5344 } ;
5445 TutorialPublish . prototype . render = function ( ) {
46+ var _a = this . props , validation = _a . validation , validatePj = _a . validatePj ;
5547 return ( React . createElement ( Card_1 . Card , { style : styles . card } ,
5648 React . createElement ( Card_1 . CardHeader , { title : 'Tutorial Info' } ) ,
5749 React . createElement ( Table_1 . Table , { fixedHeader : true , selectable : false } ,
5850 React . createElement ( Table_1 . TableHeader , { displaySelectAll : false , adjustForCheckbox : false } ,
5951 React . createElement ( Table_1 . TableRow , null ,
52+ React . createElement ( Table_1 . TableHeaderColumn , null , "Status" ) ,
6053 React . createElement ( Table_1 . TableHeaderColumn , null , "Field" ) ,
6154 React . createElement ( Table_1 . TableHeaderColumn , null , "Description" ) )
6255 ) ,
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' ) ; } } ) ) ) ;
56+ React . createElement ( Table_1 . TableBody , { displayRowCheckbox : false } ,
57+ validation . errors . map ( function ( field , index ) { return ( React . createElement ( Table_1 . TableRow , { key : index } ,
58+ React . createElement ( Table_1 . TableRowColumn , null , "Error" ) ,
59+ React . createElement ( Table_1 . TableRowColumn , null , field . name ) ,
60+ React . createElement ( Table_1 . TableRowColumn , null , field . example ) ) ) ; } ) ,
61+ validation . warnings . map ( function ( field , index ) { return ( React . createElement ( Table_1 . TableRow , { key : index } ,
62+ React . createElement ( Table_1 . TableRowColumn , null , "Warning" ) ,
63+ React . createElement ( Table_1 . TableRowColumn , null , field . name ) ,
64+ React . createElement ( Table_1 . TableRowColumn , null , field . example ) ) ) ; } ) ) ) ,
65+ React . createElement ( RaisedButton_1 . default , { style : styles . button , label : 'Validate' , primary : true , onTouchTap : validatePj } ) ,
66+ React . createElement ( RaisedButton_1 . default , { style : styles . button , label : 'Publish' , secondary : true , disabled : validation . errors . length === 0 , onTouchTap : function ( ) { return alert ( 'Publish not yet implemented' ) ; } } ) ) ) ;
6767 } ;
6868 TutorialPublish = __decorate ( [
6969 react_redux_1 . connect ( function ( state ) { return ( {
70- packageJson : state . packageJson ,
71- } ) ; } , { pjLoad : actions_1 . pjLoad , pjSave : actions_1 . pjSave , editorPjOpen : actions_1 . editorPjOpen } ) ,
70+ validation : state . validation ,
71+ } ) ; } , { pjLoad : actions_1 . pjLoad , pjSave : actions_1 . pjSave , editorPjOpen : actions_1 . editorPjOpen , validatePj : actions_1 . validatePj } ) ,
7272 __metadata ( 'design:paramtypes' , [ ] )
7373 ] , TutorialPublish ) ;
7474 return TutorialPublish ;
0 commit comments