@@ -27,20 +27,12 @@ const checkAuth = (store) => {
27
27
store . dispatch ( getUser ( ) ) ;
28
28
} ;
29
29
30
- // const MobileFirstRoute = props => (
31
- // <Route path={props.path} {...props}>
32
- // <MediaQuery minDeviceWidth={1224}>
33
- // {matches => (matches
34
- // ? props.component(props)
35
- // : props.fallback(props)) }
36
- // </MediaQuery>
37
- // </Route>);
38
-
39
- // MobileFirstRoute.propTypes = {
40
- // path: PropTypes.string.isRequired,
41
- // component: PropTypes.any.isRequired, // eslint-disable-line
42
- // fallback: PropTypes.any.isRequired // eslint-disable-line
43
- // };
30
+ const mobileFirst = ( MobileComponent , Fallback ) => props => (
31
+ < MediaQuery minDeviceWidth = { 800 } >
32
+ { matches => ( matches
33
+ ? < Fallback { ...props } />
34
+ : < MobileComponent { ...props } /> ) }
35
+ </ MediaQuery > ) ;
44
36
45
37
// TODO: This short-circuit seems unnecessary - using the mobile <Switch /> navigator (future) should prevent this from being called
46
38
const onRouteChange = ( store ) => {
@@ -52,15 +44,7 @@ const onRouteChange = (store) => {
52
44
53
45
const routes = store => (
54
46
< Route path = "/" component = { App } onChange = { ( ) => { onRouteChange ( store ) ; } } >
55
- < IndexRoute
56
- onEnter = { checkAuth ( store ) }
57
- component = { props => (
58
- < MediaQuery minDeviceWidth = { 1224 } >
59
- { matches => ( matches
60
- ? < IDEView { ...props } />
61
- : < MobileIDEView { ...props } /> ) }
62
- </ MediaQuery > ) }
63
- />
47
+ < IndexRoute onEnter = { checkAuth ( store ) } component = { mobileFirst ( MobileIDEView , IDEView ) } />
64
48
65
49
< Route path = "/login" component = { userIsNotAuthenticated ( LoginView ) } />
66
50
< Route path = "/signup" component = { userIsNotAuthenticated ( SignupView ) } />
0 commit comments