Commit 7266140c authored by Florent Chehab's avatar Florent Chehab
Browse files

Merge branch 'cleaning' into 'master'

Cleaning

See merge request !50
parents 0e42118e 4fe1bdf2
...@@ -19,17 +19,7 @@ import Typography from "@material-ui/core/Typography"; ...@@ -19,17 +19,7 @@ import Typography from "@material-ui/core/Typography";
import isUrl from "../../../../utils/isUrl"; 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 { class UsefulLinksField extends Field {
...@@ -239,6 +229,18 @@ UsefulLinksField.propTypes = { ...@@ -239,6 +229,18 @@ UsefulLinksField.propTypes = {
descriptionMaxLength: PropTypes.number.isRequired descriptionMaxLength: PropTypes.number.isRequired
}; };
const styles = {
container: {
display: "flex",
flexWrap: "wrap",
},
usefulLinkContainer: {
display: "flex",
flexWrap: "wrap",
}
};
export default compose( export default compose(
withStyles(styles, { withTheme: true }), withStyles(styles, { withTheme: true }),
)(UsefulLinksField); )(UsefulLinksField);
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 GenericGroupModules from "../shared/GenericGroupModule"; import GenericGroupModules from "../shared/GenericGroupModule";
const styles = theme => ({ // eslint-disable-line no-unused-vars /**
root: {}, * Tab on the university page related to Campuses and cities
}); *
* @class CampusesCitiesTab
class CampusesCitiesTab extends CustomComponentForAPI { * @extends {Component}
*/
customRender() { class CampusesCitiesTab extends Component {
render() {
return ( return (
<div> <div>
<GenericGroupModules groupTitle={"Logement"}/> <GenericGroupModules groupTitle={"Logement"} />
<GenericGroupModules groupTitle={"Vie étudiante"}/> <GenericGroupModules groupTitle={"Vie étudiante"} />
<GenericGroupModules groupTitle={"Vie quotidienne (et transport)"}/> <GenericGroupModules groupTitle={"Vie quotidienne (et transport)"} />
<GenericGroupModules groupTitle={"Autre chose ?"}/> <GenericGroupModules groupTitle={"Autre chose ?"} />
</div> </div>
); );
} }
} }
// CampusesCitiesTab.propTypes = { export default CampusesCitiesTab;
// classes: PropTypes.object.isRequired,
// univId: PropTypes.string.isRequired,
// };
export default withStyles(styles)(CampusesCitiesTab);
import React from "react"; import React, { Component } from "react";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import withStyles from "@material-ui/core/styles/withStyles"; import withStyles from "@material-ui/core/styles/withStyles";
import CustomComponentForAPI from "../../CustomComponentForAPI";
import compose from "recompose/compose"; import compose from "recompose/compose";
import Grid from "@material-ui/core/Grid"; import Grid from "@material-ui/core/Grid";
import UniversityGeneral from "../modules/UniversityGeneral"; import UniversityGeneral from "../modules/UniversityGeneral";
import UniversitySemestersDates from "../modules/UniversitySemestersDates"; import UniversitySemestersDates from "../modules/UniversitySemestersDates";
import UniversityDri from "../modules/UniversityDri"; import UniversityDri from "../modules/UniversityDri";
...@@ -14,23 +12,16 @@ import CountryDri from "../modules/CountryDri"; ...@@ -14,23 +12,16 @@ import CountryDri from "../modules/CountryDri";
import withWidth, { isWidthUp } from "@material-ui/core/withWidth"; import withWidth, { isWidthUp } from "@material-ui/core/withWidth";
import UnivInfoConsumer from "../shared/UnivInfoConsumer"; 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 {
customRender() { render() {
const { classes, theme } = this.props; const { classes, theme } = this.props;
// Resizing with the grid was causing weird gaps so we rerender depending on the width // Resizing with the grid was causing weird gaps so we rerender depending on the width
if (isWidthUp("lg", this.props.width)) { if (isWidthUp("lg", this.props.width)) {
...@@ -119,8 +110,21 @@ class GeneralInfoTab extends CustomComponentForAPI { ...@@ -119,8 +110,21 @@ class GeneralInfoTab extends CustomComponentForAPI {
GeneralInfoTab.propTypes = { GeneralInfoTab.propTypes = {
classes: PropTypes.object.isRequired, classes: PropTypes.object.isRequired,
theme: 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( export default compose(
withWidth({ noSSR: true }), withWidth({ noSSR: true }),
......
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 GenericGroupModules from "../shared/GenericGroupModule"; 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 {
customRender() { render() {
return ( return (
<div> <div>
<GenericGroupModules groupTitle={"Administratif"} /> <GenericGroupModules groupTitle={"Administratif"} />
<GenericGroupModules groupTitle={"Assurances"} /> <GenericGroupModules groupTitle={"Assurances"} />
<GenericGroupModules groupTitle={"Transport"} /> <GenericGroupModules groupTitle={"Transport"} />
<GenericGroupModules groupTitle={"Culture"}/> <GenericGroupModules groupTitle={"Culture"} />
<GenericGroupModules groupTitle={"Tourisme"} /> <GenericGroupModules groupTitle={"Tourisme"} />
<GenericGroupModules groupTitle={"Photos"}/> <GenericGroupModules groupTitle={"Photos"} />
<GenericGroupModules groupTitle={"Autres"}/> <GenericGroupModules groupTitle={"Autres"} />
</div> </div>
); );
} }
} }
// MoreTab.propTypes = { export default MoreTab;
// classes: PropTypes.object.isRequired,
// univId: PropTypes.string.isRequired,
// };
export default withStyles(styles)(MoreTab);
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 PreviousDeparture from "../modules/PreviousDeparture"; import PreviousDeparture from "../modules/PreviousDeparture";
import GenericModule from "../shared/GenericModule"; 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 {
customRender() { render() {
return ( return (
<GenericModule title="Florent Chehab | GI05~FDD | Automne 2018~échange"> <GenericModule title="Florent Chehab | GI05~FDD | Automne 2018~échange">
<PreviousDeparture /> <PreviousDeparture />
...@@ -22,9 +22,4 @@ class PreviousDeparturesTab extends CustomComponentForAPI { ...@@ -22,9 +22,4 @@ class PreviousDeparturesTab extends CustomComponentForAPI {
} }
// PreviousDeparturesTab.propTypes = { export default PreviousDeparturesTab;
// classes: PropTypes.object.isRequired,
// univId: PropTypes.string.isRequired,
// };
export default withStyles(styles)(PreviousDeparturesTab);
import React from "react"; import React, { Component } from "react";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import withStyles from "@material-ui/core/styles/withStyles"; import withStyles from "@material-ui/core/styles/withStyles";
import CustomComponentForAPI from "../../CustomComponentForAPI";
import compose from "recompose/compose"; import compose from "recompose/compose";
import Grid from "@material-ui/core/Grid"; import Grid from "@material-ui/core/Grid";
import UniversityScholarships from "../modules/UniversityScholarships"; import UniversityScholarships from "../modules/UniversityScholarships";
import CountryScholarships from "../modules/CountryScholarships"; import CountryScholarships from "../modules/CountryScholarships";
import UnivInfoConsumer from "../shared/UnivInfoConsumer"; 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 {
customRender() { render() {
const { classes } = this.props; const { classes } = this.props;
return ( return (
<div className={classes.root}> <div className={classes.root}>
...@@ -51,10 +46,17 @@ class ScholarshipsTab extends CustomComponentForAPI { ...@@ -51,10 +46,17 @@ class ScholarshipsTab extends CustomComponentForAPI {
ScholarshipsTab.propTypes = { ScholarshipsTab.propTypes = {
classes: PropTypes.object.isRequired, classes: PropTypes.object.isRequired,
theme: PropTypes.object.isRequired,
}; };
const styles = {
root: {
display: "flex",
width: "90%",
marginLeft: "auto",
marginRight: "auto"
},
};
export default compose( export default compose(
withStyles(styles, { withTheme: true }), withStyles(styles),
)(ScholarshipsTab); )(ScholarshipsTab);
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 GenericGroupModules from "../shared/GenericGroupModule"; 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 ( return (
<div> <div>
<GenericGroupModules groupTitle={"Partenariats spécifiques"} /> <GenericGroupModules groupTitle={"Partenariats spécifiques"} />
...@@ -19,12 +19,7 @@ class UniversityMoreTab extends CustomComponentForAPI { ...@@ -19,12 +19,7 @@ class UniversityMoreTab extends CustomComponentForAPI {
</div> </div>
); );
} }
} }
// UniversityMoreTab.propTypes = {
// classes: PropTypes.object.isRequired,
// univId: PropTypes.string.isRequired,
// };
export default withStyles(styles)(UniversityMoreTab); export default UniversityMoreTab;
/*
* This file contains the redux reducers related to the filter component
*/
import { SAVE_SELECTED_UNIVERSITIES, SAVE_FILTER_CONFIG } from "../actions/action-types"; 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) { export function saveSelectedUniversities(state = [], action) {
switch (action.type) { switch (action.type) {
case SAVE_SELECTED_UNIVERSITIES: case SAVE_SELECTED_UNIVERSITIES:
return { return {
selection: action.new_selection, selection: action.newSelection,
}; };
default: default:
return state; 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) { export function saveFilterConfig(state = { countriesFilter: { selectedItems: [], inputValue: "" } }, action) {
switch (action.type) { switch (action.type) {
case SAVE_FILTER_CONFIG: case SAVE_FILTER_CONFIG:
return Object.assign({}, state, action.config); return Object.assign({}, state, action.config);
default: default:
return state; return state;
} }
} }
import { combineReducers } from "redux"; import { combineReducers } from "redux";
import { saveMainMapPosition } from "./map"; import { saveMainMapStatus } from "./map";
import { saveSelectedUniversities } from "./filter"; import { saveSelectedUniversities, saveFilterConfig } from "./filter";
import { saveFilterConfig } from "./filter";
import { saveAppTheme, saveAppColorPicker } from "./theme"; import { saveAppTheme, saveAppColorPicker } from "./theme";
import { saveUniversityBeingViewed } from "./universityPage"; import { saveUniversityBeingViewed } from "./universityPage";
import { apiReducers } from "../api/buildApiActionsAndReducers"; import { apiReducers } from "../api/buildApiActionsAndReducers";
// Combine the reducers related to the app
const app = combineReducers({ const app = combineReducers({
mainMap: saveMainMapPosition, mainMap: saveMainMapStatus,
selectedUniversities: saveSelectedUniversities, selectedUniversities: saveSelectedUniversities,
filter: saveFilterConfig, filter: saveFilterConfig,
appTheme: saveAppTheme, appTheme: saveAppTheme,
...@@ -16,8 +16,10 @@ const app = combineReducers({ ...@@ -16,8 +16,10 @@ const app = combineReducers({
universityBeingViewed: saveUniversityBeingViewed, universityBeingViewed: saveUniversityBeingViewed,
}); });
// Get the redux reducer for all api related stuff
const api = combineReducers(apiReducers); const api = combineReducers(apiReducers);
// Create the final reduce reducer
const rootReducer = combineReducers({ const rootReducer = combineReducers({
api, api,
app app
......
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) { switch (action.type) {
case SAVE_MAIN_MAP_POSITION: case SAVE_MAIN_MAP_STATUS:
return { return {
center: action.new_position.center, center: action.newStatus.center,
zoom: action.new_position.zoom, zoom: action.newStatus.zoom,
selected_layer: action.new_position.selected_layer selectedLayer: action.newStatus.selectedLayer
}; };
default: default:
return state; return state;
} }
} }
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) { // import { SAVE_SELECTED_UNIVERSITIES, SAVE_FILTER_CONFIG } from "../actions/action-types";
switch (action.type) {
case SAVE_SELECTED_UNIVERSITIES:
return {
selection: action.new_selection,
};
default: // /**
return state; // * Reducer: save the selected universities
} // *
}