Commit 8f8234cb authored by Florent Chehab's avatar Florent Chehab

linting(front): activated react/jsx-indent-props

* Activated react/jsx-indent-props
* Reformatted code accordingly
Not that many changes were required actualy :)

Fixes #102
parent 12217100
Pipeline #38707 passed with stages
in 3 minutes and 19 seconds
......@@ -42,7 +42,7 @@ module.exports = {
"always"
],
"react/no-unescaped-entities": "off", // that one doesn't improve code readability
// "react/jsx-indent-props": [2, "first"],
"react/jsx-indent-props": [2, "first"],
"react/jsx-indent": [2, 2],
"react/prop-types": "error",
"react/no-deprecated": "error",
......
......@@ -17,7 +17,7 @@ import TextField from "./fields/TextField";
import MultiSelectField from "./fields/MultiSelectField";
import NumberField from "./fields/NumberField";
import { getLatestReadDataFromStore } from "../../redux/api/utils";
import {getLatestReadDataFromStore} from "../../redux/api/utils";
export default {
/**
......@@ -27,7 +27,7 @@ export default {
* @returns
*/
customizeProps(props) {
return Object.assign(props, { ...this.getReferenceAndValue(props.fieldMapping) });
return Object.assign(props, {...this.getReferenceAndValue(props.fieldMapping)});
},
renderObjModerationLevelField() {
......@@ -41,22 +41,23 @@ export default {
<SelectField label={"Niveau de modération pour ce module"}
{...this.getReferenceAndValue("obj_moderation_level")}
required={true}
options={possibleObjModeration}
/>
options={possibleObjModeration} />
</>
);
} else {
return (
<Typography variant='caption'>Votre statut ne vous permet pas modifier le niveau local de modération pour ce module.</Typography>
<Typography variant='caption'>
Votre statut ne vous permet pas modifier le niveau local de modération pour ce module.
</Typography>
);
}
},
renderImportanceLevelField() {
const options = [
{ "label": "Normal", "value": "-" },
{ "label": "Important", "value": "+" },
{ "label": "Très important", "value": "++" },
{"label": "Normal", "value": "-"},
{"label": "Important", "value": "+"},
{"label": "Très important", "value": "++"},
];
return (
......@@ -65,8 +66,7 @@ export default {
<SelectField label={"Niveau d'importance"}
{...this.getReferenceAndValue("importance_level")}
required={true}
options={options}
/>
options={options} />
</>
);
},
......@@ -74,8 +74,7 @@ export default {
renderUsefulLinksField() {
return (
<UsefulLinksField label={"Lien(s) utile(s) (ex : vers ces informations)"}
{...this.getReferenceAndValue("useful_links")}
/>
{...this.getReferenceAndValue("useful_links")} />
);
},
......@@ -113,32 +112,34 @@ export default {
},
renderUniversitiesField() {
const { outsideData } = this.props,
const {outsideData} = this.props,
universities = outsideData.universities.map(
(univ) => { return { label: univ.name, value: univ.id, disabled: false }; }
(univ) => {
return {label: univ.name, value: univ.id, disabled: false};
}
);
return (
<MultiSelectField label={"Universités concernées"}
{...this.getReferenceAndValue("universities")}
required={true}
options={universities}
/>
options={universities} />
);
},
renderCountriesField() {
const { outsideData } = this.props,
const {outsideData} = this.props,
countries = outsideData.countries.map(
(country) => { return { label: country.name, value: country.id, disabled: false }; }
(country) => {
return {label: country.name, value: country.id, disabled: false};
}
);
return (
<MultiSelectField label={"Pays concernés"}
{...this.getReferenceAndValue("countries")}
required={true}
options={countries}
/>
options={countries} />
);
},
......@@ -151,9 +152,11 @@ export default {
},
renderCurrencyField(props) {
const { outsideData } = this.props;
const {outsideData} = this.props;
const currencies = outsideData.currencies.map(
(c) => { return { label: c.code, value: c.code, disabled: false }; }
(c) => {
return {label: c.code, value: c.code, disabled: false};
}
);
return this.renderSelectField({
......
......@@ -2,17 +2,16 @@ import React from "react";
import PropTypes from "prop-types";
import withStyles from "@material-ui/core/styles/withStyles";
import { Paper } from "@material-ui/core";
import {Paper} from "@material-ui/core";
import Button from "@material-ui/core/Button";
import AddIcon from "@material-ui/icons/Add";
// import {compose} from "redux";
// import getActions from "../../redux/api/getActions";
// import {connect} from "react-redux";
import TextBlock from "../recommendation/TextBlock";
import UnivBlock from "../recommendation/UnivBlock";
import RecommendationEditor from "../recommendation/RecommendationEditor";
import CustomComponentForAPI from "../common/CustomComponentForAPI";
// import {compose} from "redux";
// import getActions from "../../redux/api/getActions";
// import {connect} from "react-redux";
// import editorStyle from "../university/editors/common/editorStyle.js";
......@@ -69,7 +68,7 @@ class Recommendation extends CustomComponentForAPI {
recommendationModelData = list;
return (
<Paper style={{ color: "white", margin: "1em", padding: "1em" }}>
<Paper style={{color: "white", margin: "1em", padding: "1em"}}>
<h2>
{list.name}
</h2>
......@@ -77,9 +76,9 @@ class Recommendation extends CustomComponentForAPI {
{list.public ? "Liste publique" : "liste privée"} créée par : {list.user}
</p>
<div id="Descriptive">
<TextBlock id={list.descriptive.id} type={list.descriptive.type} text={list.descriptive.text} />
<TextBlock id={list.descriptive.id} type={list.descriptive.type} text={list.descriptive.text}/>
</div>
{list.content.map((el, idx) => <div key={idx}> <UnivBlock univ={el} /> </div>)}
{list.content.map((el, idx) => <div key={idx}><UnivBlock univ={el}/></div>)}
<Button variant={"contained"}
color={"secondary"}
onClick={() => this.openEditorPanel()}>
......@@ -98,9 +97,7 @@ Recommendation.propTypes = {
list: PropTypes.object.isRequired,
};
Recommendation.defaultProps = {
};
Recommendation.defaultProps = {};
const styles = theme => ({
root: {
......@@ -119,4 +116,4 @@ const styles = theme => ({
},
});
export default withStyles(styles, { withTheme: true })(Recommendation);
export default withStyles(styles, {withTheme: true})(Recommendation);
import React from "react";
import withStyles from "@material-ui/core/styles/withStyles";
import compose from "recompose/compose";
import { connect } from "react-redux";
import {connect} from "react-redux";
import Editor from "../../editor/Editor";
import Form from "../../form/Form";
......@@ -9,7 +9,7 @@ import editorStyle from "../../editor/editorStyle";
import getMapStateToPropsForEditor from "../../editor/getMapStateToPropsForEditor";
import getMapDispatchToPropsForEditor from "../../editor/getMapDispatchToPropsForEditor";
import { withSnackbar } from "notistack";
import {withSnackbar} from "notistack";
import TextField from "../../form/fields/TextField";
......@@ -25,23 +25,22 @@ class UniversityGeneralForm extends Form {
<TextField label={"Nom de l'université"}
{...this.getReferenceAndValue("name")}
required={true}
maxLength={200}
/>
maxLength={200}/>
<TextField label={"Acronyme de l'université"}
{...this.getReferenceAndValue("acronym")}
maxLength={20}
/>
maxLength={20}/>
<TextField label={"Site internet de l'université"}
{...this.getReferenceAndValue("website")}
maxLength={300}
isUrl={true}
/>
isUrl={true}/>
<TextField label={"Logo de l'université"}
{...this.getReferenceAndValue("logo")}
maxLength={300}
isUrl={true}
urlExtensions={["jpg", "png", "svg"]}
/>
urlExtensions={["jpg", "png", "svg"]}/>
</>
);
}
......@@ -60,7 +59,7 @@ class UniversityGeneralEditor extends Editor {
export default compose(
withSnackbar,
withStyles(styles, { withTheme: true }),
withStyles(styles, {withTheme: true}),
connect(
getMapStateToPropsForEditor("universities"),
getMapDispatchToPropsForEditor("universities")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment