diff --git a/client/modules/App/App.jsx b/client/modules/App/App.jsx index 346ea411..f9a8de34 100644 --- a/client/modules/App/App.jsx +++ b/client/modules/App/App.jsx @@ -35,7 +35,7 @@ class App extends React.Component { return (
{/* FIXME: remove false */} - {false && this.state.isMounted && !window.devToolsExtension && getConfig('NODE_ENV') === 'development' && } + {this.state.isMounted && !window.devToolsExtension && getConfig('NODE_ENV') === 'development' && } {this.props.children}
); diff --git a/client/modules/IDE/actions/collections.js b/client/modules/IDE/actions/collections.js index 3aa954ac..1d2a8e2b 100644 --- a/client/modules/IDE/actions/collections.js +++ b/client/modules/IDE/actions/collections.js @@ -17,6 +17,7 @@ export function getCollections(username) { } else { url = '/collections'; } + console.log(url); apiClient.get(url) .then((response) => { dispatch({ diff --git a/client/modules/Mobile/MobileDashboardView.jsx b/client/modules/Mobile/MobileDashboardView.jsx index 103f02c0..29a69bfb 100644 --- a/client/modules/Mobile/MobileDashboardView.jsx +++ b/client/modules/Mobile/MobileDashboardView.jsx @@ -1,7 +1,7 @@ import React, { useState } from 'react'; -import PropTypes from 'prop-types'; +import PropTypes, { string } from 'prop-types'; import styled from 'styled-components'; -import { withRouter } from 'react-router'; +import { withRouter, Link } from 'react-router'; import Screen from '../../components/mobile/MobileScreen'; import Header from '../../components/mobile/Header'; @@ -17,7 +17,7 @@ import { SketchSearchbar } from '../IDE/components/Searchbar'; const EXAMPLE_USERNAME = 'p5'; -const FooterTab = styled.div` +const FooterTab = styled(Link)` background: ${props => prop(props.selected ? 'backgroundColor' : 'MobilePanel.default.foreground')}; color: ${props => prop(`MobilePanel.default.${props.selected ? 'foreground' : 'background'}`)}; padding: ${remSize(16)}; @@ -44,24 +44,32 @@ const FooterTabSwitcher = styled.div` `; const Panels = { - Sketches: SketchList, - Collections: CollectionList, - Assets: AssetList + sketches: SketchList, + collections: CollectionList, + assets: AssetList }; const renderPanel = (name, props) => (Component => (Component && ))(Panels[name]); +const getPanel = (pathname) => { + const pathparts = pathname ? pathname.split('/') : []; + const matches = Object.keys(Panels).map(part => part.toLowerCase()).filter(part => pathparts.includes(part)); + return matches && matches.length > 0 && matches[0]; +}; -const MobileDashboard = ({ params }) => { + +const MobileDashboard = ({ params, location }) => { const Tabs = Object.keys(Panels); - const [selected, selectTab] = useState(Tabs[0]); - // const username = 'p5'; const { username } = params; + const { pathname } = location; + const isExamples = username === EXAMPLE_USERNAME; + const panel = getPanel(pathname); + return ( - +
@@ -71,19 +79,18 @@ const MobileDashboard = ({ params }) => { - {renderPanel(selected, { username })} + {renderPanel(panel, { username, key: pathname })} -