mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 09:57:02 +01:00
* account name & address in send view UI update & fix * update scss in send modal view * send account address - refacto func
This commit is contained in:
parent
958535d5df
commit
59054519ba
@ -40,6 +40,7 @@ import {
|
|||||||
checkNetworkAndAccountSupports1559,
|
checkNetworkAndAccountSupports1559,
|
||||||
getUseTokenDetection,
|
getUseTokenDetection,
|
||||||
getTokenList,
|
getTokenList,
|
||||||
|
getAddressBookEntryOrAccountName,
|
||||||
} from '../../selectors';
|
} from '../../selectors';
|
||||||
import {
|
import {
|
||||||
disconnectGasFeeEstimatePoller,
|
disconnectGasFeeEstimatePoller,
|
||||||
@ -1444,12 +1445,12 @@ export function useMyAccountsForRecipientSearch() {
|
|||||||
export function updateRecipient({ address, nickname }) {
|
export function updateRecipient({ address, nickname }) {
|
||||||
return async (dispatch, getState) => {
|
return async (dispatch, getState) => {
|
||||||
const state = getState();
|
const state = getState();
|
||||||
const nicknameFromAddressBook =
|
const nicknameFromAddressBookEntryOrAccountName =
|
||||||
getAddressBookEntry(state, address)?.name ?? '';
|
getAddressBookEntryOrAccountName(state, address) ?? '';
|
||||||
await dispatch(
|
await dispatch(
|
||||||
actions.updateRecipient({
|
actions.updateRecipient({
|
||||||
address,
|
address,
|
||||||
nickname: nickname || nicknameFromAddressBook,
|
nickname: nickname || nicknameFromAddressBookEntryOrAccountName,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
await dispatch(computeEstimatedGasLimit());
|
await dispatch(computeEstimatedGasLimit());
|
||||||
|
@ -1626,6 +1626,7 @@ describe('Send Slice', () => {
|
|||||||
const updateRecipientState = {
|
const updateRecipientState = {
|
||||||
metamask: {
|
metamask: {
|
||||||
addressBook: {},
|
addressBook: {},
|
||||||
|
identities: {},
|
||||||
provider: {
|
provider: {
|
||||||
chainId: '0x1',
|
chainId: '0x1',
|
||||||
},
|
},
|
||||||
@ -1740,6 +1741,7 @@ describe('Send Slice', () => {
|
|||||||
const tokenState = {
|
const tokenState = {
|
||||||
metamask: {
|
metamask: {
|
||||||
addressBook: {},
|
addressBook: {},
|
||||||
|
identities: {},
|
||||||
blockGasLimit: '',
|
blockGasLimit: '',
|
||||||
selectedAddress: '',
|
selectedAddress: '',
|
||||||
provider: {
|
provider: {
|
||||||
@ -1794,6 +1796,7 @@ describe('Send Slice', () => {
|
|||||||
const updateRecipientState = {
|
const updateRecipientState = {
|
||||||
metamask: {
|
metamask: {
|
||||||
addressBook: {},
|
addressBook: {},
|
||||||
|
identities: {},
|
||||||
provider: {
|
provider: {
|
||||||
chainId: '',
|
chainId: '',
|
||||||
},
|
},
|
||||||
|
@ -2,7 +2,6 @@ import React, { Component } from 'react';
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import classnames from 'classnames';
|
import classnames from 'classnames';
|
||||||
|
|
||||||
import { ellipsify } from '../../send.utils';
|
|
||||||
import { isValidDomainName } from '../../../../helpers/utils/util';
|
import { isValidDomainName } from '../../../../helpers/utils/util';
|
||||||
import {
|
import {
|
||||||
isBurnAddress,
|
isBurnAddress,
|
||||||
@ -106,9 +105,9 @@ export default class EnsInput extends Component {
|
|||||||
<>
|
<>
|
||||||
<div className="ens-input__wrapper__input ens-input__wrapper__input--selected">
|
<div className="ens-input__wrapper__input ens-input__wrapper__input--selected">
|
||||||
<div className="ens-input__selected-input__title">
|
<div className="ens-input__selected-input__title">
|
||||||
{selectedName || ellipsify(selectedAddress)}
|
{selectedName || selectedAddress}
|
||||||
</div>
|
</div>
|
||||||
{selectedName && (
|
{selectedName !== selectedAddress && (
|
||||||
<div className="ens-input__selected-input__subtitle">
|
<div className="ens-input__selected-input__subtitle">
|
||||||
{selectedAddress}
|
{selectedAddress}
|
||||||
</div>
|
</div>
|
||||||
|
@ -180,17 +180,13 @@
|
|||||||
&__status-icon {
|
&__status-icon {
|
||||||
@extend %bg-contain;
|
@extend %bg-contain;
|
||||||
|
|
||||||
background-image: url("/images/search-black.svg");
|
background-image: url('/images/search-black.svg');
|
||||||
width: 1.125rem;
|
width: 1.125rem;
|
||||||
height: 1.125rem;
|
height: 1.125rem;
|
||||||
margin: 0.25rem 0.5rem 0.25rem 0.25rem;
|
margin: 0.25rem 0.5rem 0.25rem 0.25rem;
|
||||||
|
|
||||||
&--error {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
&--valid {
|
&--valid {
|
||||||
background-image: url("/images/check-green-solid.svg");
|
background-image: url('/images/check-green-solid.svg');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -213,7 +209,7 @@
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
||||||
&--erase {
|
&--erase {
|
||||||
background-image: url("/images/close-gray.svg");
|
background-image: url('/images/close-gray.svg');
|
||||||
background-color: unset;
|
background-color: unset;
|
||||||
width: 0.75rem;
|
width: 0.75rem;
|
||||||
height: 0.75rem;
|
height: 0.75rem;
|
||||||
@ -221,7 +217,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
&--qrcode {
|
&--qrcode {
|
||||||
background-image: url("/images/qr-blue.svg");
|
background-image: url('/images/qr-blue.svg');
|
||||||
background-color: unset;
|
background-color: unset;
|
||||||
width: 1.5rem;
|
width: 1.5rem;
|
||||||
height: 1.5rem;
|
height: 1.5rem;
|
||||||
@ -234,7 +230,7 @@
|
|||||||
|
|
||||||
.ens-input__wrapper {
|
.ens-input__wrapper {
|
||||||
&__status-icon {
|
&__status-icon {
|
||||||
background-image: url("/images/check-green-solid.svg");
|
background-image: url('/images/check-green-solid.svg');
|
||||||
}
|
}
|
||||||
|
|
||||||
&__input {
|
&__input {
|
||||||
@ -253,6 +249,9 @@
|
|||||||
@include H6;
|
@include H6;
|
||||||
|
|
||||||
@extend %ellipsify;
|
@extend %ellipsify;
|
||||||
|
|
||||||
|
word-wrap: break-word;
|
||||||
|
white-space: inherit !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
&__subtitle {
|
&__subtitle {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { compose } from 'redux';
|
import { compose } from 'redux';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { withRouter } from 'react-router-dom';
|
import { withRouter } from 'react-router-dom';
|
||||||
import { getAddressBookEntryName } from '../../selectors';
|
import { getAddressBookEntryOrAccountName } from '../../selectors';
|
||||||
import { ENVIRONMENT_TYPE_POPUP } from '../../../shared/constants/app';
|
import { ENVIRONMENT_TYPE_POPUP } from '../../../shared/constants/app';
|
||||||
import { getEnvironmentType } from '../../../app/scripts/lib/util';
|
import { getEnvironmentType } from '../../../app/scripts/lib/util';
|
||||||
import { getMostRecentOverviewPage } from '../../ducks/history/history';
|
import { getMostRecentOverviewPage } from '../../ducks/history/history';
|
||||||
@ -72,7 +72,7 @@ const mapStateToProps = (state, ownProps) => {
|
|||||||
let initialBreadCrumbRoute;
|
let initialBreadCrumbRoute;
|
||||||
let initialBreadCrumbKey;
|
let initialBreadCrumbKey;
|
||||||
|
|
||||||
const addressName = getAddressBookEntryName(
|
const addressName = getAddressBookEntryOrAccountName(
|
||||||
state,
|
state,
|
||||||
!isBurnAddress(pathNameTail) &&
|
!isBurnAddress(pathNameTail) &&
|
||||||
isValidHexAddress(pathNameTail, { mixedCaseUseChecksum: true })
|
isValidHexAddress(pathNameTail, { mixedCaseUseChecksum: true })
|
||||||
|
@ -303,10 +303,13 @@ export function getAddressBookEntry(state, address) {
|
|||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getAddressBookEntryName(state, address) {
|
export function getAddressBookEntryOrAccountName(state, address) {
|
||||||
const entry =
|
const entry =
|
||||||
getAddressBookEntry(state, address) || state.metamask.identities[address];
|
getAddressBookEntry(state, address) ||
|
||||||
return entry && entry.name !== '' ? entry.name : shortenAddress(address);
|
Object.values(state.metamask.identities).find((identity) =>
|
||||||
|
isEqualCaseInsensitive(identity.address, toChecksumHexAddress(address)),
|
||||||
|
);
|
||||||
|
return entry && entry.name !== '' ? entry.name : address;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function accountsWithSendEtherInfoSelector(state) {
|
export function accountsWithSendEtherInfoSelector(state) {
|
||||||
|
Loading…
Reference in New Issue
Block a user