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
7266140c
Commit
7266140c
authored
Feb 24, 2019
by
Florent Chehab
Browse files
Merge branch 'cleaning' into 'master'
Cleaning See merge request
rex-dri/rex-dri!50
parents
0e42118e
4fe1bdf2
Pipeline
#35396
passed with stages
in 4 minutes and 15 seconds
Changes
106
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
frontend/src/components/university/shared/fields/UsefulLinksField.js
View file @
7266140c
...
...
@@ -19,17 +19,7 @@ import Typography from "@material-ui/core/Typography";
import
isUrl
from
"
../../../../utils/isUrl
"
;
// eslint-disable-next-line no-unused-vars
const
styles
=
theme
=>
({
container
:
{
display
:
"
flex
"
,
flexWrap
:
"
wrap
"
,
},
usefulLinkContainer
:
{
display
:
"
flex
"
,
flexWrap
:
"
wrap
"
,
}
});
class
UsefulLinksField
extends
Field
{
...
...
@@ -239,6 +229,18 @@ UsefulLinksField.propTypes = {
descriptionMaxLength
:
PropTypes
.
number
.
isRequired
};
const
styles
=
{
container
:
{
display
:
"
flex
"
,
flexWrap
:
"
wrap
"
,
},
usefulLinkContainer
:
{
display
:
"
flex
"
,
flexWrap
:
"
wrap
"
,
}
};
export
default
compose
(
withStyles
(
styles
,
{
withTheme
:
true
}),
)(
UsefulLinksField
);
frontend/src/components/university/tabs/CampusesCitiesTab.js
View file @
7266140c
import
React
from
"
react
"
;
// import PropTypes from "prop-types";
import
withStyles
from
"
@material-ui/core/styles/withStyles
"
;
import
CustomComponentForAPI
from
"
../../CustomComponentForAPI
"
;
import
React
,
{
Component
}
from
"
react
"
;
import
GenericGroupModules
from
"
../shared/GenericGroupModule
"
;
const
styles
=
theme
=>
({
// eslint-disable-line no-unused-vars
root
:
{},
});
class
CampusesCitiesTab
extends
CustomComponentForAPI
{
customRender
()
{
/**
* Tab on the university page related to Campuses and cities
*
* @class CampusesCitiesTab
* @extends {Component}
*/
class
CampusesCitiesTab
extends
Component
{
render
()
{
return
(
<
div
>
<
GenericGroupModules
groupTitle
=
{
"
Logement
"
}
/
>
<
GenericGroupModules
groupTitle
=
{
"
Vie étudiante
"
}
/
>
<
GenericGroupModules
groupTitle
=
{
"
Vie quotidienne (et transport)
"
}
/
>
<
GenericGroupModules
groupTitle
=
{
"
Autre chose ?
"
}
/
>
<
GenericGroupModules
groupTitle
=
{
"
Logement
"
}
/
>
<
GenericGroupModules
groupTitle
=
{
"
Vie étudiante
"
}
/
>
<
GenericGroupModules
groupTitle
=
{
"
Vie quotidienne (et transport)
"
}
/
>
<
GenericGroupModules
groupTitle
=
{
"
Autre chose ?
"
}
/
>
<
/div
>
);
}
}
// CampusesCitiesTab.propTypes = {
// classes: PropTypes.object.isRequired,
// univId: PropTypes.string.isRequired,
// };
export
default
withStyles
(
styles
)(
CampusesCitiesTab
);
export
default
CampusesCitiesTab
;
frontend/src/components/university/tabs/GeneralInfoTab.js
View file @
7266140c
import
React
from
"
react
"
;
import
React
,
{
Component
}
from
"
react
"
;
import
PropTypes
from
"
prop-types
"
;
import
withStyles
from
"
@material-ui/core/styles/withStyles
"
;
import
CustomComponentForAPI
from
"
../../CustomComponentForAPI
"
;
import
compose
from
"
recompose/compose
"
;
import
Grid
from
"
@material-ui/core/Grid
"
;
import
UniversityGeneral
from
"
../modules/UniversityGeneral
"
;
import
UniversitySemestersDates
from
"
../modules/UniversitySemestersDates
"
;
import
UniversityDri
from
"
../modules/UniversityDri
"
;
...
...
@@ -14,23 +12,16 @@ import CountryDri from "../modules/CountryDri";
import
withWidth
,
{
isWidthUp
}
from
"
@material-ui/core/withWidth
"
;
import
UnivInfoConsumer
from
"
../shared/UnivInfoConsumer
"
;
const
styles
=
theme
=>
({
// eslint-disable-line no-unused-vars
root1
:
{
display
:
"
flex
"
,
width
:
"
90%
"
,
marginLeft
:
"
auto
"
,
marginRight
:
"
auto
"
},
root2
:
{
display
:
"
flex
"
,
width
:
"
100%
"
},
});
class
GeneralInfoTab
extends
CustomComponentForAPI
{
/**
* Main tab of the university page
*
* @class GeneralInfoTab
* @extends {Component}
*/
class
GeneralInfoTab
extends
Component
{
customR
ender
()
{
r
ender
()
{
const
{
classes
,
theme
}
=
this
.
props
;
// Resizing with the grid was causing weird gaps so we rerender depending on the width
if
(
isWidthUp
(
"
lg
"
,
this
.
props
.
width
))
{
...
...
@@ -119,8 +110,21 @@ class GeneralInfoTab extends CustomComponentForAPI {
GeneralInfoTab
.
propTypes
=
{
classes
:
PropTypes
.
object
.
isRequired
,
theme
:
PropTypes
.
object
.
isRequired
,
width
:
PropTypes
.
any
// TODO better
};
const
styles
=
{
root1
:
{
display
:
"
flex
"
,
width
:
"
90%
"
,
marginLeft
:
"
auto
"
,
marginRight
:
"
auto
"
},
root2
:
{
display
:
"
flex
"
,
width
:
"
100%
"
},
};
export
default
compose
(
withWidth
({
noSSR
:
true
}),
...
...
frontend/src/components/university/tabs/MoreTab.js
View file @
7266140c
import
React
from
"
react
"
;
// import PropTypes from "prop-types";
import
withStyles
from
"
@material-ui/core/styles/withStyles
"
;
import
CustomComponentForAPI
from
"
../../CustomComponentForAPI
"
;
import
React
,
{
Component
}
from
"
react
"
;
import
GenericGroupModules
from
"
../shared/GenericGroupModule
"
;
// eslint-disable-next-line no-unused-vars
const
styles
=
theme
=>
({
root
:
{},
});
class
MoreTab
extends
CustomComponentForAPI
{
/**
* Tab on the university page containing "more" information
*
* @class MoreTab
* @extends {Component}
*/
class
MoreTab
extends
Component
{
customR
ender
()
{
r
ender
()
{
return
(
<
div
>
<
GenericGroupModules
groupTitle
=
{
"
Administratif
"
}
/
>
<
GenericGroupModules
groupTitle
=
{
"
Assurances
"
}
/
>
<
GenericGroupModules
groupTitle
=
{
"
Transport
"
}
/
>
<
GenericGroupModules
groupTitle
=
{
"
Culture
"
}
/
>
<
GenericGroupModules
groupTitle
=
{
"
Culture
"
}
/
>
<
GenericGroupModules
groupTitle
=
{
"
Tourisme
"
}
/
>
<
GenericGroupModules
groupTitle
=
{
"
Photos
"
}
/
>
<
GenericGroupModules
groupTitle
=
{
"
Autres
"
}
/
>
<
GenericGroupModules
groupTitle
=
{
"
Photos
"
}
/
>
<
GenericGroupModules
groupTitle
=
{
"
Autres
"
}
/
>
<
/div
>
);
}
}
// MoreTab.propTypes = {
// classes: PropTypes.object.isRequired,
// univId: PropTypes.string.isRequired,
// };
export
default
withStyles
(
styles
)(
MoreTab
);
export
default
MoreTab
;
frontend/src/components/university/tabs/PreviousDeparturesTab.js
View file @
7266140c
import
React
from
"
react
"
;
// import PropTypes from "prop-types";
import
withStyles
from
"
@material-ui/core/styles/withStyles
"
;
import
CustomComponentForAPI
from
"
../../CustomComponentForAPI
"
;
import
React
,
{
Component
}
from
"
react
"
;
import
PreviousDeparture
from
"
../modules/PreviousDeparture
"
;
import
GenericModule
from
"
../shared/GenericModule
"
;
const
styles
=
theme
=>
({
// eslint-disable-line no-unused-vars
root
:
{},
});
class
PreviousDeparturesTab
extends
CustomComponentForAPI
{
/**
* Tab on the university page containing information related to previous departure
*
* @class PreviousDeparturesTab
* @extends {Component}
*/
class
PreviousDeparturesTab
extends
Component
{
customR
ender
()
{
r
ender
()
{
return
(
<
GenericModule
title
=
"
Florent Chehab | GI05~FDD | Automne 2018~échange
"
>
<
PreviousDeparture
/>
...
...
@@ -22,9 +22,4 @@ class PreviousDeparturesTab extends CustomComponentForAPI {
}
// PreviousDeparturesTab.propTypes = {
// classes: PropTypes.object.isRequired,
// univId: PropTypes.string.isRequired,
// };
export
default
withStyles
(
styles
)(
PreviousDeparturesTab
);
export
default
PreviousDeparturesTab
;
frontend/src/components/university/tabs/ScholarshipsTab.js
View file @
7266140c
import
React
from
"
react
"
;
import
React
,
{
Component
}
from
"
react
"
;
import
PropTypes
from
"
prop-types
"
;
import
withStyles
from
"
@material-ui/core/styles/withStyles
"
;
import
CustomComponentForAPI
from
"
../../CustomComponentForAPI
"
;
import
compose
from
"
recompose/compose
"
;
import
Grid
from
"
@material-ui/core/Grid
"
;
import
UniversityScholarships
from
"
../modules/UniversityScholarships
"
;
import
CountryScholarships
from
"
../modules/CountryScholarships
"
;
import
UnivInfoConsumer
from
"
../shared/UnivInfoConsumer
"
;
const
styles
=
theme
=>
({
// eslint-disable-line no-unused-vars
root
:
{
display
:
"
flex
"
,
width
:
"
90%
"
,
marginLeft
:
"
auto
"
,
marginRight
:
"
auto
"
},
});
class
ScholarshipsTab
extends
CustomComponentForAPI
{
/**
* Tab on the university page containing information related to scholarship
*
* @class ScholarshipsTab
* @extends {Component}
*/
class
ScholarshipsTab
extends
Component
{
customR
ender
()
{
r
ender
()
{
const
{
classes
}
=
this
.
props
;
return
(
<
div
className
=
{
classes
.
root
}
>
...
...
@@ -51,10 +46,17 @@ class ScholarshipsTab extends CustomComponentForAPI {
ScholarshipsTab
.
propTypes
=
{
classes
:
PropTypes
.
object
.
isRequired
,
theme
:
PropTypes
.
object
.
isRequired
,
};
const
styles
=
{
root
:
{
display
:
"
flex
"
,
width
:
"
90%
"
,
marginLeft
:
"
auto
"
,
marginRight
:
"
auto
"
},
};
export
default
compose
(
withStyles
(
styles
,
{
withTheme
:
true
}
),
withStyles
(
styles
),
)(
ScholarshipsTab
);
frontend/src/components/university/tabs/UniversityMoreTab.js
View file @
7266140c
import
React
from
"
react
"
;
// import PropTypes from "prop-types";
import
withStyles
from
"
@material-ui/core/styles/withStyles
"
;
import
CustomComponentForAPI
from
"
../../CustomComponentForAPI
"
;
import
React
,
{
Component
}
from
"
react
"
;
import
GenericGroupModules
from
"
../shared/GenericGroupModule
"
;
const
styles
=
theme
=>
({
// eslint-disable-line no-unused-vars
});
class
UniversityMoreTab
extends
CustomComponentForAPI
{
customRender
()
{
/**
* Tab containing specific comments about the unviversity
*
* @class UniversityMoreTab
* @extends {Component}
*/
class
UniversityMoreTab
extends
Component
{
render
()
{
return
(
<
div
>
<
GenericGroupModules
groupTitle
=
{
"
Partenariats spécifiques
"
}
/
>
...
...
@@ -19,12 +19,7 @@ class UniversityMoreTab extends CustomComponentForAPI {
<
/div
>
);
}
}
// UniversityMoreTab.propTypes = {
// classes: PropTypes.object.isRequired,
// univId: PropTypes.string.isRequired,
// };
export
default
withStyles
(
styles
)(
UniversityMoreTab
)
;
export
default
UniversityMoreTab
;
frontend/src/reducers/filter.js
View file @
7266140c
/*
* This file contains the redux reducers related to the filter component
*/
import
{
SAVE_SELECTED_UNIVERSITIES
,
SAVE_FILTER_CONFIG
}
from
"
../actions/action-types
"
;
/**
* Reducer: Save the selected universities
*
* @export
* @param {array} [state=[]]
* @param {string} action
* @returns
*/
export
function
saveSelectedUniversities
(
state
=
[],
action
)
{
switch
(
action
.
type
)
{
case
SAVE_SELECTED_UNIVERSITIES
:
return
{
selection
:
action
.
new
_s
election
,
};
case
SAVE_SELECTED_UNIVERSITIES
:
return
{
selection
:
action
.
new
S
election
,
};
default
:
return
state
;
default
:
return
state
;
}
}
/**
* Reducer: Save the filter config
*
* @export
* @param {object} [state={ countriesFilter: { selectedItems: [], inputValue: "" } }]
* @param {string} action
* @returns
*/
export
function
saveFilterConfig
(
state
=
{
countriesFilter
:
{
selectedItems
:
[],
inputValue
:
""
}
},
action
)
{
switch
(
action
.
type
)
{
case
SAVE_FILTER_CONFIG
:
return
Object
.
assign
({},
state
,
action
.
config
);
case
SAVE_FILTER_CONFIG
:
return
Object
.
assign
({},
state
,
action
.
config
);
default
:
return
state
;
default
:
return
state
;
}
}
frontend/src/reducers/index.js
View file @
7266140c
import
{
combineReducers
}
from
"
redux
"
;
import
{
saveMainMapPosition
}
from
"
./map
"
;
import
{
saveSelectedUniversities
}
from
"
./filter
"
;
import
{
saveFilterConfig
}
from
"
./filter
"
;
import
{
saveMainMapStatus
}
from
"
./map
"
;
import
{
saveSelectedUniversities
,
saveFilterConfig
}
from
"
./filter
"
;
import
{
saveAppTheme
,
saveAppColorPicker
}
from
"
./theme
"
;
import
{
saveUniversityBeingViewed
}
from
"
./universityPage
"
;
import
{
apiReducers
}
from
"
../api/buildApiActionsAndReducers
"
;
// Combine the reducers related to the app
const
app
=
combineReducers
({
mainMap
:
saveMainMap
Position
,
mainMap
:
saveMainMap
Status
,
selectedUniversities
:
saveSelectedUniversities
,
filter
:
saveFilterConfig
,
appTheme
:
saveAppTheme
,
...
...
@@ -16,8 +16,10 @@ const app = combineReducers({
universityBeingViewed
:
saveUniversityBeingViewed
,
});
// Get the redux reducer for all api related stuff
const
api
=
combineReducers
(
apiReducers
);
// Create the final reduce reducer
const
rootReducer
=
combineReducers
({
api
,
app
...
...
frontend/src/reducers/map.js
View file @
7266140c
import
{
SAVE_MAIN_MAP_POSITION
}
from
"
../actions/action-types
"
;
/*
* This file contains the redux reducers related to the map component
*/
export
function
saveMainMapPosition
(
state
=
{
center
:
[
0
,
2
],
zoom
:
2
,
selected_layer
:
"
OpenStreetMap France
"
},
action
)
{
import
{
SAVE_MAIN_MAP_STATUS
}
from
"
../actions/action-types
"
;
/**
* Reducer: save map status/state
*
* @export
* @param {object} [state={ center: [0, 2], zoom: 2, selectedLayer: "OpenStreetMap France" }]
* @param {string} action
* @returns
*/
export
function
saveMainMapStatus
(
state
=
{
center
:
[
0
,
2
],
zoom
:
2
,
selectedLayer
:
"
OpenStreetMap France
"
},
action
)
{
switch
(
action
.
type
)
{
case
SAVE_MAIN_MAP_
POSITION
:
return
{
center
:
action
.
new
_position
.
center
,
zoom
:
action
.
new
_position
.
zoom
,
selected
_l
ayer
:
action
.
new
_position
.
selected
_l
ayer
};
case
SAVE_MAIN_MAP_
STATUS
:
return
{
center
:
action
.
new
Status
.
center
,
zoom
:
action
.
new
Status
.
zoom
,
selected
L
ayer
:
action
.
new
Status
.
selected
L
ayer
};
default
:
return
state
;
default
:
return
state
;
}
}
frontend/src/reducers/search.js
View file @
7266140c
import
{
SAVE_SELECTED_UNIVERSITIES
,
SAVE_FILTER_CONFIG
}
from
"
../actions/action-types
"
;
/*
* This file contains the redux reducers related to the search component
* TODO: check what is done in this file, seem not to be super coherent and a mix with filter
*/
export
function
saveSelectedUniversities
(
state
=
[],
action
)
{
switch
(
action
.
type
)
{
case
SAVE_SELECTED_UNIVERSITIES
:
return
{
selection
:
action
.
new_selection
,
};
// import { SAVE_SELECTED_UNIVERSITIES, SAVE_FILTER_CONFIG } from "../actions/action-types";
default
:
return
state
;
}
}
// /**
// * Reducer: save the selected universities
// *
// * @export
// * @param {array} [state=[]]
// * @param {string} action
// * @returns
// */
// export function saveSelectedUniversities(state = [], action) {
// switch (action.type) {
// case SAVE_SELECTED_UNIVERSITIES:
// return {
// selection: action.newSelection,
// };
export
function
saveFilterConfig
(
state
=
{
countriesFilter
:
{
selectedItems
:
[],
inputValue
:
""
}
},
action
)
{
switch
(
action
.
type
)
{
case
SAVE_FILTER_CONFIG
:
return
Object
.
assign
({},
state
,
action
.
config
);
// default:
// return state;
// }
// }
default
:
return
state
;
}
}
// export function saveFilterConfig(state = { countriesFilter: { selectedItems: [], inputValue: "" } }, action) {
// switch (action.type) {
// case SAVE_FILTER_CONFIG:
// return Object.assign({}, state, action.config);
// default:
// return state;
// }
// }
frontend/src/reducers/theme.js
View file @
7266140c
/*
* This file contains the redux reducers related to the theme provider and color picker components
*/
import
{
SAVE_APP_THEME
,
SAVE_APP_COLOR_PICKER
}
from
"
../actions/action-types
"
;
import
indigo
from
"
@material-ui/core/colors/indigo
"
;
import
pink
from
"
@material-ui/core/colors/pink
"
;
// Default theme applied to the site
const
defaultTheme
=
{
palette
:
{
primary
:
{
main
:
pink
[
500
]},
secondary
:
{
main
:
indigo
[
"
A400
"
]},
primary
:
{
main
:
pink
[
500
]
},
secondary
:
{
main
:
indigo
[
"
A400
"
]
},
type
:
"
dark
"
}
};
export
function
saveAppTheme
(
state
=
{
theme
:
defaultTheme
,
savedAt
:
Date
.
now
()
},
action
)
{
switch
(
action
.
type
)
{
case
SAVE_APP_THEME
:
return
{
theme
:
action
.
theme
,
savedAt
:
Date
.
now
()
};
default
:
return
state
;
}
}
// Default color picker state
const
defaultColorPicker
=
{
primary
:
defaultTheme
.
palette
.
primary
.
main
,
secondary
:
defaultTheme
.
palette
.
secondary
.
main
,
...
...
@@ -35,11 +27,41 @@ const defaultColorPicker = {
updatedAt
:
Date
.
now
()
};
/**
* Reducer: save app theme
*
* @export
* @param {object} [state={ theme: defaultTheme, savedAt: Date.now() }]
* @param {string} action
* @returns
*/
export
function
saveAppTheme
(
state
=
{
theme
:
defaultTheme
,
savedAt
:
Date
.
now
()
},
action
)
{
switch
(
action
.
type
)
{
case
SAVE_APP_THEME
:
return
{
theme
:
action
.
theme
,
savedAt
:
Date
.
now
()
};
default
:
return
state
;
}
}
/**
* Reducer: save the color picker state
*
* @export
* @param {object} [state=defaultColorPicker]
* @param {string} action
* @returns
*/
export
function
saveAppColorPicker
(
state
=
defaultColorPicker
,
action
)
{
switch
(
action
.
type
)
{