Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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