Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 7268 | Rev 7317 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
6601 stevensc 1
import React, { lazy, Suspense, useEffect } from 'react'
2
import { useDispatch, useSelector } from 'react-redux'
6994 stevensc 3
import { BrowserRouter as Router, Switch } from 'react-router-dom'
6490 stevensc 4
import { getLanguage } from '../../redux/intl/intl.action'
6753 stevensc 5
import { getPermissions } from '../redux/auth/auth.actions'
6490 stevensc 6
 
6530 stevensc 7
import PublicRoute from './PublicRoute'
6601 stevensc 8
import PrivateRoute from './PrivateRoute'
6707 stevensc 9
import Spinner from '../components/UI/Spinner'
6512 stevensc 10
import NotificationAlert from '../components/UI/notification/NotificationAlert'
6738 stevensc 11
import LoaderContainer from '../components/UI/LoaderContainer'
7279 stevensc 12
import CalendarPage from '../pages/calendar/CalendarPage'
6490 stevensc 13
 
6707 stevensc 14
const Header = lazy(() => import('../components/navbar/Header'))
6601 stevensc 15
const Auth = lazy(() => import('../pages/auth/Auth'))
16
const DashboardPage = lazy(() => import('../pages/dashboard/DashboardPage'))
6707 stevensc 17
const MyConnectionsPage = lazy(() =>
6719 stevensc 18
  import('../pages/connections/MyConnectionsPage')
6707 stevensc 19
)
6724 stevensc 20
const InvitationsReceivedPage = lazy(() =>
21
  import('../pages/connections/InvitationsReceivedPage')
22
)
6719 stevensc 23
const InvitationsSendPage = lazy(() =>
6724 stevensc 24
  import('../pages/connections/InvitationsSendPage')
6719 stevensc 25
)
6725 stevensc 26
const PeopleYouMayKnowPage = lazy(() =>
27
  import('../pages/connections/PeopleYouMayKnowPage')
28
)
29
const PeopleBlockedPage = lazy(() =>
30
  import('../pages/connections/PeopleBlockedPage')
31
)
6738 stevensc 32
const MyProfilesPage = lazy(() => import('../pages/profiles/MyProfilesPage'))
33
const PeopleViewedMyProfilePage = lazy(() =>
34
  import('../pages/profiles/PeopleViewedMyProfilePage')
35
)
36
const SavedJobsPage = lazy(() => import('../pages/jobs/SavedJobsPage'))
37
const AppliedJobsPage = lazy(() => import('../pages/jobs/AppliedJobsPage'))
38
const GroupsRequestsSendPage = lazy(() =>
39
  import('../pages/groups/GroupsRequestsSendPage')
40
)
41
const GroupsRequestsReceivedPage = lazy(() =>
42
  import('../pages/groups/GroupsRequestsReceivedPage')
43
)
44
const JoinedGroupsPage = lazy(() => import('../pages/groups/JoinedGroupsPage'))
45
const MyGroupsPage = lazy(() => import('../pages/groups/MyGroupsPage'))
6753 stevensc 46
const MyCompanies = lazy(() => import('../pages/company/MyCompaniesPage'))
47
const FollowingCompaniesPage = lazy(() =>
48
  import('../pages/company/FollowingCompaniesPage')
49
)
50
const CompaniesWhenIWorkPage = lazy(() =>
51
  import('../pages/company/CompaniesWhenIWorkPage')
52
)
53
const CompanyRequestSendPage = lazy(() =>
54
  import('../pages/company/CompanyRequestSendPage')
55
)
56
const CompanyInvitationsReceivedPage = lazy(() =>
57
  import('../pages/company/CompanyInvitationsReceivedPage')
58
)
59
const ProfileViewPage = lazy(() => import('../pages/profiles/ProfileViewPage'))
6805 stevensc 60
const ProfileEditPage = lazy(() => import('../pages/profiles/ProfileEditPage'))
6862 stevensc 61
const CompanyViewPage = lazy(() => import('../pages/company/CompanyViewPage'))
62
const GroupViewPage = lazy(() => import('../pages/groups/GroupViewPage'))
6894 stevensc 63
const GroupEditPage = lazy(() => import('../pages/groups/GroupEditPage'))
6920 stevensc 64
const ChatPage = lazy(() => import('../pages/chat/ChatPage'))
6957 stevensc 65
const InmailPage = lazy(() => import('../pages/inmail/InmailPage'))
6993 stevensc 66
const MarketPlacePage = lazy(() =>
67
  import('../pages/marketplace/MarketplacePage')
68
)
7114 stevensc 69
const NotificationsPage = lazy(() =>
70
  import('../pages/notifications/NotificationsPage')
71
)
72
const SearchPage = lazy(() => import('../pages/search/SearchPage'))
73
const KnowledgeAreaPage = lazy(() =>
74
  import('../pages/knowledge-area/KnowledgeAreaPage')
75
)
76
const KnowledgeViewPage = lazy(() =>
77
  import('../pages/knowledge-area/KnowledgeViewPage')
78
)
7268 stevensc 79
const PostViewPage = lazy(() => import('../pages/posts/PostViewPage'))
80
const MyCoachPage = lazy(() => import('../pages/my-coach/MyCoachPage'))
81
const MyCoachViewPage = lazy(() => import('../pages/my-coach/MyCoachViewPage'))
82
const JobViewPage = lazy(() => import('../pages/jobs/JobView'))
6490 stevensc 83
 
