Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 6729 | Rev 6740 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 6729 Rev 6738
Línea 1... Línea 1...
1
import React, { lazy, Suspense, useEffect } from 'react'
1
import React, { lazy, Suspense, useEffect } from 'react'
2
import { useDispatch, useSelector } from 'react-redux'
2
import { useDispatch, useSelector } from 'react-redux'
3
import { BrowserRouter as Router, Switch } from 'react-router-dom'
3
import { BrowserRouter as Router, Switch } from 'react-router-dom'
4
import styled from 'styled-components'
-
 
5
import { getLanguage } from '../../redux/intl/intl.action'
4
import { getLanguage } from '../../redux/intl/intl.action'
Línea 6... Línea 5...
6
 
5
 
7
import PublicRoute from './PublicRoute'
6
import PublicRoute from './PublicRoute'
8
import PrivateRoute from './PrivateRoute'
7
import PrivateRoute from './PrivateRoute'
9
import Spinner from '../components/UI/Spinner'
8
import Spinner from '../components/UI/Spinner'
10
import NotificationAlert from '../components/UI/notification/NotificationAlert'
-
 
11
import MyProfilesPage from '../pages/profiles/MyProfilesPage'
-
 
12
import PeopleViewedMyProfilePage from '../pages/profiles/PeopleViewedMyProfilePage'
9
import NotificationAlert from '../components/UI/notification/NotificationAlert'
13
import SavedJobsPage from '../pages/jobs/SavedJobsPage'
-
 
Línea 14... Línea 10...
14
import AppliedJobsPage from '../pages/jobs/AppliedJobsPage'
10
import LoaderContainer from '../components/UI/LoaderContainer'
15
 
11
 
16
const Header = lazy(() => import('../components/navbar/Header'))
12
const Header = lazy(() => import('../components/navbar/Header'))
17
const Auth = lazy(() => import('../pages/auth/Auth'))
13
const Auth = lazy(() => import('../pages/auth/Auth'))
Línea 29... Línea 25...
29
  import('../pages/connections/PeopleYouMayKnowPage')
25
  import('../pages/connections/PeopleYouMayKnowPage')
30
)
26
)
31
const PeopleBlockedPage = lazy(() =>
27
const PeopleBlockedPage = lazy(() =>
32
  import('../pages/connections/PeopleBlockedPage')
28
  import('../pages/connections/PeopleBlockedPage')
33
)
29
)
-
 
30
const MyProfilesPage = lazy(() => import('../pages/profiles/MyProfilesPage'))
-
 
31
const PeopleViewedMyProfilePage = lazy(() =>
-
 
32
  import('../pages/profiles/PeopleViewedMyProfilePage')
34
 
33
)
35
const StyledSpinnerContainer = styled.div`
34
const SavedJobsPage = lazy(() => import('../pages/jobs/SavedJobsPage'))
36
  margin: 1rem auto;
35
const AppliedJobsPage = lazy(() => import('../pages/jobs/AppliedJobsPage'))
37
  position: relative;
36
const GroupsRequestsSendPage = lazy(() =>
38
  width: 80px;
-
 
39
  text-align: center;
37
  import('../pages/groups/GroupsRequestsSendPage')
40
  height: 80px;
38
)
41
  border-radius: 100px;
-
 
42
  background-color: #fff;
39
const GroupsRequestsReceivedPage = lazy(() =>
43
  line-height: 80px;
-
 
44
  border: 1px solid #e1e1e1;
40
  import('../pages/groups/GroupsRequestsReceivedPage')
45
  cursor: pointer;
-
 
46
`
41
)
-
 
42
const JoinedGroupsPage = lazy(() => import('../pages/groups/JoinedGroupsPage'))
-
 
43
const MyGroupsPage = lazy(() => import('../pages/groups/MyGroupsPage'))
Línea 47... Línea 44...
47
 
44
 
