From ddc95fa48882cca6c2a86e091d84d7f4ab4f6132 Mon Sep 17 00:00:00 2001 From: ghalestrilo Date: Wed, 19 Aug 2020 17:48:09 -0300 Subject: [PATCH] :construction: switch index page manually --- client/routes.jsx | 31 +++++++++++++++++++++++++++++-- package-lock.json | 32 ++++++++++++++++++++++++++++++-- package.json | 1 + 3 files changed, 60 insertions(+), 4 deletions(-) diff --git a/client/routes.jsx b/client/routes.jsx index a9d5632c..b2cffc89 100644 --- a/client/routes.jsx +++ b/client/routes.jsx @@ -1,5 +1,8 @@ import { Route, IndexRoute } from 'react-router'; import React from 'react'; +import PropTypes from 'prop-types'; +import MediaQuery from 'react-responsive'; + import App from './modules/App/App'; import IDEView from './modules/IDE/pages/IDEView'; import MobileIDEView from './modules/IDE/pages/MobileIDEView'; @@ -24,6 +27,21 @@ const checkAuth = (store) => { store.dispatch(getUser()); }; +// const MobileFirstRoute = props => ( +// +// +// {matches => (matches +// ? props.component(props) +// : props.fallback(props))} +// +// ); + +// MobileFirstRoute.propTypes = { +// path: PropTypes.string.isRequired, +// component: PropTypes.any.isRequired, // eslint-disable-line +// fallback: PropTypes.any.isRequired // eslint-disable-line +// }; + // TODO: This short-circuit seems unnecessary - using the mobile navigator (future) should prevent this from being called const onRouteChange = (store) => { const path = window.location.pathname; @@ -34,7 +52,16 @@ const onRouteChange = (store) => { const routes = store => ( { onRouteChange(store); }}> - + ( + + {matches => (matches + ? + : )} + )} + /> + @@ -58,10 +85,10 @@ const routes = store => ( + - diff --git a/package-lock.json b/package-lock.json index 8abec584..cf191511 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13124,6 +13124,11 @@ } } }, + "css-mediaquery": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/css-mediaquery/-/css-mediaquery-0.1.2.tgz", + "integrity": "sha1-aiw3NEkoYYYxxUvTPO3TAdoYvqA=" + }, "css-select": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz", @@ -19020,6 +19025,11 @@ } } }, + "hyphenate-style-name": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/hyphenate-style-name/-/hyphenate-style-name-1.0.4.tgz", + "integrity": "sha512-ygGZLjmXfPHj+ZWh6LwbC37l43MhfztxetbFCoYTM2VjkIUpeHgSNn7QIyVFj7YQ1Wl9Cbw5sholVJPzWvC2MQ==" + }, "i18next": { "version": "19.5.4", "resolved": "https://registry.npmjs.org/i18next/-/i18next-19.5.4.tgz", @@ -25866,6 +25876,14 @@ "unquote": "^1.1.0" } }, + "matchmediaquery": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/matchmediaquery/-/matchmediaquery-0.3.1.tgz", + "integrity": "sha512-Hlk20WQHRIm9EE9luN1kjRjYXAQToHOIAHPJn9buxBwuhfTHoKUcX+lXBbxc85DVQfXYbEQ4HcwQdd128E3qHQ==", + "requires": { + "css-mediaquery": "^0.1.2" + } + }, "material-colors": { "version": "1.2.6", "resolved": "https://registry.npmjs.org/material-colors/-/material-colors-1.2.6.tgz", @@ -32233,6 +32251,17 @@ } } }, + "react-responsive": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/react-responsive/-/react-responsive-8.1.0.tgz", + "integrity": "sha512-U8Nv2/ZWACIw/fAE9XNPbc2Xo33X5q1bcCASc2SufvJ9ifB+o/rokfogfznSVcvS22hN1rafGi0uZD6GiVFEHw==", + "requires": { + "hyphenate-style-name": "^1.0.0", + "matchmediaquery": "^0.3.0", + "prop-types": "^15.6.1", + "shallow-equal": "^1.1.0" + } + }, "react-router": { "version": "3.2.5", "resolved": "https://registry.npmjs.org/react-router/-/react-router-3.2.5.tgz", @@ -34519,8 +34548,7 @@ "shallow-equal": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/shallow-equal/-/shallow-equal-1.2.1.tgz", - "integrity": "sha512-S4vJDjHHMBaiZuT9NPb616CSmLf618jawtv3sufLl6ivK8WocjAo58cXwbRV1cgqxH0Qbv+iUt6m05eqEa2IRA==", - "dev": true + "integrity": "sha512-S4vJDjHHMBaiZuT9NPb616CSmLf618jawtv3sufLl6ivK8WocjAo58cXwbRV1cgqxH0Qbv+iUt6m05eqEa2IRA==" }, "shallowequal": { "version": "1.1.0", diff --git a/package.json b/package.json index 01f558f9..3d1d85af 100644 --- a/package.json +++ b/package.json @@ -201,6 +201,7 @@ "react-hot-loader": "^4.12.19", "react-i18next": "^11.5.0", "react-redux": "^7.2.0", + "react-responsive": "^8.1.0", "react-router": "^3.2.5", "react-split-pane": "^0.1.89", "react-tabs": "^2.3.1",