Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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