diff --git a/src/js/ui/BackButton/index.jsx b/src/js/ui/BackButton/index.jsx index 01708218..d54dcb73 100644 --- a/src/js/ui/BackButton/index.jsx +++ b/src/js/ui/BackButton/index.jsx @@ -11,17 +11,25 @@ class BackButton extends Component { hidden: null }; + componentDidMount() { + this.checkLocation(); + } + + checkLocation() { + const hidden = !!BLACK_LIST.find(blackListedLink => { + const starIndex = blackListedLink.indexOf('*'); + if (starIndex > -1) { + blackListedLink = blackListedLink.substring(0, starIndex); + return this.props.location.pathname.startsWith(blackListedLink); + } + return BLACK_LIST.includes(this.props.location.pathname); + }); + this.setState({hidden}); + } + componentDidUpdate(prevProps) { if (this.state.hidden === null || prevProps.location.pathname !== this.props.location.pathname) { - const hidden = !!BLACK_LIST.find(blackListedLink => { - const starIndex = blackListedLink.indexOf('*'); - if (starIndex > -1) { - blackListedLink = blackListedLink.substring(0, starIndex); - return this.props.location.pathname.startsWith(blackListedLink); - } - return BLACK_LIST.includes(this.props.location.pathname); - }); - this.setState({hidden}); + this.checkLocation(); } } diff --git a/src/js/wizards/Sell/6_Margin/components/MarginSelectorForm.jsx b/src/js/wizards/Sell/6_Margin/components/MarginSelectorForm.jsx index 9395cceb..1ee5fc9e 100644 --- a/src/js/wizards/Sell/6_Margin/components/MarginSelectorForm.jsx +++ b/src/js/wizards/Sell/6_Margin/components/MarginSelectorForm.jsx @@ -5,7 +5,7 @@ import {FormGroup, InputGroup, InputGroupAddon, InputGroupText, Col, Row} from ' import Input from 'react-validation/build/input'; import {withNamespaces} from 'react-i18next'; import Form from 'react-validation/build/form'; -import {isNumber, required, lowerEqThan, higherEqThan} from '../../../../validators'; +import {isNumber, required, lowerEqThan, higherThan} from '../../../../validators'; import Slider from 'rc-slider/lib/Slider'; import 'rc-slider/assets/index.css'; import './MarginSelectorForm.scss'; @@ -29,8 +29,8 @@ class MarginSelectorForm extends Component {

{t('sellerMarginContainer.title')}

- - + this.onMarginChange(value)} value={margin}/> @@ -42,7 +42,7 @@ class MarginSelectorForm extends Component { className="form-control prepend" value={margin} onChange={(e) => this.onMarginChange(e.target.value)} - validations={[required, isNumber, lowerEqThan.bind(null, 100), higherEqThan.bind(null, -100)]}/> + validations={[required, isNumber, lowerEqThan.bind(null, 100), higherThan.bind(null, -100)]}/> % diff --git a/src/js/wizards/Sell/6_Margin/components/__snapshots__/MarginSelectorForm.test.jsx.snap b/src/js/wizards/Sell/6_Margin/components/__snapshots__/MarginSelectorForm.test.jsx.snap index e6e5f793..4c5b5807 100644 --- a/src/js/wizards/Sell/6_Margin/components/__snapshots__/MarginSelectorForm.test.jsx.snap +++ b/src/js/wizards/Sell/6_Margin/components/__snapshots__/MarginSelectorForm.test.jsx.snap @@ -11,6 +11,8 @@ exports[`MarginSelectorForm should render correctly 1`] = ` tag="div" > = -100) { + if ((margin || margin === 0) && margin <= 100 && margin > -100) { return this.props.footer.enableNext(); } this.props.footer.disableNext();