Skip to content

Commit f9e3540

Browse files
committed
migration
1 parent d83ea70 commit f9e3540

File tree

4 files changed

+15
-33
lines changed

4 files changed

+15
-33
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
// @flow
2-
3-
// #region imports
41
import { compose } from 'redux';
52
import withMainLayout from './withMainLayout';
6-
// #endregion
3+
74

85
export default compose()(withMainLayout);

front/src/hoc/withMainLayout/withMainLayout.js renamed to front/src/hoc/withMainLayout/withMainLayout.tsx

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,27 @@
1-
// @flow
2-
3-
// #region imports
41
import React, { Component } from 'react';
2+
// @ts-ignore
53
import wrapDisplayName from 'recompose/wrapDisplayName';
6-
import {compose} from 'redux';
4+
import { compose } from 'redux';
75
import { withRouter } from 'react-router';
8-
import { type Match, type Location, type RouterHistory } from 'react-router';
6+
import { RouteChildrenProps } from 'react-router';
97
import Container from 'reactstrap/lib/Container';
108
import NavigationBar from '../../components/navigation';
119
import BackToTop from '../../components/backToTop/BackToTop';
1210
import navigationModel from '../../config/navigation';
13-
import { type Navigation } from '../../config/navigation';
11+
import { Navigation } from '../../config/navigation';
1412
import 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

2717
type State = {
28-
navModel: Navigation,
29-
30-
...any,
18+
navModel: Navigation;
3119
};
3220
// #endregion
3321

3422
// #region withMainLayout HOC
3523
function 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
}

front/src/services/getLocationOrigin/getLocationOrigin.js renamed to front/src/services/getLocationOrigin/getLocationOrigin.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
// @flow
2-
31
export const getLocationOrigin = (): string => {
42
if (!window.location.origin) {
3+
// @ts-ignore
54
window.location.origin = `${window.location.protocol}//${
65
window.location.hostname
76
}${window.location.port ? ':' + window.location.port : ''}`;

front/src/services/sw/registerServiceWorker.js renamed to front/src/services/sw/registerServiceWorker.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
// @flow
2-
3-
// #region imports
41
import appConfig from '../../config/appConfig';
5-
// #endregion
62

73
// #region constants
84
const { path: swPath } = appConfig.sw;
@@ -12,7 +8,6 @@ function registerServiceWorker(): void {
128
if (typeof window !== undefined) {
139
if ('serviceWorker' in navigator) {
1410
window.addEventListener('load', () => {
15-
// $FlowIgnore
1611
navigator.serviceWorker
1712
.register(swPath)
1813
.then(registration => {

0 commit comments

Comments
 (0)