Skip to content

Commit

Permalink
[BRG-545] add eBTC/eETH currencies to select (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
kilochytsky-ppl authored and doomdabidon committed Jan 11, 2020
1 parent 750681b commit af068ec
Showing 1 changed file with 11 additions and 23 deletions.
34 changes: 11 additions & 23 deletions src/components/WidgetForm/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,32 +19,19 @@ export default class WidgetForm extends Component {
},
options: [
{
label: 'Tokens',
label: 'Assets',
options: [
{
label: 'ECHO',
id: '1.3.0',
},
{
label: 'BST',
id: '1.3.5',
},
].map((option) => ({
value: option.label,
label: option.label,
id: option.id,
})),
},
{
label: 'Assets',
options: [
{
label: 'ECHO',
id: '1.3.0',
label: 'EETH',
id: '1.3.1',
},
{
label: 'PST',
id: '1.3.5',
label: 'EBTC',
id: '1.3.2',
},
].map((option) => ({
value: option.label,
Expand All @@ -53,7 +40,7 @@ export default class WidgetForm extends Component {
})),
},
],
selectedOptionId: 0,
currencyId: '0',
}

onAccountChange = (e) => {
Expand Down Expand Up @@ -88,8 +75,9 @@ export default class WidgetForm extends Component {
}

onSelectChange=(optionSelected) => {
const id = optionSelected.id.split('.')[2];
this.setState({
selectedOptionId: optionSelected.id,
currencyId: id,
});
}

Expand Down Expand Up @@ -122,9 +110,9 @@ export default class WidgetForm extends Component {
},
});
} else {
const { account: { value: accountValue }, amount: { value: amountValue }, selectedOptionId } = this.state;
const { account: { value: accountValue }, amount: { value: amountValue }, currencyId } = this.state;
this.setState({
generatedWidget: `${URL_BASE_PATH}${accountValue}/asset-${selectedOptionId}/${amountValue || null}/widget`,
generatedWidget: `${URL_BASE_PATH}${accountValue}/asset-${currencyId}/${amountValue || null}/widget`,
});
}
}
Expand Down Expand Up @@ -158,7 +146,7 @@ export default class WidgetForm extends Component {
onBlur={this.removeAmountError}
/>
<div className="search-select-wrap">
<SearchSelect options={this.state.options} onChange={this.onSelectChange} isDisabled />
<SearchSelect options={this.state.options} onChange={this.onSelectChange} />
</div>
{
this.state.generatedWidget &&
Expand Down

0 comments on commit af068ec

Please sign in to comment.