1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-23 03:36:18 +02:00
Commit Graph

3605 Commits

Author SHA1 Message Date
Mark Stacey
12536aa47f
Remove unused isPopup state (#8280)
This property was being set upon each change to background state.
2020-04-01 20:01:47 -03:00
Mark Stacey
44effa0d91
Replace METAMASK_UI_TYPE global with helper function (#8279)
We don't need to store the current UI type as a global. We're already
using the `getEnvironmentType` helper function throughout the UI, so
we'd might as well use that instead of this global state.
2020-04-01 19:28:10 -03:00
Mark Stacey
043ed6cbdb
Restore History title on wide viewport (#8277)
The `History` title above the transaction history was changed in #8264
to only show when there are pending transactions, because it was
redundant to show an additional `History` title below a tab called
`History`. It was preserved when there were pending transactions
because the pending transactions are shown first in the list, followed
by the history, so the title served to divide the two lists.

This ended up breaking the fullscreen view though, which doesn't use
tabs yet. It has been updated to always show on fullscreen.
2020-04-01 18:11:50 -03:00
Whymarrh Whitby
6b6615be27
Enable react/jsx-first-prop-new-line for multiline, single prop JSX (#8276)
* Enable react/jsx-first-prop-new-line for multiline, single prop JSX
* yarn lint --fix
2020-04-01 18:08:19 -02:30
Whymarrh Whitby
8459e8dda1
Don't render the ConnectedStatusIndicator outside of the popup (#8275) 2020-04-01 17:11:42 -02:30
Dan J Miller
d1cd2bb618
Fix centering of account info in menu bar (#8274) 2020-04-01 17:11:26 -02:30
Whymarrh Whitby
7b9e209174
Split AccountDetailsDropdown into container and component files (#8273) 2020-04-01 16:45:35 -02:30
Dan J Miller
3f38451f3e
Connected status indicator (#8270)
Co-authored-by: Whymarrh Whitby <whymarrh.whitby@gmail.com>
2020-04-01 16:14:59 -02:30
Mark Stacey
cb0ab90c84
Move asset list to home tab on small screens (#8264)
Two tabs have been created on the home screen: 'Assets' and 'History'.
This tabbed view is shown only on small screens (e.g. in the popup).
The fullscreen view is unchanged.

The toggle-able left sidebar no longer exists, so some 'sidebar-left'
specific code and styles have been removed. The button in the menu bar
has been removed as well.

The 'History' title of the transaction history is now redundant when
where are no pending transactions, so it as been conditionally hidden.

A passthrough for `data-testid` has been added to the Tab component for
convenience in e2e tests.
2020-04-01 13:35:07 -03:00
Mark Stacey
dbc7446b9a
Fix popup view expanding when expanding transaction (#8271)
The popup view would expand beyond the width of the viewport when
expanding a transaction. This bug was introduced in #8139 when I
removed the `min-width: 0` property from the `home__container` class;
this property was giving the parent permission to shrink that div below
the size of its content.

Instead of restoring that property, the parent component is no longer
using `display: flex`. Flexbox was never useful here, as this is just a
wrapper div around a wrapper div, both with identical sizes. The
default display type of `block` produces the desired behaviour with
less rules.
2020-04-01 13:18:36 -03:00
Mark Stacey
3f2bf36f6a
Add additional prop validation to Tabs component (#8267)
The Tabs component expects the `children` prop to be either a single
Tab component or an array of Tab components, and the internal tab index
should always map onto one of these components. However, if an invalid
tab index was set, it was just returning the first tab contents.

Instead it will now validate that the tab being asked for does exist,
and throw an error otherwise.
2020-04-01 11:29:33 -03:00
Whymarrh Whitby
cb7f81bb42
Update Connected Sites modal design (#8262) 2020-03-31 19:40:02 -02:30
Mark Stacey
2d66e90d07
Refactor asset list into separate component (#8263)
The pieces that we'll be referring to as the "Asset List" in the near
future have been extracted from WalletView into a separate AssetList
component. This list includes ETH, the tokens, and the 'Add Token'
button.

The styles were moved alongside this new component as well.
2020-03-31 16:48:11 -03:00
Mark Stacey
a554353ef3
Update token cell to show inline stale balance warning (#8259)
The token cell how shows a warning inline for the case where the token
balance failed to update. It displays a warning icon next to the
balance, with a tooltip that contains the same contents as was shown on
the token list previously.
2020-03-31 10:50:32 -03:00
Mark Stacey
4f80ff5b01
Redesign 'Add Token' component (#8260)
The 'Add Token' component has been redesigned to be more in-line with
the new home screen design. The description instructing the user to
click the 'Add Token' button has been removed, and the section itself
has been made roughly the same size as one of the list item. The text
now appears on just one line, overflowing to two if necessary.
2020-03-31 10:31:32 -03:00
Mark Stacey
f9767ed191
Add 'interactive' tooltip prop (#8258)
The 'interactive' prop for React Tippy will keep the tooltip open when
the user moves the mouse over the tooltip. This enables interactive
tooltips, where the user is expected to click on something in the
tooltip (e.g. a message with a link).
2020-03-30 23:44:20 -03:00
Mark Stacey
f7504d153e
Move TokenCell styles alongside component (#8257)
The styles for the TokenCell component have been moved to be alongside
the component. They have also been renamed from `token-list-item` to
match the component name.
2020-03-30 23:44:10 -03:00
Whymarrh Whitby
d82f06c710
Convert Connected Sites page to modal (#8254)
This commit updates the existing _Connected Sites_ section to a modal using
the `Popover` component. This will serve as a base for the new modal design.
2020-03-30 21:08:02 -02:30
Mark Stacey
b30a352acb
Use @fortawesome/fontawesome-free npm package (#8256)
The official npm package for Font Awesome Free is now used instead of
the vendored styles. Previously we had been using v4.4.0, now we're
using v5.13.0.

We're now importing the Font Awesome SCSS modules instead of using the
minified CSS bundle. This integrates more cleanly into our build
system, and it lets us use their mixins directly in the future if we
need to.

The variable `fa-font-path` has been set to reference our font
directory, as instructed here:
https://fontawesome.com/how-to-use/on-the-web/using-with/sass#compile
2020-03-30 20:05:51 -03:00
Whymarrh Whitby
d1f761956a
Add optional portal to Popover component (#8253) 2020-03-30 18:25:17 -02:30
Mark Stacey
079db2fdb4
Remove use of webpack loaders in components (#8249)
Various SVGs were being imported directly in components using Webpack
loaders. This was done to get these components to work correctly in
storybook, which uses Webpack. However we don't use Webpack for our
actual build system, so these components would fail when you attempted
to use them.

Instead the storybook script has been updated to use the `--static-dir`
flag, which allows specifying a directory of files to serve statically.
The `app` directory is served statically, so all of the relative URLs
we use in practice to reference fonts and images should just work.

The storybook build command has been updated to use the same flag.
Unfortunately this also means that the uncompiled background code is
now included in the build as well, because it's alongside our static
files. This shouldn't have any impact upon the build though.

The use of this `static-dir` option as made much of the existing
storybook Webpack configuration unnecessary, so it has been reduced to
just the essential steps.
2020-03-30 15:38:02 -03:00
Mark Stacey
4b59d6099a
Fix token list when balance is zero (#8250)
The token list would be stuck on "Loading" when there was at least one
token, but the balance of all tokens was zero. This bug was only
present on `develop`, and has not affected any published version of the
extension.

This was introduced in #8223, which removed what at the time seemed to
be an unnecessary update step. It turns out that the step was required
as a workaround to this bug with the token tracker.

The bug was fixed in https://github.com/MetaMask/eth-token-tracker/pull/33
and published in v2.0.0 of `@metamask/eth-token-tracker`.
2020-03-30 15:37:51 -03:00
marktoda
a761b9e15d
Make seed phrase import case-insensitive (#8246)
The user-specified seed phrase during the first-time-flow import step
required the phrase to be entered in all lowercase. The case does not
add any extra entropy to the seed, so there's no reason to be case
sensitive. Flexibility here will improve the onboarding UX.

This commit makes the entered seed phrase case-insensitive.

Fixes #8171
2020-03-30 10:21:04 -02:30
matteopey
007631171c
Update Italian translation (#8247)
* Update translation
* Align text center in welcome page header
2020-03-30 10:01:07 -02:30
Whymarrh Whitby
69388d9963
Split Routes into container and component files (#8242) 2020-03-26 13:48:50 -02:30
Mark Stacey
966c38cd99
Refactor token list (#8233)
* Refactor token list into standard container/component modules

The token list has been moved into its own directory and split into
separate container and component modules. Additional updates have been
made to simplify the component logic as well.

* Update token-list to use new React Context API
2020-03-25 21:43:25 -03:00
Mark Stacey
ade737e2a8
Refactor token list click handler (#8234)
The token list click handler has been moved up from the token cell to
the wallet view component where the token list is used. This keeps the
responsibilities of the token list and token cell components a bit more
focused - they're now only responsible for display, not what the
effects of clicking should be.
2020-03-25 18:24:14 -03:00
Mark Stacey
19c58b2f32
Move token cell unit test into component directory (#8237)
This is the conventional location for UI unit tests.
2020-03-25 15:56:48 -03:00
Mark Stacey
4328db78d7
Remove unused token cell methods and props (#8238)
The `network` prop was being passed to the Identicon despite that not
being an Identicon prop, and the `userAddress` prop was being passed
down by the container but was unused. The methods removed were not
called anywhere.
2020-03-25 14:59:16 -03:00
Mark Stacey
1e93340c16
Fix unit tests using shared test doubles (#8235)
These tests broke when `sinon.restore()` was called in a separate test
because they setup stubs/spies using `sinon` in the module context.
These were constructed then restored before the tests even ran.

Instead the test doubles are now setup in the `beforeEach` hook, which
in addition to fixing this problem also ensures each unit test is
isolated from the others.
2020-03-25 14:45:23 -03:00
ricky
b7b827b01c
Add Idle Timeout for Sync with mobile (#8201)
* Add idle timeout for sync

* refactor a bit with `goBack` and `clearTimeouts`

* Address lint nit

* Rename handleIdleTimeout -> startIdleTimeout
2020-03-24 01:00:59 -04:00
Mark Stacey
1105da7800
Refactor tab styles to minimize tab component styles (#8209)
* Refactor tab styles to minimize tab component styles

The tab component styles were not applicable to all tab instances, so
they were being overridden in a few places. Instead the tab styles have
been reduced to a minimal set that should be applicable in most cases.

There are a few functional changes here as well, meant to undo
changes made accidentally in #8132. Before that PR the page container
was overriding the tab styles altogether, but after that PR they were
combined with the base tab styles instead.

* Remove background color

This was previously being overridden by the page container styles, and
it matches the inherited background color already in the one other case
(the confirm page for token interactions)
2020-03-23 21:18:45 -03:00
Mark Stacey
2b6aff535e
Migrate "i18n-provider" to new context API (#8213)
The "i18n-provider" module has been replaced by a new `i18n.js` module
in the `contexts` directory which provides the `t` function via the new
React Context API.

The legacy context API is still used throughout the codebase, so a
legacy context provider has also been added as a shim until we migrate
away from the old API. The migration does require changing every single
place where the `t` function is used, so it is a non-trivial amount of
work. This shim allows us to tackle it one piece at a time without
breaking anything.

This was placed in a new `contexts` directory because it didn't seem
to belong in any existing categories. It certainly isn't a higher-order
component.
2020-03-23 14:07:05 -03:00
Mark Stacey
624523168f
Remove fallback for missing localized messages (#8212)
The translation helper function we use everywhere (`t`) would fallback
to the message `[${key}]` for any key not found in the set of localized
messages. Instead it how returns `undefined` in that case.

`[${key}]` isn't something you'd typically want to show to users, so
this fallback wasn't overly useful in practice. At best it served to
hide errors.

The falsey return value in the case where the message is missing makes
it easier to implement a fallback for that case. Such a fallback is
used in the `confirm-transaction-base` component, to restore the
fallback behavior accidentally changed in #8211
2020-03-23 11:54:57 -03:00
Mark Stacey
c167fbf903
Remove unnecessary token list update (#8223)
When the token tracker is first constructed and the first balance
update is triggered, we manually serialize the tracker state and call
our update function. This is _in addition_ to the update event handler
though, so the balances get updated twice. Similarly, we also catch any
errors during this first update to handle them, but this is done via an
event as well, so is redundant.

These steps have been removed; updates and errors are now handled
solely through events. We were able to drop a check from
`updateBalances` as well to ensure the tracker is still running, as the
event cannot be emitted unless it's running.
2020-03-21 17:35:08 -03:00
Mark Stacey
1972adad76
Remove unused parameters (#8216)
These two parameters were never used in practice - a `null` was being
passed in explicitly.
2020-03-19 14:32:38 -03:00
ricky
84806bed9b
Add border none for moz-focus-inner (#8217) 2020-03-19 12:44:20 -04:00
ricky
ba18f600fb
Tx popover (#8210)
* Add minimal working popover

* Fix styling of popover component

* Use lorem ipsum

* Update classnames and remove unrelated styles

* Remove unused components

* Add SVG close icon

* Add Close icon to icon stories

* Use div

* Use `addon-actions`

* Use `<button>` for close

* Fix button wobble in Firefox

* Remove border
2020-03-19 12:07:12 -04:00
Mark Stacey
4cc75eb9af
Remove tOrKey and tOrDefault functions from i18n context (#8211)
These two functions were not especially useful. `tOrDefault` was used
only by `tOrKey`, and `tOrKey` was only used in one place. All it did
was return the given `key` directly if it was falsey, so it was easily
replaced by a condition.
2020-03-19 01:03:20 -03:00
Mark Stacey
23a4c62bd5
Display nothing during confirm page load (#8207)
Previously a few mostly-empty `div`s would be shown if a render
happened while the confirm page was loading. Now nothing is shown. This
shouldn't impact users at all, as this condition should only last a
fraction of a second.
2020-03-17 18:11:44 -03:00
ricky
8ba35f673e
Add tx list-item component (#8195)
* Add tx list-item component

New list item compoent for transaction history

* Simplify component logic and remove type checks

* Address remaining feedback

* Remove extra line

* Place className prop on its own line

* Rename to primaryCurrency and secondaryCurrency

* Make the title `isRequired`

* Fix no-undef

* Remove more + buttons to be implemented in seperate PR

* Add minimal store and I18nProvider to storybook

* Use Component to support translations

* Add `metamask` to store

* Rename decorator
2020-03-17 15:15:53 -04:00
Mark Stacey
e1d0f3659e
Fix highlighting of selected asset (#8205)
The current selected asset in the asset list should be highlighted, but
this highlighting was broken for `ETH`. `ETH` was not highlighted when
it was selected, but it would be highlighted when anything else was.

This was broken accidentally in #7546
2020-03-17 14:45:46 -03:00
Mark Stacey
91f6dfc6e0
Fix method registry initialization (#8200)
The method registry was being initialized with the global variable
`ethereumProvider` before that variable was set. As a result, the
method registry was falling back to an internally constructed provider
that used the wrong provider URL (an obsolete Infura API). This was
resulting in an error with the message "Project ID not found".

The method registry is now initialized lazily, when it's first needed.
This should be well after the initialization of `ethereumProvider`,
which occurs during the UI initialization.
2020-03-17 11:14:27 -03:00
ricky
e3b68579ca
Clear sync timeout on unmount (#8199) 2020-03-16 19:33:43 -04:00
Brad Decker
7d374ab8d8
feat - add down caret on asset list (#8198) 2020-03-16 19:50:07 -03:00
Brad Decker
23bfa59bfd
fix #6958: fix destructuring of lastSelectedProvider (#8197) 2020-03-16 15:48:12 -03:00
ricky
45efbbecb7
Use new Copy icon (#8190)
* Use new Copy icon

* split props to two lines

* Add padding
2020-03-16 09:44:02 -04:00
Mark Stacey
74b519959b
Fix Tab prop type warning (#8185)
The props `isActive` and `tabIndex of the Tab component are required
and are always passed in, but the prop type warning is triggered
because the tabs are rendered without these props first, then cloned by
the `Tabs` component, where these props are added.

To silence the warning, the props have been made optional.
2020-03-13 10:49:17 -03:00
Mark Stacey
61fdb56864
Use specified gas limit when speeding up a transaction (#8178)
The sidebar used to speed up a transaction while it's pending or after
it has failed currently allows editing the gas limit, but that new
limit is ignored. This is especially problematic for transactions that
failed due to a low gas limit, as the problem becomes impossible to fix
by retrying.

The gas limit specified by the user is now used in the speed up
transaction.

Fixes #8156
Fixes #7977
2020-03-12 11:33:11 -03:00
Mark Stacey
2b3acfc92b
Skip ENS reverse resolution when address is blank (#8184)
The address is blank momentarily when navigating to the confirmation
screen when sending a token. The address is updated in a subsequent
render.

The ENS reverse resolution is now only attempted if the address is
given. It has also been updated to attempt resolution when the address
is finally set, which fixes the reverse resolution for token sends.

I had hoped to get rid of this interim render-without-address, but that
turned out to be a bit more challenging. The problem is that the UI
submits transactions through the provider just as a dapp would, and the
provider doesn't say when the transaction is submitted. The promise
returned doesn't resolve until after confirmation. We would have to
start calling the background methods directly and bypass the provider
to get the feedback we need, and that sounded potentially dangerous.
Definitely a challenge for another day.
2020-03-12 10:50:37 -03:00
Thomas Huang
e791882959
Handle and set gas estimation when max mode is clicked (#8176)
* Handle and set gas estimation when max mode is clicked
Add componentDidMount to SendAmountRow to check for maxMode boolean to update amount and gas.
2020-03-11 13:13:48 -07:00
Mark Stacey
f0f5554846
Fix selectors that use metamask.send.from state (#8182)
The `metamask.send.from` field was assumed by various selectors to be
an object, but instead it was recently set to a string. The selectors
have been updated to assume it's a string, and to fetch the full
account object explicitly.

The selector `getSendFromObject` was repurposed for this, as that's
basically what it already did. The optional address parameter was
removed though, as that was only used to fetch the `from` address in
cases where the `send` state was set without there being a `from`
address set. That case is no longer possible, as the `from` address is
always set upon the initialization of the `send` state.

The `getSendFromObject` selector no longer fetches the 'name' of that
address from the address book state either. This property was not used
in either of the cases this selector was used.
2020-03-11 15:40:35 -03:00
ricky
3cd35fe0ae
Add tx history icons (#8180)
* Add tx history icons

* Make size `isRequired`

* Use classnames

* Include keyframes
2020-03-11 14:05:47 -04:00
Mark Stacey
ad5174a588
Fix retry transaction (#8177)
The `createRetryTransaction` was accidentally removed from the
`gas-modal-page-container` component during a refactor in #7730.
Attempting to retry a transaction since that change has resulted in a
UI crash.
2020-03-11 12:07:48 -03:00
Dan J Miller
5c4831bdee
Notifications Icon Circles (#7830)
* Adds notification icon circles and associated storybook stories

* Fix image paths in circle-icon.stories and message-circle-icon.component

* Code improvements for icon circles PR: remove additional z-index, make iconSource required

* Use component story format in circle-icon.stories and message-circle-icon.stories

* Remove success and info circle icons, as not presently needed

* Rename message-circle-icon to alert-circle-icon

* Small code fix ups for alert-circle-icons
2020-03-11 12:30:39 -02:30
Dan J Miller
92e6338b78
Translation helper: substitute react components and component wrapping substrings (#8129)
* Update i18n-helper to allow substitutions of react components and wrapping of translation substrings

* Simplify code in i18n-helper.js related to substitutions, including react substitutions.

* Remove wrapper support from i18n in favour of using translations in substitutions.

* Fix i18n-helper substitution logic: ensure correct index of substitution is applied

* Throw error if there are not enough substitutions for a translation phrase

* Adds unit tests for now i18n-helper substitution functionality

* Fix grammar, react element line spacing and test layout+readability in i18n-helper.test.js
2020-03-11 12:30:05 -02:30
Erik Marks
2df8b85c5f
LoginPerSite: Support multiple accounts without automatic switching (#8079)
* transaction editing: use txParams 'from' account

* signature-request: use txParams 'from' account

* signature-request-original: use txParams 'from' account

* encryption/decryption: use txParams 'from' account

* update tests

* set 'send' state 'from' address in confirm containers
2020-03-06 13:34:56 -08:00
Mark Stacey
47a7176e71
Use consistent variable name for classnames import (#8143)
The variable name `classnames` is generally what we use for this
module, and single-letter variable names are generally frowned upon.
2020-03-01 06:14:16 -04:00
Mark Stacey
f1750d2807
Remove unnecessary variables for state and props (#8144)
The use of these variables confuses the ESLint plugin I use for VSCode.
It's also not useful.
2020-03-01 06:14:07 -04:00
Mark Stacey
ae1ed7079f
Fix token cell props (#8142)
The `hideSidebar` proptype of `TokenCell` was set as an optional bool,
when it should have been a required function.
2020-03-01 06:13:59 -04:00
Mark Stacey
887bc078d7
Fix bug preventing dropdown close upon outside click (#8145)
The base component we use for dropdowns handles ensuring the dropdown
is closed when the user clicks outside the dropdown. This functionality
was accidentally broken in #7781 when converting it to an ES6 class.
2020-03-01 06:13:49 -04:00
Mark Stacey
2b1a22b8b1
Consolidate Home UI (#8141)
The "Transaction View" component has been merged with the Home
component. The division between these two components seemed wrong
because the "Transaction View" contained the menu bar (distinctly a
"home" thing, not a "transaction" thing), and we will be adding more
non-transaction-related components shortly.

This also let us use a single `Media` component instead of two.
2020-02-28 17:46:01 -04:00
Mark Stacey
fa3497e39b
Move home notifications upwards in DOM (#8138)
The notifications displayed on the home screen were being passed
through the `TransactionView` and `TransactionList` components before
being rendered. This was unnecessary because the notifications are
absolutely positioned.

They are now rendered directly in the home component where they're
defined. A helper function has been written to improve readability.
2020-02-28 16:27:58 -04:00
Mark Stacey
f4c279e6ff
Extract style for Home component into separate module (#8139)
The styles used for the Home component were in the huge
"newui-sections" SCSS file. Instead they've been moved into an SCSS
module alongside the component, to follow our conventions.

The `main-container` class was left as-is because it is shared between
here and the settings page.
2020-02-28 16:27:22 -04:00
Mark Stacey
b534ecb2e1
Add stories for Tabs component (#8134)
This effectively covers the `Tab` component as well, which doesn't
really make sense to showcase on its own.

One minor change was made to the actual `Tabs` component; `children`
was marked as a required prop. It doesn't render anything sensible if
they are omitted, and it always has at least one child in our codebase.
2020-02-28 09:49:31 -04:00
Mark Stacey
7e4916e59e
Simplify tab component (#8132)
The tab component now sets the `tab` and `tab--active` classes
internally regardless what class is passed in. The convention in React
is to allow adding _additional_ classes via the `className` prop, not
to allow removing internal classes entirely.

the `activeClassName` prop was removed entirely. A few other props that
are always passed in have been marked as required.
2020-02-27 18:00:42 -04:00
Mark Stacey
ac4e1d4e26
Remove faux <header> elements (#8131)
We have been using the HTML `header` tag in various footers. The
`footer` tag is generally more appropriate for use in a footer.
2020-02-27 18:00:20 -04:00
Dan J Miller
4996a00cde
Change permissions connect screen to use browser routing (#8072) 2020-02-27 11:20:05 -04:00
Mark Stacey
46157cb476
Remove redundant PropTypes (#8126)
Specifying a PropType of either type `node` or type
`arrayOf(PropTypes.node)` is redundant, because an array of nodes is
itself a node.
2020-02-27 10:31:59 -04:00
ryanml
64aef5033d
Adding setting for disabling Eth Phishing Detection (#8125) 2020-02-27 02:29:41 -04:00
Mark Stacey
53d25d01a6
Add stories for Identicon component (#8113)
One main configurable story has been added, plus a few distinct other
examples. All props are covered except `className`, which seems safe to
ignore.

Default props have been added to `Identicon` to make more explicit what
defaults were expected; there is no functional change.
2020-02-26 22:08:58 -04:00
Erik Marks
5d1f3c1436
Delete shapeshift functionality; retain state and display (#8118)
* delete shapeshift functionality; retain state and display
2020-02-26 09:34:46 -08:00
Mark Stacey
7a9f53c99d
Use Component Story Format for stories (#8108)
The recommended way of writing stories changed in Storybook v5.2 to
the Component Story Format (CSF). Instead of using `storiesOf` and
running everything upon module import, the new story format is a
declarative description of each component that uses ES6 import
semantics.
2020-02-26 10:13:56 -04:00
Mark Stacey
cb995d66da
Re-render jazzicon component when diameter changes (#8114)
Previously when the `diameter` prop of the `jazzicon` component was
changed, the new diameter would be ignored. The jazzicon is now
redrawn upon each change, as you would expect.

I don't think it's possible for this bug to manifest itself in the
extension. This was discovered through tinkering with the Storybook
for this component.
2020-02-26 09:42:33 -04:00
Mark Stacey
0a0040842c
Fix display of identicon on Connect page (#8107)
The identicon was showing as a white circle on the connect page. This
was a CSS error introduced when `jazzicon` was updated in #7898.

The white circle shown was the white border around the identicon. This
circle is an adjacent `div` in the DOM, and was rendered _underneath_
the identicon itself because it was placed first in the DOM.
Unfortunately the new version of `jazzicon` is no longer explicitly
positioned (it used to have `position: relative` set internally), so
now it's lower in the stack order regardless of DOM position.

Rather than placing the border adjacent and relying upon both elements
being positioned, the border has been changed into a wrapping `div`
instead. Now the stack order is more explicit.
2020-02-26 09:34:39 -04:00
Mark Stacey
35941f34dd
Move default white background from body to root element (#8110)
In our base stylesheets we set the `body` background color to white.
This unfortunately also affected the preview area of Storybook. The
Storybook preview only renders isolated components, but it does
include all styles.

To avoid this problem, the white background color has been moved to
the `#app-content` div instead. All of our UI is inside this div.
2020-02-26 09:33:58 -04:00
Erik Marks
83da3db37b
Remove selected address history (#8104)
* remove selected address history, account switching; fix perm selectors, bugs

Co-Authored-By: Mark Stacey <markjstacey@gmail.com>
2020-02-25 14:39:38 -08:00
Whymarrh Whitby
5eb95625ca
Remove react-tooltip-component (#8099) 2020-02-25 09:11:56 -03:30
Whymarrh Whitby
169ab8adc9
Remove recompose (#8097) 2020-02-24 19:28:26 -03:30
ricky
54f0830324
Use destructuring assignment (#8093)
* Use destructuring assignment

* remove `state` const

* Use defaultProps
2020-02-24 14:38:41 -05:00
Whymarrh Whitby
81d8237654
Use eslint-plugin-react@7.18.3 (#8085) 2020-02-24 15:24:35 -03:30
Mark Stacey
ef98e876a7
Remove unused container prop (#8076)
The `activeTab` prop being passed in from the container was never used.
2020-02-20 11:52:10 -04:00
Konstantin
6f47fece56
Implementation encrypt/decrypt feature (#7831)
Implement `eth_decrypt` and `eth_getEncryptionPublicKey`. This allows decryption backed by the user's private key. The message decryption uses a confirmation flow similar to the messaging signing flow, where the message to be decrypted is also able to be decrypted inline for the user to read directly before confirming.
2020-02-19 14:24:16 -04:00
Whymarrh Whitby
8f26f5a021
Remove redux-test-utils dependency (#8070)
* Remove usages of redux-test-utils
* Remove redux-test-utils dependency
2020-02-18 14:54:03 -03:30
Jenny Pollack
fd170ef8c0
Merge pull request #8062 from whymarrh/no-mixed-operators
Enable core ESLint no-mixed-operators rule
2020-02-17 21:08:06 -07:00
Mark Stacey
a71f56e5da
Remove unused sinon sandboxes (#8063)
These sandboxes were created, then not utilized at all.
2020-02-17 21:31:09 -04:00
Mark Stacey
c6db54cc6d
Attempt ENS resolution on any valid domain name (#8059)
ENS currently supports a variety of tlds in addition to `.eth`, and
more will be supported in the future. Rather than hard-code a list of
supported ENS tlds, all valid domain names will now be interpreted as
potential ENS addresses in our address input component.

Closes #7978
2020-02-17 21:20:01 -04:00
Whymarrh Whitby
da0300d3b1 Enable core ESLint no-mixed-operators rule 2020-02-17 21:06:36 -03:30
Jenny Pollack
befd580ab2
add parens to arrow function parameters (#8060) 2020-02-17 19:12:48 -04:00
Jenny Pollack
c1453c7528
Merge pull request #8056 from whymarrh/arrow-parens
Enable arrow-parens ESLint rule
2020-02-17 15:26:43 -07:00
Whymarrh Whitby
a78cf0ef3a Enable arrow-parens ESLint rule 2020-02-15 17:04:21 -03:30
Dan Finlay
eb57763056
Add warning to watchAsset API when editing a known token (#8049)
* Add warning when editing a known token with watchAsset API

* Add warning when watchAsset attempts to reuse token symbol

* Linted
2020-02-14 12:32:56 -08:00
Vodopyanov Egor
b63b848ed4
add title to transaction action component (#8050) 2020-02-14 12:31:44 -04:00
Mark Stacey
dcc7d29511
Refactor QR scanner to move all error handling within component (#7885)
The QR scanner component error handling would sometimes redirect the
user to the wrong page. It was also confusingly handled in two places;
the action used to open the QR scanner, and the scanner component.
The error handling has now been corrected, simplified, and integrated
into the QR scanner component itself.

The old way of handling an error within the component was to close the
modal, then call the action to open it all over again. This action took
a route parameter, which instructed the action on which route to open
if the fullscreen UI needed to be opened (as the fullscreen UI is the
only one where the browser will show the camera permission prompt).

This redirection worked just fine for handling the initial opening
of the QR scanner modal. But for any subsequent errors the same action
was used with a _default route_, meaning the user could click "try
again" and find themselves on a completely different screen.

Instead, errors now trigger a state change instead of closing and re-
opening the modal. The permission checks in the action have been
integrated into the component as well.

One functional change is that the scenario where you have an invalid
QR code has been made an error. Previously this just showed the error
message below the video preview, but left the user with no way to try
again. There error page has a "Try again" button, so it seemed better
suited as an error. Also the message literally started with "Error:".

Another functional change is that _all_ errors during initialization
will result in the error UI being shown. Previously there was one error
case that would instead log to the console and leave the user stuck.
2020-02-13 16:07:50 -04:00
Whymarrh Whitby
7f3cf07f94
Update sinon and proxyquire (#8027)
* Use sinon@8.1.1
* Use proxyquire@2.1.3
* Move sinon mocking out of global scope into hooks
2020-02-11 17:03:32 -03:30
Whymarrh Whitby
4f3fc95d50
Update ESLint rules for test suite (#8023)
* Use @metamask/eslint-config@1.1.0
* Use eslint-plugin-mocha@6.2.2
* Mark root ESLint config as root
* Update Mocha ESLint rules with shared ESLint config
2020-02-11 13:21:13 -03:30
ryanml
3bbbe13311
Use contact name instead of address during send flow (#7971) 2020-02-11 12:10:15 -03:30
ricky
8c81f9d530
Ensure we pass history to UnlockPage component (#8017)
* Add .isRequired to history propType definition

* Ensure we pass history down to the component
2020-02-10 12:42:59 -05:00
William Morriss
1eb828f7f0
Add support for 24 word seed phrases (#7987) 2020-02-06 18:55:45 -03:30
ricky
fbfaa6eb10
Use readOnly (#7995) 2020-02-06 14:34:23 -05:00
Whymarrh Whitby
dea8f0f24d
Use combineReducers for rootReducer (#7964) 2020-02-06 13:08:14 -03:30
Whymarrh Whitby
25bcdfcac8
Fix SendAmountRow tests (#7968)
* Rewrite SendAmountRow tests to avoid flakiness
* Use sinon@5.0.1
* Dedupe supports-color versions
2020-02-05 09:45:46 -03:30
Thomas Huang
6969e3984b
Fixes #5706 - Adds Dai/Sai to currency display (#7986)
With the change from infura to cryptocompare https://github.com/MetaMask/gaba/pull/30/files#diff-50c3c47cc5fa12e5213a6cc900476f41L41-R48 we have numerous conversion rates to go through and add if we like to.
2020-02-04 14:49:53 -08:00
Whymarrh Whitby
b80afc6493
Use ethereum-ens-network-map for network support (#7960) 2020-01-31 09:56:50 -03:30
Thomas Huang
5d1c9313db
Various component tests and some conditional statements (#7765)
* Various component tests and some conditional statements

Conditional in account-menu in removeAccount when keyring sometimes is not initially provideed
Conditional on unlock-page when there is no target.getBoundingClientRect on the element.

* Update helpers

* Remove component debugging

* Add default params for render helpers

* Remove stubComponent for old Mascot
Changes in https://github.com/MetaMask/metamask-extension/pull/7893 has prevented the need to stub it out.

Change logout to lock in account-menu test
2020-01-30 11:34:45 -08:00
Whymarrh Whitby
d75e587533
Replace fast-deep-equal with isEqual from lodash (#7935) 2020-01-29 16:31:53 -03:30
ryanml
07ce849c48
Sorting seed phrase confirmation buttons alphabetically (#7933) 2020-01-29 16:12:46 -03:30
Mark Stacey
59a1746afc
Validate custom spend limit (#7920)
The custom spend limit was previously not validated. It did have a
minimum of zero set, but this didn't have any affect (that minimum is
used for form constraint validation, and this field wasn't in a form).
The field was never checked to ensure the contents didn't exceed the
maximum.

The field is now checked for values that exceed the maximum, and
invalid values in general (including negative values).

The parameters to the `showEditApprovalPermissionModal` were also
alphabetized to make them easier to read. In the course of doing this,
I noticed that the origin was missing from one of the calls. This was
responsible for the modal saying "Spend limit requested by undefined"
when clicking "Edit" under the transaction details. This has been
fixed.
2020-01-29 14:16:38 -04:00
Mark Stacey
00a73ee25e
Replace debounce package with debounce function from lodash (#7931)
These two functions differ slightly in options, but none of those
options are being used by us, so in these cases they're functionally
equivalent. They're even both descendants of the original `debounce`
function from `underscore`.

This was done to reduce the number of direct dependencies we have. It
should not affect bundle size, as we still depend upon the `debounce`
package transitively.
2020-01-29 13:36:03 -04:00
Mark Stacey
398a45bfdd
Replace clone dependency with cloneDeep from lodash (#7926)
This was done to reduce the number of direct dependencies we have. It
should be functionally equivalent. The bundle size should not change,
as we use `clone` as a transitive dependency in a number of places.
2020-01-29 13:14:33 -04:00
Mark Stacey
cc78378b8e
Allow editing max spend limit (#7919)
In the case where the initial spend limit for the `approve` function
was set to the maximum amount, editing this value would result in the
new limit being silently ignored. The transaction would be submitted
with the original max spend limit.

This occurred because function to generate the new custom data would
look for the expected spend limit in the existing data, then bail if
it was not found (and in these cases, it was never found).

The reason the value was not found is that it was erroneously being
converted to a `Number`. A JavaScript `Number` is not precise enough to
represent larger spend limits, so it would give the wrong hex value
(after rounding had taken place in the conversion to a floating-point
number).

The data string is now updated without relying upon the original token
value; the new value is inserted after the `spender` argument instead,
as the remainder of the `data` string is guaranteed to be the original
limit. Additionally, the conversion to a `Number` is now omitted so
that the custom spend limit is encoded correctly.

Fixes #7915
2020-01-28 22:49:32 -04:00
Mark Stacey
99ceca3d25
Update jazzicon component (#7898)
* Use ref instead of findDOMNode in jazzicon component

The jazzicon component was using `findDOMNode` to get the DOM node for
the main div returned by the component, which is generally not
recommended. Instead a ref is now used.

* Update Jazzicon to v2

This version drops the dependency upon `raphael`, and no longer uses
the function `createSVGMatrix` which was causing unit tests to fail
(because it's not supported by jsdom).
2020-01-28 16:08:55 -08:00
Mark Stacey
7921196536
Update data on Approve screen after updating custom spend limit (#7918)
After updating the custom spend limit on the approve screen, the data
for the transaction was not being updated. Instead it showed the
original transaction data. The transaction data was being updated
correctly in the final transaction though.

The approve screen has been updated to ensure changes to the custom
spend limit are reflected correctly in the data shown.
2020-01-28 09:42:07 -04:00
Brandon Lucas
07f4294088 disable import button on Import Account screen for empty string/file (#7912)
* disable import button on Import Account screen for empty string/file
* use refs to access DOM for import-account
2020-01-28 09:40:03 -04:00
Erik Marks
b75f812953
Improve LoginPerSite UX/devX and permissions logging (#7649)
Update accounts permission history on accountsChanged
Create PermissionsLogController
Fix permissions activity log pruning
Add selectors, background hooks for better UX
Make selected account the first account returned
Use enums for store keys in log controller
Add last selected address history to PreferencesController
2020-01-27 14:42:03 -08:00
Mark Stacey
583b404e02
Switch to full lodash package, and update lodash (#7907)
* Update lodash

All versions of the full `lodash` package have been updated to 4.17.15.
The only exception is v4.17.14 which is pinned by `ganache-core`.

* Switch to using `lodash` instead of per-method packages

We have the full lodash package _ten times_ as a production transitive
dependency, so including per-method packages is not saving space (it
might instead result in slightly more space being used).
2020-01-27 12:45:48 -04:00
ryanml
60f6fd0008 Fixing broken JSON import help link (#7910) 2020-01-27 08:54:21 -04:00
Mark Stacey
560be4b4e3
Add top-level error page (#7889)
Any error caught during a React component render or lifecycle method
will now be caught by the top-level error boundary, which shows the
user this new error page. The error page will display a simple error
message, and will show the details of the error in a collapsible
section.

The caught error is also reported to Sentry.

In development the error will be re-thrown to make it easier to see on
the console, but it is not re-thrown in production.
2020-01-24 17:11:02 -04:00
Mark Stacey
86c6280bc3
Remove unnecessary get environment type parameter (#7891)
* Remove unnecessary `getEnvironmentType` parameter

The default value of the first parameter is `window.location.href`, so
there is no need to pass it in explicitly.

* Remove junk parameter from `getEnvironmentType` invocation

`getEnvironmentType` doesn't need to be passed any parameter, as the
default value is `window.location.href` which is generally what is
wanted. In this case, the variable `location.href` was always
`undefined` anyway. This particular `location` variable is from React
Router, and does not have an `href` property.

* Fix comment for `getEnvironmentType`

One of the possible return values was referred to by the wrong name.
2020-01-24 15:12:58 -04:00
Mark Stacey
b90b30f706
Remove unnecessary withRouter and compose calls (#7890)
`withRouter` has been removed from any components that were not using
any of the three props injected by `withRouter`: `history`, `location`,
and `match`.

`compose` is a no-op when called upon a single component, so it has
been removed in all such cases.
2020-01-24 15:12:49 -04:00
Mark Stacey
70a689410a
Use ref in Mascot component rather than reaching into DOM directly (#7893)
Accessing the dom via `document` is strongly discouraged in React.
Instead the DOM element is now referenced by ref instead.
2020-01-24 14:15:34 -04:00
Mark Stacey
7471e2df02
Remove unnecessary WebRTC shim (#7886)
The WebRTC spec is fairly stable these days, particularly among the
browsers we support. We don't need this shim for anything. I'm guessing
it may have been added primarily with IE in mind.
2020-01-23 14:04:05 -04:00
ryanml
d8c685ba2e Add mechanism to randomize seed phrase filename (#7863)
The filename is seeded by a simple use of Math.random() pulling from an alphanumeric character bank, as opposed to a more cryptographically random solution. This provides a simple layer of difficulty for bad actors to seek out the recovery phrase file.
2020-01-21 21:22:55 -04:00
Erik Marks
b095dc0347
Change "Log In/Out" terminology to "Unlock/Lock" (#7853)
* log out/in -> lock/unlock
2020-01-21 14:09:53 -08:00
Mark Stacey
d27f2ee7d6
Fix intermittent e2e test failure (#7873)
The 'can retype the seed phrase' test would fail sometimes when one of
the words in the seed phrase was a subset of another word (e.g. 'issue'
and 'tissue'). This is because the selector used to find the word
looked for the first element that contained the text, rather than an
exact match.

To simplify the selector and make it more reliable, test ids were added
to each seed phrase word. The selector now uses CSS instead of XPath,
and it only finds exact matches.

A test id was also added to the div containing the shuffled seed words
to select from, so that the chosen seed words wouldn't be selected
in place of the real target when the same word appears twice.
2020-01-21 11:31:56 -04:00
Mark Stacey
6e49d0b5b5
Remove unnecessary shouldComponentUpdate (#7875)
The `confirm-seed-phrase` component extends PureComponent, so it
doesn't need a `shouldComponentUpdate` function. The state is
effectively immutable, as all state is either a primitive type or is
updated with new instances rather than mutation.

Removing this function will silence a warning message printed to the
console during e2e tests (React doesn't want you to set this function
on `PureComponent`s).

Removing this function also exposed an unused piece of state, which has
also been removed.
2020-01-21 11:19:35 -04:00
Mark Stacey
cc928aaed9
Add withFixtures helper and simple-send test (#7862)
The `withFixtures` helper will instantiate ganache, a web driver, and
a fixture server initialized with the given set of fixtures. It is
meant to facilitating writing small, isolated e2e tests.

The first example test has been added: simple-send. It ensures that the
user can send 1 ETH to another account.

These new e2e tests will run during the normal e2e test run.

Closes #6548
2020-01-20 14:50:25 -04:00
Whymarrh Whitby
000fcfdfcc
Fix propTypes for TransactionBreakdown component (#7848) 2020-01-16 18:19:38 -03:30
Whymarrh Whitby
7c7f121fe3
Fix props for BasicTabContent component tests (#7850) 2020-01-16 18:19:01 -03:30
Whymarrh Whitby
b4ca671b6b
Fix propTypes and test props for Dropdown components (#7851) 2020-01-16 18:18:09 -03:30
Whymarrh Whitby
78044a5cdc
Fix propTypes and test props for SignatureRequest component (#7849) 2020-01-16 15:53:14 -03:30
Whymarrh Whitby
70e083820b
Refactor Network dropdown component (#7817) 2020-01-16 15:02:03 -03:30
Mark Stacey
20a7b8fa36
Force background state update after removing an account (#7840)
The e2e tests were failing intermittently after removing an account
because the account was shown as not deleted after the removal. I
suspect this was because the account _had_ been removed, but that
change to the background state hadn't yet propagated to the UI.

The background state is now synced before the loading overlay for
removing the account is removed, ensuring that the removed account
cannot be seen in the UI after removal.
2020-01-16 13:43:40 -04:00
Mark Stacey
8225bbe126
Remove unused current view related things (#7843)
* Remove unused functions from `mapDispatchToProps`

The actions import was also updated to import only the two actions
used, rather than all actions.

* Remove unused container component

Well, technically it was the props injected by this container that were
unused. The container served no purpose, so the component it surrounded
is now used directly instead.

* Remove both unused `getCurrentViewContext` selectors

* Remove unused SHOW_CONFIG_PAGE action

* Remove checks for `currentView` with name `config`

Now that the SHOW_CONFIG_PAGE action has been removed, it's no longer
possible for `currentView.name` to be set to that value.

* Remove unused `wallet-view` container props

* Delete unused SHOW_SEND_PAGE and SHOW_ADD_TOKEN_PAGE actions

* Remove unused `account-menu.container` props

* Remove unused SHOW_INFO_PAGE action

* Remove unused SET_NEW_ACCOUNT_FORM action
2020-01-16 13:02:44 -04:00
Whymarrh Whitby
48c9b0174f
Add required props for TransactionListItemDetails tests (#7834) 2020-01-16 00:04:32 -03:30
Whymarrh Whitby
dcf8eb2187
Fix prop types for GasPriceChart tests (#7836) 2020-01-16 00:03:50 -03:30
Whymarrh Whitby
e642314ae4
Fix prop types for NetworkDropdown tests (#7837) 2020-01-16 00:03:37 -03:30
Whymarrh Whitby
948a2ce831
Fix prop types for SendGasRow component tests (#7833) 2020-01-15 17:44:47 -03:30
Whymarrh Whitby
c53a40c45f
Add required props & fix propTypes for SendFooter tests (#7825) 2020-01-15 13:28:23 -03:30
Mark Stacey
74557bd68a
Delete onBlur handlers from currency and token input components (#7824)
As of #7753, the `onBlur` prop is no longer used for the `token-input`
and `currency-input` components, and the associated wrapper components
and the shared underlying component. It as been removed from all of
them.
2020-01-15 11:18:59 -04:00
Whymarrh Whitby
ab7500a940
Add required props for Send component tests (#7821) 2020-01-14 18:23:22 -03:30
Mark Stacey
00da0d28a0
Use data attributes to reference settings in e2e tests (#7820)
These rows on the Advanced Settings page were being looked up in the
e2e tests by the order they appeared in. Instead they're now referenced
by data id, so that we can add new settings and re-arrange them without
breaking the e2e tests.
2020-01-14 17:27:36 -04:00
Whymarrh Whitby
8b0c95cbb1
Add required props for AdvancedTab component tests (#7819) 2020-01-14 17:45:54 -03:30
Mark Stacey
19f10e197e
Simplify e2e test transaction navigation (#7816)
The transaction navigation in the e2e tests has been made simpler with
the addition of data attributes to help with finding the navigation
buttons. Each button is now labelled according to its purpose.
2020-01-14 14:53:02 -04:00
Mark Stacey
ac01c5c89a
Consistent jsdoc syntax (#7755)
* Specify type before parameter name

Various JSDoc `@param` entries were specified as `name {type}` rather
than `{type} name`.

A couple of `@return` entries have been given types as well.

* Use JSDoc optional syntax rather than Closure syntax

* Use @returns rather than @return

* Use consistent built-in type capitalization

Primitive types are lower-case, and Object is upper-case.

* Separate param/return description with a dash
2020-01-13 14:36:36 -04:00
Whymarrh Whitby
2c3b1a0fe0
Convert ConfirmTxScreen to an ES6 class (#7790)
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-01-13 13:32:54 -03:30
Whymarrh Whitby
61d1809750
Purge xtend from the UI (#7795) 2020-01-13 12:59:21 -03:30
Whymarrh Whitby
b9757f5563
Convert account import components to ES6 classes (#7791)
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-01-13 11:42:53 -03:30
Whymarrh Whitby
f850a17f63
Convert FiatValue component to ES6 class (#7786)
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-01-13 11:42:26 -03:30
Whymarrh Whitby
789dd19677
Convert Network component to an ES6 class (#7784)
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-01-13 11:42:11 -03:30
Whymarrh Whitby
3b3325d191
Convert ReadOnlyInput to functional component (#7788)
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-01-13 11:41:51 -03:30
Whymarrh Whitby
e20163bfda
Convert TokenList component to an ES6 class (#7785)
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-01-13 11:39:38 -03:30
Thomas Huang
428fdee7e3
Remove padding of info circle of advanced gas (#7810) 2020-01-13 07:08:39 -08:00
Whymarrh Whitby
d802e09a8b
Convert Mascot component to an ES6 class (#7787) 2020-01-13 10:42:58 -03:30
Whymarrh Whitby
82ef9674f2
Move util test file alongside subject (#7807) 2020-01-13 10:41:41 -03:30
Thomas Huang
f6de94a6e5
Remove redundant gas selector file (#7805)
One of these two selectors are in use, which is is another file
92971d3c87/ui/app/selectors/custom-gas.js (L44)
2020-01-10 11:11:49 -08:00
Whymarrh Whitby
89e7dc2312
Convert Modal component to ES6 class (#7783) 2020-01-10 15:35:46 -03:30
Whymarrh Whitby
52a38de567
Remove unused components (#7802) 2020-01-10 15:27:48 -03:30
Mark Stacey
0d61f78379
Remove unused PersistentForm (#7770)
This component used to persist form contents to LocalStorage. This was
especially useful for the popup UI, as each time the mouse left the
popup, the UI was completely torn down and state was lost.

This component was only being referenced by one form, and it wasn't
even being used there (e.g. no fields were labelled appropriately to
be persisted).

This was a useful component, and it seems this feature was lost
somewhere in the past couple of years. It was tempting to re-instate it
rather than delete it, but I decided not to because I'd likely approach
the problem differently if we wanted to reinstate it again today (maybe
by using a React Hook, or storing the state in Redux and persisting a
subset of the Redux store instead).
2020-01-10 11:55:27 -04:00
Whymarrh Whitby
fa1482ef76
Convert HideTokenConfirmationModal to an ES6 class (#7782) 2020-01-10 11:51:47 -03:30
Whymarrh Whitby
dadb112df9
Convert MenuDroppoComponent component to an ES6 class (#7781)
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-01-10 11:43:21 -03:30
Mark Stacey
dac83f6188
Make account details modal close button easier to click (#7797)
The account details close button is difficult to click from the e2e
tests because it has a size of zero. The actual icon is added via CSS
as an `::after` pseudo-element.

The CSS has been adjusted to give the icon a size, and it the markup
is now a `button` rather than a `div`.
2020-01-10 10:43:53 -04:00
Mark Stacey
61ab053bb1
Remove unused className prop (#7800)
This prop is not checked by the component it's passed into, and that
class doesn't correspond to any style rules.
2020-01-10 10:43:44 -04:00
Mark Stacey
f20e028cde
Remove unused props, prevent redundant gas update (#7769)
These unused props weren't being caught by ESLint because this
component extended another, which I guess made it difficult for the
React plugin to determine what was unused.

The `componentWillUpdate` logic was moved into `componentDidUpdate` so
that it would be picked up by ESLint. Also it seemed like a sensible
place for it to go. Having three redundant gas updates as part of
the same lifecycle function seemed too far, so I ensured it's
only called once.
2020-01-10 10:39:44 -04:00
Erik Marks
728026d1f7
Fix batch transaction UX (#7473)
* order transactions from oldest to newest in UI

* update json-rpc-engine, eth-json-rpc-middleware

* update e2e and integration tests
2020-01-10 06:34:02 -08:00
Dan J Miller
d349bd61d2
Fix gas estimate for tokens (#7753)
* Make gas estimate update on debounced token amount change, not just on blur after change

* Updated tests

* Ensure `updateGas` is bound early

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-01-10 10:53:54 -03:30
Whymarrh Whitby
3b1cd1286f
Convert TokenMenuDropdown to an ES6 class (#7779) 2020-01-10 10:34:03 -03:30
Whymarrh Whitby
be3ba68e4c
Convert NetworkDropdown to ES6 class (#7778) 2020-01-10 10:33:47 -03:30
Whymarrh Whitby
7f47a42f55
Convert AccountDetailsDropdown to ES6 class (#7777) 2020-01-10 10:33:32 -03:30
Whymarrh Whitby
6947ff49e0
Convert AccountPanel component to ES6 class (#7775) 2020-01-10 10:32:24 -03:30
Whymarrh Whitby
92971d3c87
Migrate codebase to use ESM (#7730)
* Update eslint-plugin-import version

* Convert JS files to use ESM

* Update ESLint rules to check imports

* Fix test:unit:global command env

* Cleanup mock-dev script
2020-01-09 00:04:58 -03:30
Sirius Tsou
9ba3774b5e Fix Kovan and Rinkeby chain IDs (#7762) 2020-01-08 11:26:56 -03:30
Mark Stacey
7bddbf611a
Replace inlined blockies identicon with npm package (#7757)
The "blockies" style identicon is handled by a module that was copied
from MyEtherWallet and inlined. This has been removed, and replaced
with the upstream package it was originally derived from.
2020-01-07 23:55:32 -04:00
ricky
984e5a1e26
Properly handle <enter> keystroke (#7747)
* Properly handle <enter> keystroke, closes #7737

* no-unused-vars
2020-01-07 17:20:29 -05:00
Whymarrh Whitby
c66449f823
Disable semicolons for class props (#7754) 2020-01-07 16:40:44 -03:30
Whymarrh Whitby
8701ac38a1
Remove useless component constructors (#7718) 2019-12-19 18:30:22 -03:30
Whymarrh Whitby
1820836833
Clean up MetaMetricsProvider constructor (#7719) 2019-12-19 14:58:23 -03:30
Whymarrh Whitby
2a8e586142
Remove unused methods from one of the many utils files (#7702) 2019-12-13 11:21:07 -03:30
Mark Stacey
2e188ce4ef
Remove unused fromDropdownOpen state in send reducer (#7700)
The unused state has been removed along with associated actions and
action creators.
2019-12-12 19:26:18 -04:00
Whymarrh Whitby
db0d59f800
Remove unused UI actions (#7675) 2019-12-12 19:48:48 -03:30
Whymarrh Whitby
4b471a4d8a
Adjust colour of Reset Account btn to reflect danger (#7696) 2019-12-12 17:03:05 -03:30
pldespaigne
0ef7f603d6 Ipfs cid v1 base32 (#7362)
add ipfs gateway to advanced settings
use ipfs gateway from settings
use ipfs.dweb.link as default CID gateway
disallow gateway.ipfs.io as gateway
2019-12-12 11:28:07 -08:00
Whymarrh Whitby
b5040266a0
Add description to Reset Account in settings (#7686)
* Add description to Reset Account in settings
* Update description copy
2019-12-12 12:10:30 -03:30
Mark Stacey
3ce19ee11d
Remove unused gasExpress fetch mocks (#7681)
These fetch mocks have been unnecessary since #7059
2019-12-10 09:52:34 -04:00
Whymarrh Whitby
8afbcd8e86
Add INR currency option (#7673) 2019-12-09 20:58:33 -03:30
Whymarrh Whitby
29da5cc7e8
Remove some unused MetaMaskController methods (#7666) 2019-12-09 13:11:44 -03:30
Whymarrh Whitby
56d9c06402
Clean up list of available currencies (#7667) 2019-12-09 13:09:46 -03:30
Mark Stacey
49a525b9f8
Add react/no-unused-prop-types ESLint rule (#7655)
* Add `react/no-unused-prop-types` rule

All detected unused prop types have been removed. I have attempted to
ensure these props are no longer passed in either.

* Update handling of props to avoid false positive lint errors

These cases were detected by `react/no-unused-prop-types` as being
unused props, even though they were used. These minor adjustments
prevent them from being flagged as errors.

* Update unit tests

Many of these tests were just checking that specific props were passed
from containers or to a child component. These were deleted, as I can't
imagine how they'd be useful.

* Disable `react/no-unused-prop-types` in `componentWillReceiveProps

The rule `react/no-unused-prop-types` doesn't seem to be detecting
props used within `UNSAFE_componentWillReceiveProps`. The two cases
have been disabled temporarily until we can replace these unsafe
lifecycle functions.
2019-12-07 23:10:47 -04:00
Mark Stacey
265d253f09
Remove unused function parameter (#7656) 2019-12-06 12:14:50 -04:00
ricky
1c4f2aab8f React 16 upgrade (#7476)
* Use arrow property initializer functions

* Use pure components where applicable

* Add UNSAFE_ prefix for deprecated lifecycle hooks

* Add allow UNSAFE_

* Removed unused "Component"

* Replace boron with 'fade-modal'

* Upgrade react/no-deprecated to an error

* Paste react-tooltip-component source directly

* Use arrow functions to bind `this`

* Add UNSAFE_ prefix

* Update react-redux, react-router-dom

* Remove things from inlined 'fade-modal'

* Adjust mountWithRouter to get unit tests passing again

* Remove domkit

* Add Wrapper to render-helpers

* Upgrade @storybook/addon-knobs
2019-12-06 11:40:06 -04:00
Mark Stacey
e87e79870a
Add missing PropTypes (#7658)
The props for `send` were also sorted, to make them easier to compare.
I only bothered because they were _almost_ sorted already.
2019-12-06 11:32:03 -04:00
Mark Stacey
b34c663712
Rename render function props from Route (#7657)
The props parameter from the `Route` render function has been renamed
to `routeProps` to avoid confusion with the component props.
2019-12-06 09:43:50 -04:00
Mark Stacey
63bd422840
Handle one specific permissions request per tab (#7620)
The connect route now takes a route parameter: the permissions request
id. This id is set whenever the permissions connect screen is opened,
ensuring that that tab is for that specific request alone.

This makes handling of multiple permissions requests a bit more
intuitive. Previously whenever opening multiple permissions requests,
the first one would be shown on each successive tab, whereas you
would expect each tab to show the request that prompted the tab to
open. Users may now address permissions request in whichever order
they'd like to, rather than being forced to deal with them
chronologically.
2019-12-05 17:05:50 -04:00
Mark Stacey
eeb329adf7
Fix the permissions connect screen MetaMask logo (#7641)
The MetaMask logo was throwing an exception because the `history` prop
from React Router wasn't being passed in. However, even if it was
passed in, clicking on the logo wouldn't have done anything because the
home route redirects back to the permission connect page.

Instead the logo now isn't given an `onClick` handler. The
`MetaFoxLogo` component has been updated to only set `cursor: pointer`
if given an `onClick` handler.
2019-12-04 19:57:30 -04:00
Dan Finlay
30304913eb
Merge pull request #7591 from whymarrh/eslint-object-curly-spacing
Enable object-curly-spacing rule for ESLint
2019-12-04 10:25:32 -08:00
Dan Finlay
6aa0bec751
Merge pull request #7573 from whymarrh/eslint-no-confusing-arrow
Enable no-confusing-arrow rule for ESLint
2019-12-04 10:23:57 -08:00
Thomas Huang
0b8f74ede5
Remove random comma (#7639) 2019-12-03 21:35:44 -08:00
Whymarrh Whitby
03f53df3f3
Updates to account search functionality (#7637) 2019-12-03 23:25:00 -03:30
Mark Stacey
2d6ad7f6ca
Update permissions request parameter names and docs (#7636)
The parameter names and JSDoc comments for `approvePermissionsRequest`
and `rejectPermissionsRequest` were incorrect in a few places.
2019-12-03 22:52:14 -04:00
Paweł Lula
638e242ce6 Search accounts by name (#7261)
Co-Authored-By: Paweł Lula <pavloblack@hotmail.com>
Co-Authored-By: Mark Stacey <markjstacey@gmail.com>
2019-12-03 22:51:55 -03:30