@@ -20,7 +20,7 @@ import MobileDashboardView from './modules/Mobile/MobileDashboardView';
20
20
import { getUser } from './modules/User/actions' ;
21
21
import { stopSketch } from './modules/IDE/actions/ide' ;
22
22
import { userIsAuthenticated , userIsNotAuthenticated , userIsAuthorized } from './utils/auth' ;
23
- import { createMobileFirst , responsiveForm } from './utils/responsive' ;
23
+ import { mobileFirst , responsiveForm } from './utils/responsive' ;
24
24
25
25
const checkAuth = ( store ) => {
26
26
store . dispatch ( getUser ( ) ) ;
@@ -34,45 +34,41 @@ const onRouteChange = (store) => {
34
34
store . dispatch ( stopSketch ( ) ) ;
35
35
} ;
36
36
37
- const routes = ( store ) => {
38
- const mobileFirst = createMobileFirst ( store ) ;
37
+ const routes = store => (
38
+ < Route path = "/" component = { App } onChange = { ( ) => { onRouteChange ( store ) ; } } >
39
+ < IndexRoute onEnter = { checkAuth ( store ) } component = { mobileFirst ( MobileIDEView , IDEView ) } />
39
40
40
- return (
41
- < Route path = "/" component = { App } onChange = { ( ) => { onRouteChange ( store ) ; } } >
42
- < IndexRoute onEnter = { checkAuth ( store ) } component = { mobileFirst ( MobileIDEView , IDEView ) } />
41
+ < Route path = "/login" component = { userIsNotAuthenticated ( mobileFirst ( responsiveForm ( LoginView ) , LoginView ) ) } />
42
+ < Route path = "/signup" component = { userIsNotAuthenticated ( mobileFirst ( responsiveForm ( SignupView ) , SignupView ) ) } />
43
+ < Route path = "/reset-password" component = { userIsNotAuthenticated ( ResetPasswordView ) } />
44
+ < Route path = "/verify" component = { EmailVerificationView } />
45
+ < Route
46
+ path = "/reset-password/:reset_password_token"
47
+ component = { NewPasswordView }
48
+ />
49
+ < Route path = "/projects/:project_id" component = { IDEView } />
50
+ < Route path = "/:username/full/:project_id" component = { FullView } />
51
+ < Route path = "/full/:project_id" component = { FullView } />
43
52
44
- < Route path = "/login" component = { userIsNotAuthenticated ( mobileFirst ( responsiveForm ( LoginView ) , LoginView ) ) } />
45
- < Route path = "/signup" component = { userIsNotAuthenticated ( mobileFirst ( responsiveForm ( SignupView ) , SignupView ) ) } />
46
- < Route path = "/reset-password" component = { userIsNotAuthenticated ( ResetPasswordView ) } />
47
- < Route path = "/verify" component = { EmailVerificationView } />
48
- < Route
49
- path = "/reset-password/:reset_password_token"
50
- component = { NewPasswordView }
51
- />
52
- < Route path = "/projects/:project_id" component = { IDEView } />
53
- < Route path = "/:username/full/:project_id" component = { FullView } />
54
- < Route path = "/full/:project_id" component = { FullView } />
53
+ < Route path = "/:username/assets" component = { userIsAuthenticated ( userIsAuthorized ( mobileFirst ( MobileDashboardView , DashboardView ) ) ) } />
54
+ < Route path = "/:username/sketches" component = { mobileFirst ( MobileDashboardView , DashboardView ) } />
55
+ < Route path = "/:username/sketches/:project_id" component = { mobileFirst ( MobileIDEView , IDEView ) } />
56
+ < Route path = "/:username/sketches/:project_id/add-to-collection" component = { mobileFirst ( MobileIDEView , IDEView ) } />
57
+ < Route path = "/:username/collections" component = { mobileFirst ( MobileDashboardView , DashboardView ) } />
55
58
56
- < Route path = "/:username/assets" component = { userIsAuthenticated ( userIsAuthorized ( mobileFirst ( MobileDashboardView , DashboardView ) ) ) } />
57
- < Route path = "/:username/sketches" component = { mobileFirst ( MobileDashboardView , DashboardView ) } />
58
- < Route path = "/:username/sketches/:project_id" component = { mobileFirst ( MobileIDEView , IDEView ) } />
59
- < Route path = "/:username/sketches/:project_id/add-to-collection" component = { mobileFirst ( MobileIDEView , IDEView ) } />
60
- < Route path = "/:username/collections" component = { mobileFirst ( MobileDashboardView , DashboardView ) } />
59
+ < Route path = "/:username/collections/create" component = { DashboardView } />
60
+ < Route path = "/:username/collections/:collection_id" component = { CollectionView } />
61
61
62
- < Route path = "/:username/collections/create" component = { DashboardView } />
63
- < Route path = "/:username/collections/:collection_id" component = { CollectionView } />
62
+ < Route path = "/sketches" component = { createRedirectWithUsername ( '/:username/sketches' ) } />
63
+ < Route path = "/assets" component = { createRedirectWithUsername ( '/:username/assets' ) } />
64
+ < Route path = "/account" component = { userIsAuthenticated ( AccountView ) } />
65
+ < Route path = "/about" component = { IDEView } />
64
66
65
- < Route path = "/sketches" component = { createRedirectWithUsername ( '/:username/sketches' ) } />
66
- < Route path = "/assets" component = { createRedirectWithUsername ( '/:username/assets' ) } />
67
- < Route path = "/account" component = { userIsAuthenticated ( AccountView ) } />
68
- < Route path = "/about" component = { IDEView } />
67
+ { /* Mobile-only Routes */ }
68
+ < Route path = "/preview" component = { MobileSketchView } />
69
+ < Route path = "/preferences" component = { MobilePreferences } />
69
70
70
- { /* Mobile-only Routes */ }
71
- < Route path = "/preview" component = { MobileSketchView } />
72
- < Route path = "/preferences" component = { MobilePreferences } />
73
-
74
- </ Route >
75
- ) ;
76
- } ;
71
+ </ Route >
72
+ ) ;
77
73
78
74
export default routes ;
0 commit comments