Merge pull request #290 from status-im/fix/zero-cost-offer
Fix small stuff
This commit is contained in:
commit
62e13bbc82
|
@ -11,17 +11,25 @@ class BackButton extends Component {
|
||||||
hidden: null
|
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) {
|
componentDidUpdate(prevProps) {
|
||||||
if (this.state.hidden === null || prevProps.location.pathname !== this.props.location.pathname) {
|
if (this.state.hidden === null || prevProps.location.pathname !== this.props.location.pathname) {
|
||||||
const hidden = !!BLACK_LIST.find(blackListedLink => {
|
this.checkLocation();
|
||||||
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});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ import {FormGroup, InputGroup, InputGroupAddon, InputGroupText, Col, Row} from '
|
||||||
import Input from 'react-validation/build/input';
|
import Input from 'react-validation/build/input';
|
||||||
import {withNamespaces} from 'react-i18next';
|
import {withNamespaces} from 'react-i18next';
|
||||||
import Form from 'react-validation/build/form';
|
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 Slider from 'rc-slider/lib/Slider';
|
||||||
import 'rc-slider/assets/index.css';
|
import 'rc-slider/assets/index.css';
|
||||||
import './MarginSelectorForm.scss';
|
import './MarginSelectorForm.scss';
|
||||||
|
@ -29,8 +29,8 @@ class MarginSelectorForm extends Component {
|
||||||
<h2>{t('sellerMarginContainer.title')}</h2>
|
<h2>{t('sellerMarginContainer.title')}</h2>
|
||||||
<FormGroup className="mb-0">
|
<FormGroup className="mb-0">
|
||||||
<Row>
|
<Row>
|
||||||
<Col xs={9}>
|
<Col md={9} sm={8} xs={7}>
|
||||||
<Slider className="mb-3 p-4" min={-100} max={100} defaultValue={0}
|
<Slider className="mb-3 p-4" min={-99} max={100} defaultValue={0}
|
||||||
onChange={(value) => this.onMarginChange(value)} value={margin}/>
|
onChange={(value) => this.onMarginChange(value)} value={margin}/>
|
||||||
</Col>
|
</Col>
|
||||||
<Col>
|
<Col>
|
||||||
|
@ -42,7 +42,7 @@ class MarginSelectorForm extends Component {
|
||||||
className="form-control prepend"
|
className="form-control prepend"
|
||||||
value={margin}
|
value={margin}
|
||||||
onChange={(e) => this.onMarginChange(e.target.value)}
|
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)]}/>
|
||||||
<InputGroupAddon addonType="append"><InputGroupText>%</InputGroupText></InputGroupAddon>
|
<InputGroupAddon addonType="append"><InputGroupText>%</InputGroupText></InputGroupAddon>
|
||||||
</InputGroup>
|
</InputGroup>
|
||||||
</Col>
|
</Col>
|
||||||
|
|
|
@ -11,6 +11,8 @@ exports[`MarginSelectorForm should render correctly 1`] = `
|
||||||
tag="div"
|
tag="div"
|
||||||
>
|
>
|
||||||
<Col
|
<Col
|
||||||
|
md={9}
|
||||||
|
sm={8}
|
||||||
tag="div"
|
tag="div"
|
||||||
widths={
|
widths={
|
||||||
Array [
|
Array [
|
||||||
|
@ -21,7 +23,7 @@ exports[`MarginSelectorForm should render correctly 1`] = `
|
||||||
"xl",
|
"xl",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
xs={9}
|
xs={7}
|
||||||
>
|
>
|
||||||
<ComponentEnhancer(undefined)
|
<ComponentEnhancer(undefined)
|
||||||
activeDotStyle={Object {}}
|
activeDotStyle={Object {}}
|
||||||
|
@ -39,7 +41,7 @@ exports[`MarginSelectorForm should render correctly 1`] = `
|
||||||
included={true}
|
included={true}
|
||||||
marks={Object {}}
|
marks={Object {}}
|
||||||
max={100}
|
max={100}
|
||||||
min={-100}
|
min={-99}
|
||||||
onAfterChange={[Function]}
|
onAfterChange={[Function]}
|
||||||
onBeforeChange={[Function]}
|
onBeforeChange={[Function]}
|
||||||
onChange={[Function]}
|
onChange={[Function]}
|
||||||
|
|
|
@ -52,7 +52,7 @@ class Margin extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
validate(margin) {
|
validate(margin) {
|
||||||
if ((margin || margin === 0) && margin <= 100 && margin >= -100) {
|
if ((margin || margin === 0) && margin <= 100 && margin > -100) {
|
||||||
return this.props.footer.enableNext();
|
return this.props.footer.enableNext();
|
||||||
}
|
}
|
||||||
this.props.footer.disableNext();
|
this.props.footer.disableNext();
|
||||||
|
|
Loading…
Reference in New Issue