1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-26 12:29:06 +01:00

Adding usage instructions for Ledger Live users to confirmation screen (#12020)

* Adding usage instructions for Ledger Live users to confirmation screen

* Using design system components

* Hiding first step on Firefox
This commit is contained in:
ryanml 2021-09-07 14:46:15 -07:00 committed by GitHub
parent dc85f375f8
commit 17fe978c82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 72 additions and 0 deletions

View File

@ -1179,6 +1179,18 @@
"ledgerLiveApp": { "ledgerLiveApp": {
"message": "Ledger Live App" "message": "Ledger Live App"
}, },
"ledgerLiveDialogHeader": {
"message": "Prior to clicking confirm:"
},
"ledgerLiveDialogStepOne": {
"message": "Enable Use Ledger Live under Settings > Advanced"
},
"ledgerLiveDialogStepThree": {
"message": "Plug in your Ledger device and select the Ethereum app"
},
"ledgerLiveDialogStepTwo": {
"message": "Open and unlock Ledger Live App"
},
"ledgerLocked": { "ledgerLocked": {
"message": "Cannot connect to Ledger device. Please make sure your device is unlocked and Ethereum app is opened." "message": "Cannot connect to Ledger device. Please make sure your device is unlocked and Ethereum app is opened."
}, },

View File

@ -35,10 +35,12 @@ import TransactionDetailItem from '../../components/app/transaction-detail-item/
import InfoTooltip from '../../components/ui/info-tooltip/info-tooltip'; import InfoTooltip from '../../components/ui/info-tooltip/info-tooltip';
import LoadingHeartBeat from '../../components/ui/loading-heartbeat'; import LoadingHeartBeat from '../../components/ui/loading-heartbeat';
import GasTiming from '../../components/app/gas-timing/gas-timing.component'; import GasTiming from '../../components/app/gas-timing/gas-timing.component';
import Dialog from '../../components/ui/dialog';
import { import {
COLORS, COLORS,
FONT_STYLE, FONT_STYLE,
FONT_WEIGHT,
TYPOGRAPHY, TYPOGRAPHY,
} from '../../helpers/constants/design-system'; } from '../../helpers/constants/design-system';
import { import {
@ -124,6 +126,8 @@ export default class ConfirmTransactionBase extends Component {
baseFeePerGas: PropTypes.string, baseFeePerGas: PropTypes.string,
isMainnet: PropTypes.bool, isMainnet: PropTypes.bool,
gasFeeIsCustom: PropTypes.bool, gasFeeIsCustom: PropTypes.bool,
isLedgerAccount: PropTypes.bool.isRequired,
isFirefox: PropTypes.bool.isRequired,
}; };
state = { state = {
@ -303,6 +307,8 @@ export default class ConfirmTransactionBase extends Component {
maxFeePerGas, maxFeePerGas,
maxPriorityFeePerGas, maxPriorityFeePerGas,
isMainnet, isMainnet,
isLedgerAccount,
isFirefox,
} = this.props; } = this.props;
const { t } = this.context; const { t } = this.context;
@ -396,6 +402,51 @@ export default class ConfirmTransactionBase extends Component {
</div> </div>
) : null; ) : null;
const ledgerInstructionField = isLedgerAccount ? (
<div>
<div className="confirm-detail-row">
<Dialog type="message">
<div className="ledger-live-dialog">
<Typography
boxProps={{ margin: 0 }}
color={COLORS.PRIMARY3}
fontWeight={FONT_WEIGHT.BOLD}
variant={TYPOGRAPHY.H7}
>
{t('ledgerLiveDialogHeader')}
</Typography>
{!isFirefox && (
<Typography
boxProps={{ margin: 0 }}
color={COLORS.PRIMARY3}
fontWeight={FONT_WEIGHT.BOLD}
variant={TYPOGRAPHY.H7}
>
{`- ${t('ledgerLiveDialogStepOne')}`}
</Typography>
)}
<Typography
boxProps={{ margin: 0 }}
color={COLORS.PRIMARY3}
fontWeight={FONT_WEIGHT.BOLD}
variant={TYPOGRAPHY.H7}
>
{`- ${t('ledgerLiveDialogStepTwo')}`}
</Typography>
<Typography
boxProps={{ margin: 0 }}
color={COLORS.PRIMARY3}
fontWeight={FONT_WEIGHT.BOLD}
variant={TYPOGRAPHY.H7}
>
{`- ${t('ledgerLiveDialogStepThree')}`}
</Typography>
</div>
</Dialog>
</div>
</div>
) : null;
return ( return (
<div className="confirm-page-container-content__details"> <div className="confirm-page-container-content__details">
<TransactionDetail <TransactionDetail
@ -523,6 +574,7 @@ export default class ConfirmTransactionBase extends Component {
]} ]}
/> />
{nonceField} {nonceField}
{ledgerInstructionField}
</div> </div>
); );
} }

View File

@ -29,12 +29,16 @@ import {
getShouldShowFiat, getShouldShowFiat,
checkNetworkAndAccountSupports1559, checkNetworkAndAccountSupports1559,
getPreferences, getPreferences,
getAccountType,
} from '../../selectors'; } from '../../selectors';
import { getMostRecentOverviewPage } from '../../ducks/history/history'; import { getMostRecentOverviewPage } from '../../ducks/history/history';
import { import {
transactionMatchesNetwork, transactionMatchesNetwork,
txParamsAreDappSuggested, txParamsAreDappSuggested,
} from '../../../shared/modules/transaction.utils'; } from '../../../shared/modules/transaction.utils';
import { KEYRING_TYPES } from '../../../shared/constants/hardware-wallets';
import { getPlatform } from '../../../app/scripts/lib/util';
import { PLATFORM_FIREFOX } from '../../../shared/constants/app';
import { toChecksumHexAddress } from '../../../shared/modules/hexstring-utils'; import { toChecksumHexAddress } from '../../../shared/modules/hexstring-utils';
import { import {
updateTransactionGasFees, updateTransactionGasFees,
@ -161,6 +165,8 @@ const mapStateToProps = (state, ownProps) => {
const gasFeeIsCustom = const gasFeeIsCustom =
fullTxData.userFeeLevel === 'custom' || fullTxData.userFeeLevel === 'custom' ||
txParamsAreDappSuggested(fullTxData); txParamsAreDappSuggested(fullTxData);
const isLedgerAccount = getAccountType(state) === KEYRING_TYPES.LEDGER;
const isFirefox = getPlatform() === PLATFORM_FIREFOX;
return { return {
balance, balance,
@ -208,6 +214,8 @@ const mapStateToProps = (state, ownProps) => {
maxPriorityFeePerGas: gasEstimationObject.maxPriorityFeePerGas, maxPriorityFeePerGas: gasEstimationObject.maxPriorityFeePerGas,
baseFeePerGas: gasEstimationObject.baseFeePerGas, baseFeePerGas: gasEstimationObject.baseFeePerGas,
gasFeeIsCustom, gasFeeIsCustom,
isLedgerAccount,
isFirefox,
}; };
}; };