Skip to content
This repository was archived by the owner on Mar 7, 2024. It is now read-only.

Commit c5c4f6f

Browse files
committed
delete redundant files for better project view
1 parent 780f94b commit c5c4f6f

File tree

4 files changed

+108
-187
lines changed

4 files changed

+108
-187
lines changed

src/Routes.js

Lines changed: 72 additions & 166 deletions
Original file line numberDiff line numberDiff line change
@@ -1,185 +1,91 @@
11
/* eslint-disable react/no-array-index-key */
2-
import React, { lazy, Suspense, Fragment } from 'react';
3-
import { Switch, Redirect, Route } from 'react-router-dom';
2+
import React, { Suspense } from 'react';
3+
import { Switch, Route } from 'react-router-dom';
44
import MainLayout from 'src/layouts/MainLayout';
5-
import DocsLayout from 'src/layouts/DocsLayout';
65
import HomeView from 'src/views/pages/HomeView';
76
import CAView from 'src/views/pages/CLView';
87
import EventsView from 'src/views/pages/EventsView';
98
import LoadingScreen from 'src/components/LoadingScreen';
109
import Courses from 'src/views/pages/Courses';
11-
import ProfileView from 'src/views/pages/ProfileView'
12-
import ApplicationsView from 'src/views/pages/ApplicationsView'
10+
import CoursesView from 'src/views/pages/CoursesView';
11+
import ProfileView from 'src/views/pages/ProfileView';
12+
import ApplicationsView from 'src/views/pages/ApplicationsView';
1313

14-
const routesConfig = [
15-
{
16-
exact: true,
17-
path: '/',
18-
component: () => <Redirect to="/home" />
19-
},
20-
{
21-
exact: true,
22-
path: '/404',
23-
component: lazy(() => import('src/views/pages/Error404View'))
24-
},
25-
{
26-
path: '/privacy',
27-
layout: DocsLayout,
28-
routes: [
29-
{
30-
exact: true,
31-
path: '/privacy',
32-
component: lazy(() => import('src/views/pages/documents/privacyView'))
33-
}
34-
]
35-
},
36-
{
37-
path: '/terms',
38-
layout: DocsLayout,
39-
routes: [
40-
{
41-
exact: true,
42-
path: '/terms',
43-
component: lazy(() => import('src/views/pages/documents/termsView'))
44-
},
45-
{
46-
component: () => <Redirect to="/404" />
47-
}
48-
]
49-
},
50-
{
51-
path: '/refundpolicies',
52-
layout: DocsLayout,
53-
routes: [
54-
{
55-
exact: true,
56-
path: '/refundpolicies',
57-
component: lazy(() => import('src/views/pages/documents/refundView'))
58-
},
59-
{
60-
component: () => <Redirect to="/404" />
61-
}
62-
]
63-
},
64-
{
65-
path: '/campusLeaders',
66-
layout: MainLayout,
67-
routes: [
68-
{
69-
exact: true,
70-
path: '/campusLeaders',
71-
component: CAView
72-
},
73-
{
74-
component: () => <Redirect to="/404" />
75-
}
76-
]
77-
},
78-
{
79-
path: '/events',
80-
layout: MainLayout,
81-
routes: [
82-
{
83-
exact: true,
84-
path: '/events',
85-
component: EventsView
86-
},
87-
{
88-
component: () => <Redirect to="/404" />
89-
}
90-
]
91-
},
92-
{
93-
path: '/courses',
94-
layout: MainLayout,
95-
routes: [
96-
{
97-
path: '/courses',
98-
component: Courses
99-
},
100-
{
101-
component: () => <Redirect to="/404" />
102-
}
103-
]
104-
},
105-
{
106-
path: '/profile',
107-
layout: MainLayout,
108-
routes: [
109-
{
110-
exact: true,
111-
path: '/profile',
112-
component: ProfileView
113-
},
114-
{
115-
component: () => <Redirect to="/404" />
116-
}
117-
]
118-
},
119-
{
120-
path: '/applications',
121-
layout: MainLayout,
122-
routes: [
123-
{
124-
path: '/applications',
125-
component: ApplicationsView
126-
},
127-
{
128-
component: () => <Redirect to="/404" />
129-
}
130-
]
131-
},
14+
const renderRoutes = () =>
13215

133-
{
134-
path: '*',
135-
layout: MainLayout,
136-
routes: [
137-
{
138-
exact: true,
139-
path: '/home',
140-
component: HomeView
141-
},
142-
{
143-
component: () => <Redirect to="/404" />
144-
}
145-
]
146-
}
147-
];
148-
149-
const renderRoutes = routes =>
150-
routes ? (
15116
<Suspense fallback={<LoadingScreen />}>
15217
<Switch>
153-
{routes.map((route, i) => {
154-
const Guard = route.guard || Fragment;
155-
const Layout = route.layout || Fragment;
156-
const Component = route.component;
18+
<Route
19+
path="/"
20+
exact
21+
render={props => (
22+
<MainLayout>
23+
<HomeView {...props} />
24+
</MainLayout>
25+
)}
26+
/>
27+
28+
<Route
29+
path="/applications"
30+
exact
31+
render={props => (
32+
<MainLayout>
33+
<ApplicationsView {...props} />
34+
</MainLayout>
35+
)}
36+
/>
37+
38+
<Route
39+
path="/events"
40+
exact
41+
render={props => (
42+
<MainLayout>
43+
<EventsView {...props} />
44+
</MainLayout>
45+
)}
46+
/>
47+
48+
<Route
49+
path="/profile"
50+
exact
51+
render={props => (
52+
<MainLayout>
53+
<ProfileView {...props} />
54+
</MainLayout>
55+
)}
56+
/>
57+
58+
<Route
59+
path="/courses"
60+
render={props => (
61+
<MainLayout>
62+
<Courses {...props} />
63+
</MainLayout>
64+
)}
65+
/>
15766

158-
return (
159-
<Route
160-
key={i}
161-
path={route.path}
162-
exact={route.exact}
163-
render={props => (
164-
<Guard>
165-
<Layout>
166-
{route.routes ? (
167-
renderRoutes(route.routes)
168-
) : (
169-
<Component {...props} />
170-
)}
171-
</Layout>
172-
</Guard>
173-
)}
174-
/>
175-
);
176-
})}
67+
<Route
68+
path="/gallary"
69+
render={props => (
70+
<MainLayout>
71+
<CoursesView {...props} />
72+
</MainLayout>
73+
)}
74+
/>
75+
<Route
76+
path="/campusLeaders"
77+
exact
78+
render={props => (
79+
<MainLayout>
80+
<CAView {...props} />
81+
</MainLayout>
82+
)}
83+
/>
17784
</Switch>
17885
</Suspense>
179-
) : null;
18086

