Skip to content

Commit

Permalink
remove code smells
Browse files Browse the repository at this point in the history
  • Loading branch information
BulotF committed Oct 11, 2023
1 parent 093a01e commit 1936179
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 28 deletions.
43 changes: 22 additions & 21 deletions src/widgets/codes-lists/components/codes-lists.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,16 @@ function getSelectorOptions(panels) {
export const propTypes = {
selectorPath: PropTypes.string.isRequired,
selectorPathParent: PropTypes.string.isRequired,
path: PropTypes.string.isRequired,
formName: PropTypes.string.isRequired,
activePanel: PropTypes.string,
path: PropTypes.string.isRequired,
currentId: PropTypes.string,
codesListsStore: PropTypes.object,
currentCodesListsStore: PropTypes.object,
codesListsStore: PropTypes.object,
isSearchDisable: PropTypes.bool.isRequired,
activePanel: PropTypes.string,
clearSearchResult: PropTypes.func.isRequired,
change: PropTypes.func.isRequired,
arrayPush: PropTypes.func.isRequired,
arrayRemoveAll: PropTypes.func.isRequired,
clearSearchResult: PropTypes.func.isRequired,
};

export const defaultProps = {
Expand All @@ -57,22 +57,20 @@ export const defaultProps = {
currentCodesListsStore: {},
};

const CodesList = props => {
const {
change,
arrayRemoveAll,
formName,
path,
currentId,
codesListsStore,
clearSearchResult,
selectorPathParent,
selectorPath,
activePanel,
currentCodesListsStore,
isSearchDisable,
} = props;

const CodesList = ({
selectorPath,
selectorPathParent,
formName,
path,
currentId,
currentCodesListsStore,
codesListsStore,
isSearchDisable,
activePanel,
clearSearchResult,
change,
arrayRemoveAll,
}) => {
const refDiv = useRef(null);
const [currentIdState, setCurrentIdState] = useState(currentId);

Expand Down Expand Up @@ -206,4 +204,7 @@ const CodesList = props => {
);
};

CodesList.propTypes = propTypes;
CodesList.defaultProps = defaultProps;

export default CodesList;
1 change: 1 addition & 0 deletions src/widgets/codes-lists/components/suggester-lists.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ SuggesterLists.propTypes = {
path: PropTypes.string.isRequired,
codesListsStore: PropTypes.object,
loadNomenclaturesIfNeeded: PropTypes.func.isRequired,
loadNomenclature: PropTypes.func.isRequired,
token: PropTypes.string,
nomenclatures: PropTypes.object,
selectorPath: PropTypes.string.isRequired,
Expand Down
8 changes: 1 addition & 7 deletions src/widgets/codes-lists/containers/codes-lists-container.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import {
formValueSelector,
arrayPush,
arrayRemoveAll,
change,
} from 'redux-form';
import { formValueSelector, arrayRemoveAll, change } from 'redux-form';
import CodesLists from '../components/codes-lists';

import { getCurrentSelectorPath } from 'utils/widget-utils';
Expand Down Expand Up @@ -75,7 +70,6 @@ export const mapStateToProps = (
const mapDispatchToProps = {
clearSearchResult,
change: change,
arrayPush: arrayPush,
arrayRemoveAll: arrayRemoveAll,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ ResponseFormatSingle.propTypes = {
showMandatory: PropTypes.bool,
componentsStore: PropTypes.object,
collectedVariablesStore: PropTypes.object,
visHint: PropTypes.string,
path: PropTypes.string,
formName: PropTypes.string,
};

Expand All @@ -181,6 +183,8 @@ ResponseFormatSingle.defaultProps = {
showMandatory: true,
componentsStore: {},
collectedVariablesStore: {},
visHint: undefined,
path: SINGLE_CHOICE,
formName: DEFAULT_FORM_NAME,
};

Expand Down

0 comments on commit 1936179

Please sign in to comment.