48
const AppRouter = () => {
45
const AppRouter = () => {
49
  const { isAuth } = useSelector(({ auth }) => auth)
46
  const { isAuth } = useSelector(({ auth }) => auth)
Línea 57... Línea 54...
57
    <Router>
54
    <Router>
58
      <Suspense fallback={null}>{isAuth && <Header />}</Suspense>
55
      <Suspense fallback={null}>{isAuth && <Header />}</Suspense>
Línea 59... Línea 56...
59
 
56
 
60
      <Suspense
57
      <Suspense
61
        fallback={
58
        fallback={
62
          <StyledSpinnerContainer>
59
          <LoaderContainer>
63
            <Spinner />
60
            <Spinner />
64
          </StyledSpinnerContainer>
61
          </LoaderContainer>
65
        }
62
        }
66
      >
63
      >
67
        <Switch>
64
        <Switch>
68
          <PrivateRoute exact path="/dashboard" isAuthenticated={isAuth}>
65
          <PrivateRoute exact path="/dashboard" isAuthenticated={isAuth}>
69
            <DashboardPage />
66
            <DashboardPage />
-
 
67
          </PrivateRoute>
70
          </PrivateRoute>
68
 
71
          <PrivateRoute
69
          <PrivateRoute
72
            exact
70
            exact
73
            path="/connection/my-connections"
71
            path="/connection/my-connections"
74
            isAuthenticated={isAuth}
72
            isAuthenticated={isAuth}
Línea 101... Línea 99...
101
            path="/connection/people-blocked"
99
            path="/connection/people-blocked"
102
            isAuthenticated={isAuth}
100
            isAuthenticated={isAuth}
103
          >
101
          >
104
            <PeopleBlockedPage />
102
            <PeopleBlockedPage />
105
          </PrivateRoute>
103
          </PrivateRoute>
-
 
104
 
106
          <PrivateRoute
105
          <PrivateRoute
107
            exact
106
            exact
108
            path="/profile/my-profiles"
107
            path="/profile/my-profiles"
109
            isAuthenticated={isAuth}
108
            isAuthenticated={isAuth}
110
          >
109
          >
Línea 115... Línea 114...
115
            path="/profile/people-viewed-profile"
114
            path="/profile/people-viewed-profile"
116
            isAuthenticated={isAuth}
115
            isAuthenticated={isAuth}
117
          >
116
          >
118
            <PeopleViewedMyProfilePage />
117
            <PeopleViewedMyProfilePage />
119
          </PrivateRoute>
118
          </PrivateRoute>
-
 
119
 
120
          <PrivateRoute exact path="/job/saved-jobs" isAuthenticated={isAuth}>
120
          <PrivateRoute exact path="/job/saved-jobs" isAuthenticated={isAuth}>
121
            <SavedJobsPage />
121
            <SavedJobsPage />
122
          </PrivateRoute>
122
          </PrivateRoute>
123
          <PrivateRoute exact path="/job/applied-jobs" isAuthenticated={isAuth}>
123
          <PrivateRoute exact path="/job/applied-jobs" isAuthenticated={isAuth}>
124
            <AppliedJobsPage />
124
            <AppliedJobsPage />
125
          </PrivateRoute>
125
          </PrivateRoute>
Línea -... Línea 126...
-
 
126
 
-
 
127
          <PrivateRoute
-
 
128
            exact
-
 
129
            path="/group/invitations-sent"
-
 
130
            isAuthenticated={isAuth}
-
 
131
          >
-
 
132
            <GroupsRequestsSendPage />
-
 
133
          </PrivateRoute>
-
 
134
          <PrivateRoute
-
 
135
            exact
-
 
136
            path="/group/invitations-received"
-
 
137
            isAuthenticated={isAuth}
-
 
138
          >
-
 
139
            <GroupsRequestsReceivedPage />
-
 
140
          </PrivateRoute>
-
 
141
          <PrivateRoute
-
 
142
            exact
-
 
143
            path="/group/joined-groups"
-
 
144
            isAuthenticated={isAuth}
-
 
145
          >
-
 
146
            <JoinedGroupsPage />
-
 
147
          </PrivateRoute>
-
 
148
          <PrivateRoute exact path="/group/my-groups" isAuthenticated={isAuth}>
-
 
149
            <MyGroupsPage />
-
 
150
          </PrivateRoute>
126
 
151
 
127
          <PublicRoute path="/" isAuthenticated={isAuth}>
152
          <PublicRoute path="/" isAuthenticated={isAuth}>
128
            <Auth />
153
            <Auth />
129
          </PublicRoute>
154
          </PublicRoute>
130
        </Switch>
155
        </Switch>