Skip to content

Commit 21fce87

Browse files
committed
🚧 update routes.jsx to include mobile routes
1 parent 26336a2 commit 21fce87

File tree

1 file changed

+14
-18
lines changed

1 file changed

+14
-18
lines changed

client/routes.jsx

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const mobileFirst = (MobileComponent, Fallback) => props => (
3737
// TODO: This short-circuit seems unnecessary - using the mobile <Switch /> navigator (future) should prevent this from being called
3838
const onRouteChange = (store) => {
3939
const path = window.location.pathname;
40-
if (path.includes('/mobile/preview')) return;
40+
if (path.includes('preview')) return;
4141

4242
store.dispatch(stopSketch());
4343
};
@@ -57,28 +57,24 @@ const routes = store => (
5757
<Route path="/projects/:project_id" component={IDEView} />
5858
<Route path="/:username/full/:project_id" component={FullView} />
5959
<Route path="/full/:project_id" component={FullView} />
60+
61+
<Route path="/:username/assets" component={userIsAuthenticated(userIsAuthorized(mobileFirst(MobileDashboardView, DashboardView)))} />
62+
<Route path="/:username/sketches" component={mobileFirst(MobileDashboardView, DashboardView)} />
63+
<Route path="/:username/sketches/:project_id" component={mobileFirst(MobileIDEView, IDEView)} />
64+
<Route path="/:username/sketches/:project_id/add-to-collection" component={mobileFirst(MobileIDEView, IDEView)} />
65+
<Route path="/:username/collections" component={mobileFirst(MobileDashboardView, DashboardView)} />
66+
67+
<Route path="/:username/collections/create" component={DashboardView} />
68+
<Route path="/:username/collections/:collection_id" component={CollectionView} />
69+
6070
<Route path="/sketches" component={createRedirectWithUsername('/:username/sketches')} />
61-
<Route path="/:username/assets" component={userIsAuthenticated(userIsAuthorized(DashboardView))} />
6271
<Route path="/assets" component={createRedirectWithUsername('/:username/assets')} />
6372
<Route path="/account" component={userIsAuthenticated(AccountView)} />
64-
<Route path="/:username/sketches/:project_id" component={IDEView} />
65-
<Route path="/:username/sketches/:project_id/add-to-collection" component={IDEView} />
66-
<Route path="/:username/sketches" component={DashboardView} />
67-
<Route path="/:username/collections" component={DashboardView} />
68-
<Route path="/:username/collections/create" component={DashboardView} />
69-
<Route path="/:username/collections/:collection_id" component={CollectionView} />
7073
<Route path="/about" component={IDEView} />
7174

72-
<Route path="/mobile" component={MobileIDEView} />
73-
74-
<Route path="/mobile/preview" component={MobileSketchView} />
75-
<Route path="/mobile/preferences" component={MobilePreferences} />
76-
77-
<Route path="/mobile/:username/sketches/:project_id" component={MobileIDEView} />
78-
<Route path="/mobile/:username/assets" component={userIsAuthenticated(userIsAuthorized(MobileDashboardView))} />
79-
<Route path="/mobile/:username/sketches" component={MobileDashboardView} />
80-
<Route path="/mobile/:username/collections" component={MobileDashboardView} />
81-
<Route path="/mobile/:username/collections/create" component={MobileDashboardView} />
75+
{/* Mobile-only Routes */}
76+
<Route path="/preview" component={MobileSketchView} />
77+
<Route path="/preferences" component={MobilePreferences} />
8278

8379
</Route>
8480
);

0 commit comments

Comments
 (0)