-
Notifications
You must be signed in to change notification settings - Fork 562
/
Copy pathApp.js
127 lines (116 loc) · 5.44 KB
/
App.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
import { STATE_LOGIN, STATE_SIGNUP } from 'components/AuthForm';
import GAListener from 'components/GAListener';
import { EmptyLayout, LayoutRoute, MainLayout } from 'components/Layout';
import PageSpinner from 'components/PageSpinner';
import AuthPage from 'pages/AuthPage';
import React from 'react';
import componentQueries from 'react-component-queries';
import { BrowserRouter, Redirect, Route, Switch } from 'react-router-dom';
import './styles/reduction.scss';
const AlertPage = React.lazy(() => import('pages/AlertPage'));
const AuthModalPage = React.lazy(() => import('pages/AuthModalPage'));
const BadgePage = React.lazy(() => import('pages/BadgePage'));
const ButtonGroupPage = React.lazy(() => import('pages/ButtonGroupPage'));
const ButtonPage = React.lazy(() => import('pages/ButtonPage'));
const CardPage = React.lazy(() => import('pages/CardPage'));
const ChartPage = React.lazy(() => import('pages/ChartPage'));
const DashboardPage = React.lazy(() => import('pages/DashboardPage'));
const DropdownPage = React.lazy(() => import('pages/DropdownPage'));
const FormPage = React.lazy(() => import('pages/FormPage'));
const InputGroupPage = React.lazy(() => import('pages/InputGroupPage'));
const ModalPage = React.lazy(() => import('pages/ModalPage'));
const ProgressPage = React.lazy(() => import('pages/ProgressPage'));
const TablePage = React.lazy(() => import('pages/TablePage'));
const TypographyPage = React.lazy(() => import('pages/TypographyPage'));
const WidgetPage = React.lazy(() => import('pages/WidgetPage'));
const SuggestPage = React.lazy(() => import('pages/SuggestPage'));
const CourseSearchPage = React.lazy(() => import('pages/CourseSearchPage'));
const RequestPage = React.lazy(() => import('pages/RequestPage'));
const StuSearchPage = React.lazy(() => import('pages/StuSearchPage'));
const InsSearchPage = React.lazy(() => import('pages/InsSearchPage'));
const NewsBoardPage = React.lazy(() => import('pages/NewsBoardPage'));
const FAQsPage = React.lazy(() => import('pages/FAQsPage'));
const AcaCalenderPage = React.lazy(() => import('pages/AcaCalenderPage'));
const GPAPage = React.lazy(() => import('pages/GPAPage'));
const ProfilePage = React.lazy(() => import('pages/ProfilePage'));
const getBasename = () => {
return `/${process.env.PUBLIC_URL.split('/').pop()}`;
};
class App extends React.Component {
render() {
return (
<BrowserRouter basename={getBasename()}>
<GAListener>
<Switch>
<LayoutRoute
exact
path="/login"
layout={EmptyLayout}
component={props => (
<AuthPage {...props} authState={STATE_LOGIN} />
)}
/>
<LayoutRoute
exact
path="/signup"
layout={EmptyLayout}
component={props => (
<AuthPage {...props} authState={STATE_SIGNUP} />
)}
/>
<MainLayout breakpoint={this.props.breakpoint}>
<React.Suspense fallback={<PageSpinner />}>
<Route exact path="/" component={NewsBoardPage} />
<Route exact path="/login-modal" component={AuthModalPage} />
<Route exact path="/buttons" component={ButtonPage} />
<Route exact path="/cards" component={CardPage} />
<Route exact path="/widgets" component={WidgetPage} />
<Route exact path="/typography" component={TypographyPage} />
<Route exact path="/alerts" component={AlertPage} />
<Route exact path="/tables" component={TablePage} />
<Route exact path="/badges" component={BadgePage} />
<Route exact path="/button-groups" component={ButtonGroupPage} />
<Route exact path="/dropdowns" component={DropdownPage} />
<Route exact path="/progress" component={ProgressPage} />
<Route exact path="/modals" component={ModalPage} />
<Route exact path="/forms" component={FormPage} />
<Route exact path="/request" component={RequestPage} />
<Route exact path="/suggest" component={SuggestPage} />
<Route exact path="/input-groups" component={InputGroupPage} />
<Route exact path="/charts" component={ChartPage} />
<Route exact path="/course-class" component={CourseSearchPage}/>
<Route exact path="/stu-search" component={StuSearchPage}/>
<Route exact path="/ins-search" component={InsSearchPage}/>
<Route exact path="/news-board" component={NewsBoardPage}/>
<Route exact path="/faqs" component={FAQsPage}/>
<Route exact path="/aca-calender" component={AcaCalenderPage}/>
<Route exact path="/gpa" component={GPAPage}/>
<Route exact path="/profiles" component={ProfilePage}/>
</React.Suspense>
</MainLayout>
<Redirect to="/" />
</Switch>
</GAListener>
</BrowserRouter>
);
}
}
const query = ({ width }) => {
if (width < 575) {
return { breakpoint: 'xs' };
}
if (576 < width && width < 767) {
return { breakpoint: 'sm' };
}
if (768 < width && width < 991) {
return { breakpoint: 'md' };
}
if (992 < width && width < 1199) {
return { breakpoint: 'lg' };
}
if (width > 1200) {
return { breakpoint: 'xl' };
}
return { breakpoint: 'xs' };
};
export default componentQueries(query)(App);