1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 19:26:13 +02:00
Commit Graph

2306 Commits

Author SHA1 Message Date
Mark Stacey
670ae111f0
Remove unnecessary optional chaining operator (#8892)
`state.activeTab` is always guaranteed to be set to an object before
the UI is initialized. This happens in `app/ui.js`.
2020-07-10 12:46:54 -03:00
Mark Stacey
d53c4f824e
Add personal_sign e2e test (#8958)
This tests the `personal_sign` method using the test dapp. This test
reflects part of the `confirm-sig-requests` integration test, which
tests the confirmation of a `personal_sign` signature request.

A `data-testid` prop was added to the 'Sign' button on the signature
request confirmation page, to make it easier to select the 'Sign'
button reliably.
2020-07-10 11:35:52 -03:00
Brad Decker
3cbcc913e9
update material-ui/core (#8950) 2020-07-09 16:05:44 -05:00
Mark Stacey
b485a9afb3
Add data-testid to the EthOverview balances (#8951)
Both the primary and secondary balance components on `EthOverview` now
have `data-testid` props, so that they can be more easily referenced in
e2e tests.

This required the addition of a `data-testid` prop to the component
`UserPreferencedCurrencyDisplay`, which is passed through to the
underlying `CurrencyDisplay` component.
2020-07-09 17:33:37 -03:00
Erik Marks
652db3fd36
Use string network and chain IDs (#8628)
* convert network id enums to string

* stringify appropriate chain/network ids in tests

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-07-08 14:05:09 -07:00
Brad Decker
cd4903f65e
remove ramda (#8932) 2020-07-08 15:17:53 -05:00
Thomas Huang
15d713f0ee
Standardize transaction activity conversion's currency to 'ETH' (#8934) 2020-07-07 15:15:42 -07:00
Mark Stacey
4a989c339a
Fix activity log inline buttons (#8908)
The inline speedup and speedup cancellation buttons in the activity log
were broken. An exception would be thrown upon either button being
clicked, and nothing would happen from the user's perspective.

Both handlers were being passed a transaction id, which was a holdover
from before the transaction list redesign. The handlers passed for
these two actions now have the transaction id embedded, so it doesn't
need to be passed in anymore. They expect the click event to be passed
through instead.

The handlers passed also didn't handle closing the transaction details
modal when clicked. After fixing the first problem, they still didn't
work because the speedup/cancel dialog was shown behind the transaction
details modal.

Both issues are now fixed. Both buttons now close the transaction
details modal, and trigger the appropriate action.
2020-07-03 13:03:13 -03:00
Mark Stacey
3832d694a4
Replace percentage opacity value (#8898)
The CSS `opacity` rule accepts percentages on newer browsers, but some
older browser versions we support (e.g. Firefox v60) doesn't support
them. A number is now used instead, which is supported by all browsers
we support.
2020-07-02 21:51:41 -03:00
Mark Stacey
d9a27fcf52
Prevent showing connected accounts without origin (#8891)
There was a case where the `activeTab.origin` was not set, yet the user
could still navigate to the "Connected accounts" modal, which assumes
that `activeTab.origin` is set. This would happen in Firefox when the
user opened the popup on a page internal to Firefox (e.g.
`about:blank`). The connected status indicator would still be shown,
but the UI would crash when it was clicked.

The connected status indicator is now hidden whenever
`activeTab.origin` is falsy. The 'Unconnected account' alert has also
been made impossible to trigger in that circumstance.
2020-07-02 18:26:30 -03:00
Mark Stacey
e4410724e9
Show origin in connect flow rather than site name (#8885)
The designs for the connect flow show the site `origin` below the site
icon rather than the site name. This was done for security reasons,
and because the site name is often set to an unwieldy long string.

This was accidentally undone in #8815 in the process of fixing a
separate bug. The origin has now been restored. More specific PropTypes
have been set on each use of the `domainMetadata` prop as well.
2020-07-02 14:08:43 -03:00
Dan J Miller
14fa80c105
Set min-height: 0 on page-container__bottom to fix overflow behaviour of add token list (#8874) 2020-07-01 05:52:36 -02:30
Mark Stacey
2dbb151e0b
Fix account order on unconnected account alert (#8863)
The account list on the unconnected account alert was in the wrong
order; they were in the order provided by the permissions controller
rather than by last active.

The accounts are now sorted correctly; first by last active, second by
the keyring controller order.

The `getPermittedIdentitiesForCurrentTab` selector was removed because
it is no longer used.
2020-06-25 21:05:42 -03:00
Brad Decker
83fbf6608b
Restore list item title attributes (#8858) 2020-06-24 19:41:30 -03:00
Mark Stacey
1d2644423e
Replace removed 'copy-to-clipboard' icon (#8853)
The 'copy-to-clipboard' icon was removed in #8190, and replaced with a
new 'Copy' icon component. It was still being used in two places
though, on the confirmation page for decryption and on the reveal seed
phrase screen..

The new Copy icon is now used in these two places instead. It has been
given a size of '17' to match the old icon size.
2020-06-24 12:10:29 -03:00
Brad Decker
41c8e486af
replace icons with Checkbox component (#8830)
in both permission flows the checkboxes were using the fa-check icon, and in the case
of the connected accounts popover the color of the icon was wrong. It occurred to me
while simply fixing that color would have been easier, we will be adding permissions
at some point in the future that a user will be able to 'uncheck'. This PR replaces
the usages of those icons with the Checkbox component that is equipped to handle the
interactivity of checking/unchecking.
2020-06-23 09:26:33 -05:00
Brad Decker
c07bf62a73
fix overflowing contract names and origins (#8823)
* fix overflowing contract names and origins

Moves heading and subtitle into divs with h3/h2 children so that the
div can be display flex and still have ellipses overflow. Only the
heading was display flex but I wanted the two to have similar structure.
this allows subheading to be display flex in the future.

Also uses stripHttpSchemes to remove that from origin in the subheading

* rtl ellipses on domain

* Update ui/app/components/app/transaction-list-item/index.scss

Co-authored-by: Mark Stacey <markjstacey@gmail.com>

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-06-17 11:38:15 -05:00
Mark Stacey
dafc5046ff
Hide 'Expand view' button in fullscreen (#8826)
The 'Expand view' button in the 'Account Options' menu was still being
shown on the fullscreen UI. This button is not useful in fullscreen, as
all it does is open the fullscreen UI. It is now hidden on the
fullscreen UI.
2020-06-17 00:40:56 -03:00
Erik Marks
b0187d3247
Fix permissions domain metadata retrieval (#8821)
* delete targetDomainMetadata selector

* fix permissions connect target domain metadata handling
2020-06-16 13:48:35 -07:00
Erik Marks
28cf728067 delete targetDomainMetadata selector 2020-06-16 11:34:08 -07:00
Brad Decker
4f3e9d70fa
remove top/bottom margin on info icon (#8822) 2020-06-16 13:05:03 -05:00
Brad Decker
61d9fcde35
add send token button on fullscreen asset list (#8812) 2020-06-16 13:04:51 -05:00
Mark Stacey
ec10323495
Fix site icon fallback letter (#8815)
The letter chosen for the fallback site icon was being set
inconsistently throughout the extension. The connect flow was using the
first letter of the `origin` for the letter (which was always `H`,
because `HTTP`), but the connect sites list and the account menu were
using the `name` from the domain metadata.

The `name` is now used for the fallback icon everywhere. A selector
that supplied a default domain metadata object has also been augmented
to use the `hostname` rather than the `origin` as a fallback name, to
match the behavior of the inpage provider.
2020-06-16 09:57:21 -03:00
Brad Decker
a6ee23cf9a
add hover style to list-item (#8813) 2020-06-15 17:36:32 -05:00
Mark Stacey
ad5e16cfa7
Fix site icon size (#8814)
A new `SiteIcon` component has been created for showing icons
representing web3 sites. The icon has a border and background, and it
has a fallback in case no icon is given. This new component accepts a
`size` prop that controls the size of the icon.

The old `IconWithFallback` component had a hard-coded size in the
SCSS styles for the icon, which was being overridden in a few places.
It was difficult to customize, and overly complicated.

The old `IconWithFallback` component is still used, but it's now
simpler. It only handles rendering the underlying `img` for the icon,
or the fallback letter if no image is given.

A separate `IconBorder` component has been created for the border and
white background used. It's solely used by `SiteIcon` for now, but I
intend to use it elsewhere as well, where this same pattern of a white
background is embedded.
2020-06-15 19:24:23 -03:00
Erik Marks
4dfe4e7463
Consolidate connected account alerts (#8802)
* update connected accounts appearance

* consolidate account alerts

* UnconnectedAccountAlert: use ConnectedAccountsList

* move switch account action out of menu in all views

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-06-15 12:08:53 -07:00
Brad Decker
955625278b
update button styling on home/asset page (#8800) 2020-06-15 12:02:38 -05:00
Mark Stacey
bb087e3749
Hide token transfers on ETH asset page (#8799)
Token transfers will now be hidden on the ETH asset page. Arguably
token transfers are still relevant to show on the ETH asset page
because the gas for token transfers is paid in ETH, but they weren't
being displayed in a way that highlighted this (only the token amount
was shown inline - not the gas price).

We will likely restore token transfers to the ETH asset page at a later
date, after designs have been updated to highlight their relevance to
this page.
2020-06-12 23:06:33 -03:00
Mark Stacey
31bb86c596
Fix account name editing (#8801)
Editing the name of an account was accidentally made impossible when
FontAwesome was updated in #8256, because the icon we used to use for
the edit button (`fa fa-pencil`) was no longer free. The icon has been
switched to `fas fa-pencil-alt`, which is free.
2020-06-12 23:06:19 -03:00
Mark Stacey
53769a7b3a
Update color of menu item icons (#8797)
Menu item icons are now grey instead of black, as requested in design
QA feedback.
2020-06-12 17:09:47 -03:00
Mark Stacey
cf08131b49
Show fiat balance on token page (#8791)
The token page overview now shows the balance in fiat.
2020-06-12 15:47:39 -03:00
Mark Stacey
a100c55e64
Hide token fiat amounts on testnets (#8792)
The token amount is no longer shown in fiat on testnets, unless the
user has enabled the "Show fiat on testnets" setting.
2020-06-12 15:47:23 -03:00
Brad Decker
2f50e9fd72
Restore timing function (#8774)
* restore and enhance the time est feature

background: we had a feature for showing a time estimate on pending txs
that was accidently removed during the redesign implementation. This PR
restores that feature and also enhances it:
1. Displays the time estimate on all views instead of just fullscreen
2. Uses Intl.RelativeTimeFormat to format the time
3. Adds a way to toggle the feature flag.
4. Uses a hook to calculate the time remaining instead of a component

* Update app/_locales/en/messages.json

Co-authored-by: Mark Stacey <markjstacey@gmail.com>

* do not display on test nets

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-06-12 13:46:01 -05:00
Erik Marks
1323233cfa
Make permission approval redirect flow consistent (#8755)
* make redirect flow consistent

* remove cancel redirect

* extract redirect component into own file
2020-06-12 09:38:20 -07:00
Brad Decker
73ba992125
use UI button for add token functionality (#8781) 2020-06-12 11:22:00 -05:00
Erik Marks
d8e7fb4c42 address review feedback 2020-06-11 14:11:50 -07:00
Erik Marks
ea398abc5d make redirect flow consistent 2020-06-10 16:44:09 -07:00
Brad Decker
a4e5fc934d
restore status tooltip (#8745)
initially set out to add the failed tooltip back to the transaction list, but
in the process rediscovered the transaction-status component which illuminated
a fair number of statuses that were not properly handled by the refactor of the
list. These statuses were discussed with UX and engineering team members to come
up with a definitive list of statuses that should be reflected in the UI

Changes:
1. normalized the color of status labels to use Red-500 and Orange-500 where applicable
2. added a new color of icon for pending transactions -- grey
3. added support for dropped and rejected labels
4. failed, dropped, rejected and cancelled all have red icons now.
5. cancelled transactions will reflect a change in the user's balance
6. tooltip displayed for failed transactions
7. Icon logic isolated to a new component.
2020-06-10 15:38:34 -05:00
Mark Stacey
0b86283c10
Create useTokenFiatAmount hook (#8778)
This hook is responsible for converting a token balance to fiat. It has
been extracted from the `TokenCell` component, and will be used
elsewhere in a future PR.
2020-06-10 16:04:29 -03:00
Brad Decker
13d6803698
Adds the rule of hooks eslint rule (#8779) 2020-06-10 13:31:14 -05:00
Mark Stacey
e4a77ea631
Extract token to fiat conversion (#8777)
The conversion of token amounts to fiat amounts was extracted from the
`TokenCell` component, and moved to a utility function. This will be
used elsewhere in an upcoming PR.
2020-06-10 15:04:56 -03:00
Mark Stacey
cfadc7592e
Avoid mutating module export (#8775)
The `eth-contracts-metadata` export was mutated in `token-list.js` to
add the token address to the contract metadata, and this was taken
advantage of in the token search component.

Instead, the address is now added to a copy of the token metadata in
the one place it's used. The module export is no longer mutated, and
the unused `defaultTokens` variable in `token-list.js` has been
removed.
2020-06-10 13:27:35 -03:00
Erik Marks
a84eedb7da
Permissions: Do not display HTTP/HTTPS URL schemes for unique hosts (#8768)
* only show URL.host in connected-accounts component

* strip scheme from URL for unique hosts

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-06-09 13:56:24 -07:00
Brad Decker
e82a8a5f52
Fix prop type mismatch (#8754) 2020-06-05 15:06:15 -07:00
Brad Decker
1eed8dc167
use grid template to position list item (#8753)
Using flex was getting out of hand, I noticed on develop that when
a pending transaction is coming in the speed up and cancel buttons
cause the icon to center according ot their height as well. A grid
is really what is needed. This seemingly greatly simplifies the CSS
AND html (removes unnecessary nesting of divs)
2020-06-05 16:33:51 -05:00
Mark Stacey
f5ec16c65a
Fix account menu entry for imported accounts (#8747)
The entry for imported accounts in the account menu looked wrong with
the new connected site icon - there was no padding between the site
icon and the 'imported' label. The entry was pretty crowded with these
three symbols as well (the third being the 'x' used to remove the
account).

The site icon has been made the right-most icon, so that it lines up
with the site icons shown for other accounts, and spacing has been
added between the site icon and the 'imported' label.

The 'x' used to remove accounts has been removed. Accounts can still be
removed from the 'Account Options' menu on the Home screen. This seemed
like the wrong place for this button to exist, as it's the only action
that can be taken from that menu aside from navigation.
2020-06-05 17:24:51 -03:00
Mark Stacey
9a1f27fe04
Refactor TokenBalance component (#8752)
The `TokenBalance` component now uses the new `useTokenTracker` hook
instead of the `withTokenTracker` higher-order component. The component
was converted from a split container/component to a functional
component so that the hook could be used.

The prop `withSymbol` was removed from a few call sites, as it was no
longer used. An empty string was substituted for any falsy `string` or
`symbol` because that's what the `withTokenTracker` higher-order
component did.
2020-06-05 17:19:27 -03:00
Mark Stacey
799536c35f
Fix 'Remove account' in Account Options menu (#8748)
The 'Remove account' button in the Account Options menu was broken.
Clicking it would crash the UI. It now correctly opens the 'Remove
Account' modal.
2020-06-05 16:01:06 -03:00
Brad Decker
7fcf625549
asset outdated warning inline on full screen (#8734)
The asset list item and transaction list item do not make great use of
screen realestate when in fullscreen mode on larger displays/windows.
This PR adds in a new prop for list-item for displaying content in the
middle of the list-item when on these types of screens. To facilitate
this, some updates were made to styling to allow for the list item to
better control how items are laid out in various breakpoints.

This works makes it possible to display the outdated balance warning
inline in the middle section of the list item, and convert to a tooltip
when on small displays.
2020-06-05 13:36:40 -05:00
Mark Stacey
8e1f40aedb
Handle connected accounts with no last active time (#8746)
The "Connected accounts" modal was throwing an exception when
attempting to render an account that has no `lastActive` time. The
component and related selector has been updated to no longer expect
the `lastActive` time to be set.

Prior to #8653 there was a guarantee that all connected accounts had a
`lastActive` time set, as the time would be set on any account returned
from the `eth_requestAccounts` call. But after #8653 only the primary
account was returned, so only the primary account had a `lastActive`
time set.

Fixes #8733
2020-06-05 13:07:23 -03:00