1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00
metamask-extension/ui/app/pages/send
Mark Stacey ba25d52670
Use AdvancedGasInputs in AdvancedTabContent (#7186)
* Use `AdvancedGasInputs` in `AdvancedTabContent`

The `AdvancedGasInputs` component was originally extracted from the
`AdvancedTabContent` component, duplicating much of the rendering
logic. They have since evolved separately, with bugs being fixed in one
place but not the other.

The inputs and outputs expected weren't exactly the same, as the
`AdvancedGasInputs` component converts the input custom gas price and
limit, and it converts them both in the setter methods as well.
The `GasModalPageContainer` had to be adjusted to avoid converting
these values multiple times.

Both components dealt with input debouncing separately, both in less
than ideal ways. `AdvancedTabContent` didn't debounce either field, but
it did debounce the check for whether the gas limit field was below the
minimum value. So if a less-than-minimum value was set, it would be
propogated upwards and could be saved if the user clicked 'Save'
quickly enough. After a second delay it would snap back to the minimum
value. The `AdvancedGasInputs` component debounced both fields, but
it would replace any gas limit below the minimum with the minimum
value. This led to a problem where a brief pause during typing would
reset the field to 21000.

The `AdvancedGasInputs` approach was chosen, except that it was
updated to no longer change the gas limit if it was below the minimum.
Instead it displays an error. Parent components were checked to ensure
they would detect the error case of the gas limit being set too low,
and prevent the form submission in those cases. Of the three parents,
one had already dealt with it correctly, one needed to convert the
gas limit from hex first, and another needed the gas limit check added.

Closes #6872

* Cleanup send components

Empty README files have been removed, and a mistake in the index file
for the send page has been corrected. The Gas Slider component class
name was updated as well; it looks like it was originally created from
`AdvancedTabContent`, so it still had that class name.
2019-10-23 09:23:15 -03:00
..
account-list-item Use AdvancedGasInputs in AdvancedTabContent (#7186) 2019-10-23 09:23:15 -03:00
send-content Use AdvancedGasInputs in AdvancedTabContent (#7186) 2019-10-23 09:23:15 -03:00
send-footer Use AdvancedGasInputs in AdvancedTabContent (#7186) 2019-10-23 09:23:15 -03:00
send-header Use AdvancedGasInputs in AdvancedTabContent (#7186) 2019-10-23 09:23:15 -03:00
tests address book entries by chainId (#7205) 2019-09-21 14:36:05 -03:00
to-autocomplete Right-to-left CSS (using module for conversion) (#7072) 2019-09-03 14:47:54 -03:00
index.js Add token selection to the send screen (#6445) 2019-04-17 16:45:13 -02:30
send.component.js Ensure correct tx category when sending to contracts without tx data (#7252) 2019-10-08 04:29:37 +09:00
send.constants.js Fix e2e tests and gas default (#7267) 2019-10-08 14:14:20 -03:00
send.container.js Use AdvancedGasInputs in AdvancedTabContent (#7186) 2019-10-23 09:23:15 -03:00
send.scss Right-to-left CSS (using module for conversion) (#7072) 2019-09-03 14:47:54 -03:00
send.selectors.js Remove unused components (#7191) 2019-09-18 18:41:36 -03:00
send.utils.js Fix e2e tests and gas default (#7267) 2019-10-08 14:14:20 -03:00
to-autocomplete.component.js Enable indent linting via ESLint (#6936) 2019-07-31 10:17:11 -10:00