Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Rex Dri
Rex Dri
Commits
9ff13c60
Commit
9ff13c60
authored
May 31, 2020
by
Imane Misrar
Browse files
feat(LastVisitedUniversity) : add select component for lastVisitedUniversities
Relates to
#149
parent
4ca29017
Changes
3
Hide whitespace changes
Inline
Side-by-side
frontend/src/components/app/App.jsx
View file @
9ff13c60
...
...
@@ -6,6 +6,7 @@ import { compose } from "recompose";
import
{
Route
,
Switch
}
from
"
react-router-dom
"
;
import
{
withErrorBoundary
}
from
"
../common/ErrorBoundary
"
;
import
LastVisitedUniversity
from
"
./LastVisitedUniversity
"
;
import
PageMap
from
"
../pages/PageMap
"
;
import
PageHome
from
"
../pages/PageHome
"
;
import
PageUniversity
from
"
../pages/PageUniversity
"
;
...
...
@@ -90,6 +91,7 @@ function App() {
</
Switch
>
</
main
>
</
MainAppFrame
>
<
LastVisitedUniversity
/>
<
FooterImportantInformation
/>
</
div
>
);
...
...
frontend/src/components/app/LastVisitedUniversity.jsx
0 → 100644
View file @
9ff13c60
import
React
from
"
react
"
;
import
{
compose
}
from
"
recompose
"
;
import
{
makeStyles
}
from
"
@material-ui/styles
"
;
import
InputLabel
from
"
@material-ui/core/InputLabel
"
;
import
FormControl
from
"
@material-ui/core/FormControl
"
;
import
Select
from
"
@material-ui/core/Select
"
;
import
MenuItem
from
"
@material-ui/core/MenuItem
"
;
import
PropTypes
from
"
prop-types
"
;
import
{
withRouter
}
from
"
react-router-dom
"
;
import
APP_ROUTES
from
"
../../config/appRoutes
"
;
import
withNetworkWrapper
,
{
NetWrapParam
}
from
"
../../hoc/withNetworkWrapper
"
;
import
UniversityService
from
"
../../services/data/UniversityService
"
;
import
NavigationService
from
"
../../services/NavigationService
"
;
import
LicenseNotice
from
"
../common/LicenseNotice
"
;
const
useStyles
=
makeStyles
((
theme
)
=>
({
formControl
:
{
marginLeft
:
"
auto
"
,
marginRight
:
theme
.
spacing
(
2
),
padding
:
theme
.
spacing
(
1
),
maxWidth
:
"
80%
"
,
position
:
"
sticky
"
,
bottom
:
theme
.
spacing
(
2
),
border
:
"
solid
"
,
borderWidth
:
2
,
borderRadius
:
theme
.
shape
.
borderRadius
,
borderColor
:
theme
.
palette
.
primary
.
main
,
borderStyle
:
"
dashed
"
,
backgroundColor
:
theme
.
palette
.
background
.
paper
,
zIndex
:
1000
,
},
}));
function
LastVisitedUniversity
({
location
,
lastVisitedUniversities
})
{
const
classes
=
useStyles
();
if
(
location
.
pathname
===
APP_ROUTES
.
base
||
location
.
pathname
===
APP_ROUTES
.
themeSettings
||
location
.
pathname
===
APP_ROUTES
.
myExchanges
||
location
.
pathname
===
APP_ROUTES
.
editPreviousExchangeWithParams
||
location
.
pathname
===
APP_ROUTES
.
userWithParams
||
location
.
pathname
===
APP_ROUTES
.
aboutProject
||
location
.
pathname
===
APP_ROUTES
.
aboutRgpd
||
location
.
pathname
===
APP_ROUTES
.
aboutCgu
||
location
.
pathname
===
APP_ROUTES
.
aboutUnlinkedPartners
||
location
.
pathname
===
APP_ROUTES
.
logout
)
{
return
<></>;
}
const
handleChange
=
(
event
)
=>
{
const
univId
=
event
.
target
.
value
;
if
(
univId
!==
""
)
NavigationService
.
goToUniversity
(
univId
);
};
return
(
<
div
>
<
FormControl
className
=
{
classes
.
formControl
}
>
<
InputLabel
id
=
"select-last-visitied-university-label"
>
Dernières universités visitées
</
InputLabel
>
<
Select
labelId
=
"select-last-visitied-university-label"
id
=
"select-last-visitied-university"
value
=
""
onChange
=
{
handleChange
}
>
{
lastVisitedUniversities
.
map
(({
university
})
=>
(
<
MenuItem
key
=
{
university
}
value
=
{
university
}
>
{
UniversityService
.
getUnivName
(
university
)
}
</
MenuItem
>
))
}
</
Select
>
<
LicenseNotice
variant
=
"REX-DRI—PRIVATE"
spacer
=
{
false
}
/>
</
FormControl
>
</
div
>
);
}
LastVisitedUniversity
.
propTypes
=
{
location
:
PropTypes
.
shape
({
pathname
:
PropTypes
.
string
.
isRequired
,
}).
isRequired
,
lastVisitedUniversities
:
PropTypes
.
arrayOf
(
PropTypes
.
shape
({
university
:
PropTypes
.
number
.
isRequired
,
ts
:
PropTypes
.
string
.
isRequired
,
}).
isRequired
).
isRequired
,
};
export
default
compose
(
withNetworkWrapper
([
new
NetWrapParam
(
"
lastVisitedUniversities
"
,
"
all
"
,
{
addDataToProp
:
"
lastVisitedUniversities
"
,
}),
]),
withRouter
)(
LastVisitedUniversity
);
frontend/src/components/common/LicenseNotice.jsx
View file @
9ff13c60
...
...
@@ -21,17 +21,23 @@ function LicenseNotice(props) {
return
(
<>
<
Typography
variant
=
"caption"
display
=
"block"
>
Ce contenu est sous license
{
props
.
variant
}
. Plus d'informations à ce propos sont disponibles
Ce contenu est sous license
{
props
.
variant
}
.
<
br
/>
Plus d'informations à ce propos sont disponibles
<
TextLink
href
=
{
getWindowBase
()
+
APP_ROUTES
.
aboutCgu
}
>
ici
</
TextLink
>
.
</
Typography
>
<
div
className
=
{
classes
.
spacer
}
/>
{
props
.
spacer
&&
<
div
className
=
{
classes
.
spacer
}
/>
}
</>
);
}
LicenseNotice
.
propTypes
=
{
variant
:
PropTypes
.
oneOf
([
"
REX-DRI—PRIVATE
"
,
"
REX-DRI—BY
"
]).
isRequired
,
spacer
:
PropTypes
.
bool
,
};
LicenseNotice
.
defaultProps
=
{
spacer
:
true
,
};
export
default
LicenseNotice
;
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment