11import { Route , IndexRoute } from 'react-router' ;
22import React from 'react' ;
3- import PropTypes from 'prop-types' ;
4- import MediaQuery from 'react-responsive' ;
53
64import App from './modules/App/App' ;
75import IDEView from './modules/IDE/pages/IDEView' ;
@@ -22,31 +20,12 @@ import MobileDashboardView from './modules/Mobile/MobileDashboardView';
2220import { getUser } from './modules/User/actions' ;
2321import { stopSketch } from './modules/IDE/actions/ide' ;
2422import { userIsAuthenticated , userIsNotAuthenticated , userIsAuthorized } from './utils/auth' ;
25- import ResponsiveForm from './modules/User/components/ResponsiveForm ' ;
23+ import { createMobileFirst , responsiveForm } from './utils/responsive ' ;
2624
2725const checkAuth = ( store ) => {
2826 store . dispatch ( getUser ( ) ) ;
2927} ;
3028
31- const mobileEnabled = ( ) => ( window . process . env . MOBILE_ENABLED === true ) ;
32-
33- /** createMobileFirst: Receives the store, and creates a function that chooses between two components,
34- * aimed at mobile and desktop resolutions, respectively.
35- * The created function returns a Component (props => jsx)
36- */
37- const createMobileFirst = store => ( MobileComponent , Fallback ) => props => (
38- < MediaQuery minDeviceWidth = { 770 } >
39- { matches => ( ( matches || ( store && store . getState ( ) . editorAccessibility . forceDesktop ) || ( ! mobileEnabled ( ) ) )
40- ? < Fallback { ...props } />
41- : < MobileComponent { ...props } /> ) }
42- </ MediaQuery > ) ;
43-
44- const responsiveForm = DesktopComponent => props => (
45- < ResponsiveForm >
46- < DesktopComponent { ...props } />
47- </ ResponsiveForm >
48- ) ;
49-
5029// TODO: This short-circuit seems unnecessary - using the mobile <Switch /> navigator (future) should prevent this from being called
5130const onRouteChange = ( store ) => {
5231 const path = window . location . pathname ;
0 commit comments