18187
function Routes() {
182-
return renderRoutes(routesConfig);
88+
return renderRoutes({});
18389
}
18490

18591
export default Routes;

src/layouts/MainLayout/TopBar/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ function TopBar({ className, onMobileNavOpen, ...rest }) {
6565
const navItems = [
6666
{ title: 'Campus Leaders', link: '/campusLeaders' },
6767
{ title: 'Events', link: '/events' },
68-
{ title: 'Courses', link: '/courses' },
68+
{ title: 'Courses', link: '/gallary' },
6969
// { title: 'Team', link: '/team' }
7070
]
7171

src/views/pages/Courses/index.js

Lines changed: 33 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,43 @@
11
import React from 'react';
2-
import { Switch, Route } from 'react-router-dom';
3-
import CoursesView from '../CoursesView';
4-
5-
import MachineLearningView from 'src/views/pages/Courses/MachineLearningView'
6-
import AlgoJavaView from 'src/views/pages/Courses/AlgoJavaView'
7-
import AlgoPythonView from 'src/views/pages/Courses/AlgoPythonView'
8-
import WebFullStakView from 'src/views/pages/Courses/WebFullStakView'
9-
import CompetitiveJavaView from 'src/views/pages/Courses/CompetitiveJavaView'
10-
import PythonDevelopmentView from 'src/views/pages/Courses/PythonDevelopmentView'
2+
import { Route } from 'react-router-dom';
113

4+
import MachineLearningView from 'src/views/pages/Courses/MachineLearningView';
5+
import AlgoJavaView from 'src/views/pages/Courses/AlgoJavaView';
6+
import AlgoPythonView from 'src/views/pages/Courses/AlgoPythonView';
7+
import WebFullStakView from 'src/views/pages/Courses/WebFullStakView';
8+
import CompetitiveJavaView from 'src/views/pages/Courses/CompetitiveJavaView';
9+
import PythonDevelopmentView from 'src/views/pages/Courses/PythonDevelopmentView';
1210

1311
function ApplicationsView({ match }) {
1412
console.log('Matched in routing', match);
1513

1614
return (
17-
<Switch>
18-
<Route path={`${match.path}/machine-learning-using-python`} component={MachineLearningView} />
19-
<Route path={`${match.path}/ds-algo-with-java`} component={AlgoJavaView} />
20-
<Route path={`${match.path}/ds-algo-with-python`} component={AlgoPythonView} />
21-
<Route path={`${match.path}/fullstack-webdev-with-js`} component={WebFullStakView} />
22-
<Route path={`${match.path}/competitive-programming-using-java`} component={CompetitiveJavaView} />
23-
<Route path={`${match.path}/application-dev-using-python`} component={PythonDevelopmentView} />
24-
<Route path={`${match.path}/`} component={CoursesView} />
25-
</Switch>
15+
<div>
16+
<Route
17+
path={`${match.path}/machine-learning-using-python`}
18+
component={MachineLearningView}
19+
/>
20+
<Route
21+
path={`${match.path}/ds-algo-with-java`}
22+
component={AlgoJavaView}
23+
/>
24+
<Route
25+
path={`${match.path}/ds-algo-with-python`}
26+
component={AlgoPythonView}
27+
/>
28+
<Route
29+
path={`${match.path}/fullstack-webdev-with-js`}
30+
component={WebFullStakView}
31+
/>
32+
<Route
33+
path={`${match.path}/competitive-programming-using-java`}
34+
component={CompetitiveJavaView}
35+
/>
36+
<Route
37+
path={`${match.path}/application-dev-using-python`}
38+
component={PythonDevelopmentView}
39+
/>
40+
</div>
2641
);
2742
}
2843

src/views/pages/CoursesView/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const useStyles = makeStyles(() => ({
1111
root: {}
1212
}));
1313

14-
function EventsView() {
14+
function CoursesView() {
1515
const classes = useStyles();
1616

1717
return (
@@ -25,4 +25,4 @@ function EventsView() {
2525
);
2626
}
2727

28-
export default EventsView;
28+
export default CoursesView;

0 commit comments

Comments
 (0)