Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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