84
const AppRouter = () => {
6753 stevensc 85
  const { isAuth, theme_id } = useSelector(({ auth }) => auth)
6490 stevensc 86
  const dispatch = useDispatch()
87
 
88
  useEffect(() => {
6745 stevensc 89
    dispatch(getPermissions())
6490 stevensc 90
    dispatch(getLanguage())
91
  }, [])
92
 
93
  return (
94
    <Router>
6753 stevensc 95
      <Suspense fallback={null}>
96
        {isAuth && <Header theme={theme_id} />}
97
      </Suspense>
6724 stevensc 98
 
6707 stevensc 99
      <Suspense
100
        fallback={
6738 stevensc 101
          <LoaderContainer>
6707 stevensc 102
            <Spinner />
6738 stevensc 103
          </LoaderContainer>
6707 stevensc 104
        }
105
      >
106
        <Switch>
6601 stevensc 107
          <PrivateRoute exact path="/dashboard" isAuthenticated={isAuth}>
108
            <DashboardPage />
109
          </PrivateRoute>
6738 stevensc 110
 
6994 stevensc 111
          <PrivateRoute
112
            exact
113
            path="/connection/my-connections"
114
            isAuthenticated={isAuth}
115
          >
116
            <MyConnectionsPage />
6707 stevensc 117
          </PrivateRoute>
6719 stevensc 118
          <PrivateRoute
119
            exact
6994 stevensc 120
            path="/connection/invitations-sent"
121
            isAuthenticated={isAuth}
122
          >
123
            <InvitationsSendPage />
124
          </PrivateRoute>
125
          <PrivateRoute
126
            exact
6724 stevensc 127
            path="/connection/invitations-received"
128
            isAuthenticated={isAuth}
129
          >
130
            <InvitationsReceivedPage />
131
          </PrivateRoute>
6725 stevensc 132
          <PrivateRoute
133
            exact
134
            path="/connection/people-you-may-know"
135
            isAuthenticated={isAuth}
136
          >
137
            <PeopleYouMayKnowPage />
138
          </PrivateRoute>
139
          <PrivateRoute
140
            exact
6726 stevensc 141
            path="/connection/people-blocked"
6725 stevensc 142
            isAuthenticated={isAuth}
143
          >
144
            <PeopleBlockedPage />
145
          </PrivateRoute>
6738 stevensc 146
 
6727 stevensc 147
          <PrivateRoute
148
            exact
149
            path="/profile/my-profiles"
150
            isAuthenticated={isAuth}
151
          >
152
            <MyProfilesPage />
153
          </PrivateRoute>
154
          <PrivateRoute
155
            exact
156
            path="/profile/people-viewed-profile"
157
            isAuthenticated={isAuth}
158
          >
159
            <PeopleViewedMyProfilePage />
160
          </PrivateRoute>
6862 stevensc 161
          <PrivateRoute path="/profile/view/:uuid" isAuthenticated={isAuth}>
162
            <ProfileViewPage />
163
          </PrivateRoute>
164
          <PrivateRoute
165
            path="/profile/my-profiles/edit/:uuid"
166
            isAuthenticated={isAuth}
167
          >
168
            <ProfileEditPage />
169
          </PrivateRoute>
6738 stevensc 170
 
6727 stevensc 171
          <PrivateRoute exact path="/job/saved-jobs" isAuthenticated={isAuth}>
172
            <SavedJobsPage />
173
          </PrivateRoute>
174
          <PrivateRoute exact path="/job/applied-jobs" isAuthenticated={isAuth}>
6729 stevensc 175
            <AppliedJobsPage />
6727 stevensc 176
          </PrivateRoute>
6601 stevensc 177
 
6738 stevensc 178
          <PrivateRoute
179
            exact
6740 stevensc 180
            path="/group/requests-sent"
6738 stevensc 181
            isAuthenticated={isAuth}
182
          >
183
            <GroupsRequestsSendPage />
184
          </PrivateRoute>
185
          <PrivateRoute
186
            exact
187
            path="/group/invitations-received"
188
            isAuthenticated={isAuth}
189
          >
190
            <GroupsRequestsReceivedPage />
191
          </PrivateRoute>
192
          <PrivateRoute
193
            exact
194
            path="/group/joined-groups"
195
            isAuthenticated={isAuth}
196
          >
197
            <JoinedGroupsPage />
198
          </PrivateRoute>
199
          <PrivateRoute exact path="/group/my-groups" isAuthenticated={isAuth}>
200
            <MyGroupsPage />
201
          </PrivateRoute>
6862 stevensc 202
          <PrivateRoute path="/group/view/:uuid" isAuthenticated={isAuth}>
203
            <GroupViewPage />
204
          </PrivateRoute>
6894 stevensc 205
          <PrivateRoute
6895 stevensc 206
            path="/group/my-groups/edit/:uuid"
6894 stevensc 207
            isAuthenticated={isAuth}
208
          >
209
            <GroupEditPage />
210
          </PrivateRoute>
6738 stevensc 211
 
6753 stevensc 212
          <PrivateRoute
213
            exact
214
            path="/company/my-companies"
215
            isAuthenticated={isAuth}
216
          >
217
            <MyCompanies />
218
          </PrivateRoute>
219
          <PrivateRoute
220
            exact
221
            path="/company/following-companies"
222
            isAuthenticated={isAuth}
223
          >
224
            <FollowingCompaniesPage />
225
          </PrivateRoute>
226
          <PrivateRoute
227
            exact
228
            path="/company/i-work-with"
229
            isAuthenticated={isAuth}
230
          >
231
            <CompaniesWhenIWorkPage />
232
          </PrivateRoute>
233
          <PrivateRoute
234
            exact
235
            path="/company/requests-sent"
236
            isAuthenticated={isAuth}
237
          >
238
            <CompanyRequestSendPage />
239
          </PrivateRoute>
240
          <PrivateRoute
241
            exact
242
            path="/company/requests-sent"
243
            isAuthenticated={isAuth}
244
          >
245
            <CompanyRequestSendPage />
246
          </PrivateRoute>
247
          <PrivateRoute
248
            exact
249
            path="/company/invitations-received"
250
            isAuthenticated={isAuth}
251
          >
252
            <CompanyInvitationsReceivedPage />
253
          </PrivateRoute>
6830 stevensc 254
          <PrivateRoute path="/company/view/:uuid" isAuthenticated={isAuth}>
255
            <CompanyViewPage />
256
          </PrivateRoute>
257
 
6911 stevensc 258
          <PrivateRoute path="/chat" isAuthenticated={isAuth}>
259
            <ChatPage />
260
          </PrivateRoute>
6983 stevensc 261
          <PrivateRoute path="/inmail/:uuid" isAuthenticated={isAuth}>
6970 stevensc 262
            <InmailPage />
263
          </PrivateRoute>
6983 stevensc 264
          <PrivateRoute path="/inmail" isAuthenticated={isAuth}>
6947 stevensc 265
            <InmailPage />
266
          </PrivateRoute>
6911 stevensc 267
 
6993 stevensc 268
          <PrivateRoute path="/marketplace" isAuthenticated={isAuth}>
269
            <MarketPlacePage />
270
          </PrivateRoute>
6999 stevensc 271
          <PrivateRoute path="/notifications" isAuthenticated={isAuth}>
272
            <NotificationsPage />
273
          </PrivateRoute>
7000 stevensc 274
          <PrivateRoute path="/search" isAuthenticated={isAuth}>
7001 stevensc 275
            <SearchPage />
7000 stevensc 276
          </PrivateRoute>
6993 stevensc 277
 
7062 stevensc 278
          <PrivateRoute
279
            path="/knowledge-area/view/:uuid"
280
            isAuthenticated={isAuth}
281
          >
282
            <KnowledgeViewPage />
283
          </PrivateRoute>
7015 stevensc 284
          <PrivateRoute path="/knowledge-area" isAuthenticated={isAuth}>
285
            <KnowledgeAreaPage />
286
          </PrivateRoute>
287
 
7268 stevensc 288
          <PrivateRoute path="/job/view/:uuid" isAuthenticated={isAuth}>
289
            <JobViewPage />
290
          </PrivateRoute>
291
 
7129 stevensc 292
          <PrivateRoute path="/post/:uuid" isAuthenticated={isAuth}>
293
            <PostViewPage />
294
          </PrivateRoute>
295
 
7279 stevensc 296
          <PrivateRoute path="/calendar" isAuthenticated={isAuth}>
297
            <CalendarPage />
298
          </PrivateRoute>
299
 
7173 stevensc 300
          <PrivateRoute
301
            path="/my-coach/questions/view/:uuid"
302
            isAuthenticated={isAuth}
303
          >
7210 stevensc 304
            <MyCoachViewPage />
7156 stevensc 305
          </PrivateRoute>
7173 stevensc 306
          <PrivateRoute exact path="/my-coach" isAuthenticated={isAuth}>
307
            <MyCoachPage />
308
          </PrivateRoute>
7156 stevensc 309
 
6601 stevensc 310
          <PublicRoute path="/" isAuthenticated={isAuth}>
6546 stevensc 311
            <Auth />
312
          </PublicRoute>
6707 stevensc 313
        </Switch>
314
      </Suspense>
6512 stevensc 315
 
316
      <NotificationAlert />
6490 stevensc 317
    </Router>
318
  )
319
}
320
 
321
export default AppRouter