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
364be4d4
Commit
364be4d4
authored
Feb 21, 2019
by
Florent Chehab
Browse files
Fixes
#47
All proptypes have been added when possible
parent
91cf918f
Pipeline
#35286
passed with stages
in 3 minutes and 23 seconds
Changes
13
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
frontend/.eslintrc.js
View file @
364be4d4
...
...
@@ -35,8 +35,8 @@ module.exports = {
"
error
"
,
"
always
"
],
"
react/no-unescaped-entities
"
:
"
warn
"
,
"
react/prop-types
"
:
"
warn
"
,
"
react/no-unescaped-entities
"
:
"
off
"
,
// that one doesn't improve code readability
"
react/prop-types
"
:
"
error
"
,
"
react/no-deprecated
"
:
"
warn
"
}
};
frontend/src/components/CustomComponentForAPI.js
View file @
364be4d4
import
React
,
{
Component
}
from
"
react
"
;
import
Loading
from
"
./other/Loading
"
;
import
PropTypes
from
"
prop-types
"
;
// Stores the name of the reducers/actions that result in read data
const
successActionsWithReads
=
[
"
readSucceeded
"
,
"
createSucceeded
"
,
"
updateSucceeded
"
];
...
...
@@ -254,4 +256,8 @@ class CustomComponentForAPI extends Component {
}
}
CustomComponentForAPI.propTypes = {
api: PropTypes.object
};
export default CustomComponentForAPI;
frontend/src/components/filter/DownshiftMultiple.js
View file @
364be4d4
...
...
@@ -84,10 +84,10 @@ class DownshiftMultiple extends React.Component {
const
{
selectedItems
}
=
this
.
state
;
let
possible
=
__difference
(
options
,
selectedItems
);
const
filter
=
fuzzysort
.
go
(
value
,
possible
,
{
limit
:
5
,
key
:
"
label
"
});
if
(
filter
.
length
>
0
){
if
(
filter
.
length
>
0
)
{
return
__map
(
filter
,
(
item
)
=>
item
.
obj
);
}
else
{
return
possible
.
slice
(
0
,
4
);
return
possible
.
slice
(
0
,
4
);
}
}
...
...
@@ -142,51 +142,54 @@ class DownshiftMultiple extends React.Component {
onChange
=
{
this
.
handleChange
}
selectedItem
=
{
selectedItems
}
>
{({
getInputProps
,
getItemProps
,
isOpen
,
inputValue
:
inputValue2
,
selectedItem
:
selectedItem2
,
highlightedIndex
,
})
=>
(
<
div
className
=
{
classes
.
container
}
>
{
renderInput
({
fullWidth
:
true
,
classes
,
InputProps
:
getInputProps
({
startAdornment
:
selectedItems
.
map
(
item
=>
(
<
Chip
key
=
{
item
.
id
}
tabIndex
=
{
-
1
}
label
=
{
item
.
label
}
className
=
{
classes
.
chip
}
onDelete
=
{
this
.
handleDelete
(
item
.
id
)}
variant
=
"
outlined
"
color
=
"
primary
"
/>
)),
onChange
:
this
.
handleInputChange
,
onKeyDown
:
this
.
handleKeyDown
,
placeholder
:
field_placeholder
,
}),
label
:
field_label
,
})}
{
isOpen
?
(
<
Paper
className
=
{
classes
.
paper
}
square
>
{
this
.
getSuggestions
(
inputValue2
).
map
((
suggestion
,
index
)
=>
renderSuggestion
({
suggestion
,
index
,
itemProps
:
getItemProps
({
item
:
suggestion
.
id
}),
highlightedIndex
,
selectedItem
:
selectedItem2
,
{
({
getInputProps
,
getItemProps
,
isOpen
,
inputValue
:
inputValue2
,
selectedItem
:
selectedItem2
,
highlightedIndex
,
})
=>
(
<
div
className
=
{
classes
.
container
}
>
{
renderInput
({
fullWidth
:
true
,
classes
,
InputProps
:
getInputProps
({
startAdornment
:
selectedItems
.
map
(
item
=>
(
<
Chip
key
=
{
item
.
id
}
tabIndex
=
{
-
1
}
label
=
{
item
.
label
}
className
=
{
classes
.
chip
}
onDelete
=
{
this
.
handleDelete
(
item
.
id
)}
variant
=
"
outlined
"
color
=
"
primary
"
/>
)),
onChange
:
this
.
handleInputChange
,
onKeyDown
:
this
.
handleKeyDown
,
placeholder
:
field_placeholder
,
}),
)}
<
/Paper
>
)
:
null
}
<
/div
>
)}
label
:
field_label
,
})}
{
isOpen
?
(
<
Paper
className
=
{
classes
.
paper
}
square
>
{
this
.
getSuggestions
(
inputValue2
).
map
((
suggestion
,
index
)
=>
renderSuggestion
({
suggestion
,
index
,
itemProps
:
getItemProps
({
item
:
suggestion
.
id
}),
highlightedIndex
,
selectedItem
:
selectedItem2
,
}),
)}
<
/Paper
>
)
:
null
}
<
/div
>
)
}
<
/Downshift
>
<
/div
>
...
...
@@ -196,6 +199,12 @@ class DownshiftMultiple extends React.Component {
DownshiftMultiple
.
propTypes
=
{
classes
:
PropTypes
.
object
.
isRequired
,
onComponentUnmount
:
PropTypes
.
func
.
isRequired
,
onChange
:
PropTypes
.
func
.
isRequired
,
config
:
PropTypes
.
object
.
isRequired
,
field_label
:
PropTypes
.
string
.
isRequired
,
field_placeholder
:
PropTypes
.
string
.
isRequired
,
options
:
PropTypes
.
array
.
isRequired
,
};
DownshiftMultiple
.
defaultProps
=
{
...
...
frontend/src/components/map/MyCardMedia.js
View file @
364be4d4
import
React
,
{
Component
}
from
"
react
"
;
import
PropTypes
from
"
prop-types
"
;
import
CardMedia
from
"
@material-ui/core/CardMedia
"
;
class
MyCardMedia
extends
Component
{
...
...
@@ -6,7 +7,7 @@ class MyCardMedia extends Component {
render
()
{
const
{
title
,
height
,
url
}
=
this
.
props
;
if
(
url
==
""
)
{
return
(
<
div
/>
);
return
(
<
div
/>
);
}
return
(
<
CardMedia
...
...
@@ -20,5 +21,10 @@ class MyCardMedia extends Component {
}
}
MyCardMedia
.
propTypes
=
{
title
:
PropTypes
.
string
.
isRequired
,
height
:
PropTypes
.
string
.
isRequired
,
url
:
PropTypes
.
string
.
isRequired
,
};
export
default
MyCardMedia
;
\ No newline at end of file
export
default
MyCardMedia
;
frontend/src/components/map/UnivPopupContent.js
View file @
364be4d4
...
...
@@ -74,6 +74,12 @@ class UnivPopupContent extends Component {
UnivPopupContent
.
propTypes
=
{
classes
:
PropTypes
.
object
.
isRequired
,
logo
:
PropTypes
.
string
.
isRequired
,
name
:
PropTypes
.
string
.
isRequired
,
city
:
PropTypes
.
string
.
isRequired
,
country
:
PropTypes
.
string
.
isRequired
,
univId
:
PropTypes
.
number
.
isRequired
,
leaflet
:
PropTypes
.
object
.
isRequired
,
};
export
default
withLeaflet
(
withStyles
(
styles
)(
UnivPopupContent
));
\ No newline at end of file
export
default
withLeaflet
(
withStyles
(
styles
)(
UnivPopupContent
));
frontend/src/components/search/UnivList.js
View file @
364be4d4
...
...
@@ -87,7 +87,7 @@ class UnivList extends React.Component {
<
Divider
/>
{
__map
(
__range
((
page
)
*
itemsPerPage
,
Math
.
min
((
page
+
1
)
*
itemsPerPage
,
numberOfItems
)),
univ_ind
=>
(
<
Link
to
=
{
"
/app/university/
"
+
universitiesToList
[
univ_ind
].
id
}
>
<
Link
to
=
{
"
/app/university/
"
+
universitiesToList
[
univ_ind
].
id
}
key
=
{
univ_ind
}
>
<
ListItem
button
divider
=
{
true
}
key
=
{
univ_ind
}
>
<
ListItemText
primary
=
{
universitiesToList
[
univ_ind
].
name
}
/
>
<
/ListItem
>
...
...
@@ -126,6 +126,8 @@ class UnivList extends React.Component {
UnivList
.
propTypes
=
{
classes
:
PropTypes
.
object
.
isRequired
,
theme
:
PropTypes
.
object
.
isRequired
,
universitiesToList
:
PropTypes
.
object
.
isRequired
,
// TODO fix type issue, sometimes is array, sometimes is object
itemsPerPage
:
PropTypes
.
number
.
isRequired
,
};
UnivList
.
defaultProps
=
{
...
...
frontend/src/components/shared/Markdown.js
View file @
364be4d4
/* eslint-disable react/prop-types */
/* eslint-disable react/display-name */
// Inspired by : https://github.com/mui-org/material-ui/blob/master/docs/src/pages/page-layout-examples/blog/Markdown.js
...
...
frontend/src/components/university/UniversityTemplate.js
View file @
364be4d4
...
...
@@ -42,6 +42,7 @@ function TabContainer(props) {
TabContainer
.
propTypes
=
{
children
:
PropTypes
.
node
.
isRequired
,
visible
:
PropTypes
.
bool
.
isRequired
};
const
styles
=
theme
=>
({
...
...
@@ -110,6 +111,7 @@ class UniversityTemplate extends React.Component {
UniversityTemplate
.
propTypes
=
{
classes
:
PropTypes
.
object
.
isRequired
,
width
:
PropTypes
.
string
.
isRequired
,
};
export
default
compose
(
...
...
frontend/src/components/university/shared/Alert.js
View file @
364be4d4
...
...
@@ -99,6 +99,7 @@ Alert.propTypes = {
handleClose
:
PropTypes
.
func
.
isRequired
,
handleResponse
:
PropTypes
.
func
.
isRequired
,
multilineButtons
:
PropTypes
.
bool
.
isRequired
,
classes
:
PropTypes
.
object
.
isRequired
};
...
...
frontend/src/components/university/shared/History.js
View file @
364be4d4
...
...
@@ -68,6 +68,7 @@ class History extends React.Component {
}
getContentTypeAndId
()
{
// eslint-disable-next-line react/prop-types
const
{
rawModelData
}
=
this
.
props
.
factory
.
props
;
const
{
content_type_id
,
id
}
=
rawModelData
;
return
{
content_type_id
,
id
};
...
...
@@ -199,6 +200,11 @@ History.propTypes = {
classes
:
PropTypes
.
object
.
isRequired
,
factory
:
PropTypes
.
object
.
isRequired
,
handleRestoreVersion
:
PropTypes
.
func
.
isRequired
,
readVersions
:
PropTypes
.
func
.
isRequired
,
handleCloseHistory
:
PropTypes
.
func
.
isRequired
,
resetVersions
:
PropTypes
.
func
.
isRequired
,
open
:
PropTypes
.
bool
.
isRequired
,
versions
:
PropTypes
.
object
.
isRequired
};
History
.
defaultProps
=
{
...
...
frontend/src/components/university/shared/PendingModeration.js
View file @
364be4d4
...
...
@@ -119,6 +119,9 @@ PendingModeration.propTypes = {
classes
:
PropTypes
.
object
.
isRequired
,
factory
:
PropTypes
.
object
.
isRequired
,
handleEditPendingModeration
:
PropTypes
.
func
.
isRequired
,
handleClosePendingModeration
:
PropTypes
.
func
.
isRequired
,
handleApproveModeration
:
PropTypes
.
func
.
isRequired
,
open
:
PropTypes
.
bool
.
isRequired
,
userCanModerate
:
PropTypes
.
bool
.
isRequired
,
};
...
...
frontend/src/components/university/shared/Scholarship.js
View file @
364be4d4
...
...
@@ -153,6 +153,7 @@ Scholarship.propTypes = {
otherAdvantages
:
PropTypes
.
string
,
amountMin
:
PropTypes
.
string
,
amountMax
:
PropTypes
.
string
,
currencies
:
PropTypes
.
object
.
isRequired
,
};
export
default
withStyles
(
styles
,
{
withTheme
:
true
})(
Scholarship
);
frontend/src/components/university/shared/fields/Field.js
View file @
364be4d4
...
...
@@ -58,7 +58,8 @@ Field.propTypes = {
required
:
PropTypes
.
bool
.
isRequired
,
label
:
PropTypes
.
string
,
formManager
:
PropTypes
.
object
.
isRequired
,
fieldMapping
:
PropTypes
.
string
.
isRequired
fieldMapping
:
PropTypes
.
string
.
isRequired
,
value
:
PropTypes
.
isRequired
};
export
default
Field
;
Write
Preview
Markdown
is supported
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