1- // @flow
2-
3- // #region imports
41import React , { Component } from 'react' ;
2+ // @ts -ignore
53import wrapDisplayName from 'recompose/wrapDisplayName' ;
6- import { compose } from 'redux' ;
4+ import { compose } from 'redux' ;
75import { withRouter } from 'react-router' ;
8- import { type Match , type Location , type RouterHistory } from 'react-router' ;
6+ import { RouteChildrenProps } from 'react-router' ;
97import Container from 'reactstrap/lib/Container' ;
108import NavigationBar from '../../components/navigation' ;
119import BackToTop from '../../components/backToTop/BackToTop' ;
1210import navigationModel from '../../config/navigation' ;
13- import { type Navigation } from '../../config/navigation' ;
11+ import { Navigation } from '../../config/navigation' ;
1412import registerServiceWorker from '../../services/sw/registerServiceWorker' ;
15- // #endregion
1613
17- // #region flow types
18- type Props = {
19- // from withRouter HOC:
20- match : Match ,
21- location : Location ,
22- history : RouterHistory ,
23-
24- ...any ,
25- } ;
14+ // #region types
15+ type Props = { } & RouteChildrenProps ;
2616
2717type State = {
28- navModel : Navigation ,
29-
30- ...any ,
18+ navModel : Navigation ;
3119} ;
3220// #endregion
3321
3422// #region withMainLayout HOC
3523function withMainLayout ( /* no args option yet, but could pass them here */ ) {
36- return BaseComponent => {
24+ return ( BaseComponent : any ) => {
3725 // #region returned Component
3826 class WithMainLayout extends Component < Props , State > {
3927 state = { navModel : navigationModel } ;
@@ -68,20 +56,22 @@ function withMainLayout(/* no args option yet, but could pass them here */) {
6856 // #endregion
6957
7058 /* eslint-disable no-unused-vars*/
71- handleLeftNavItemClick = ( event : SyntheticEvent < > , viewName : string ) => {
59+ handleLeftNavItemClick = ( event : any , viewName : string ) => {
7260 // something to do here?
7361 } ;
7462
75- handleRightNavItemClick = ( event : SyntheticEvent < > , viewName : string ) = > {
63+ handleRightNavItemClick = ( event : any , viewName : string ) => {
7664 // something to do here?
7765 } ;
7866 /* eslint-enable no-unused-vars*/
7967 }
8068
8169 // #region add static displayName for dev
8270 /* eslint-disable no-process-env */
71+ // @ts -ignore
8372 if ( process . env . NODE_ENV !== 'production' ) {
8473 // HOC would obfuscate component name, this trick is helpful for dev (we don't care in production)
74+ // @ts -ignore
8575 WithMainLayout . displayName = wrapDisplayName (
8676 BaseComponent ,
8777 'withMainLayout' ,
@@ -90,6 +80,7 @@ function withMainLayout(/* no args option yet, but could pass them here */) {
9080 /* eslint-enable no-process-env */
9181 // #endregion
9282
83+ // @ts -ignore
9384 return compose ( withRouter ) ( WithMainLayout ) ;
9485 } ;
9586}
0 commit comments