mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-12 20:57:12 +01:00
badebe017f
* Add UnitInput component * Add CurrencyInput component * Add UserPreferencedCurrencyInput component * Add UserPreferencedCurrencyDisplay component * Add updatePreferences action * Add styles for CurrencyInput, CurrencyDisplay, and UnitInput * Update SettingsTab page with Primary Currency toggle * Refactor currency displays and inputs to use UserPreferenced displays and inputs * Add TokenInput component * Add UserPreferencedTokenInput component * Use TokenInput in the send screen * Fix unit tests * Fix e2e and integration tests * Remove send/CurrencyDisplay component * Replace diamond unicode character with Eth logo. Fix typos
138 lines
3.9 KiB
JavaScript
138 lines
3.9 KiB
JavaScript
import React, { Component } from 'react'
|
|
import PropTypes from 'prop-types'
|
|
import SenderToRecipient from '../sender-to-recipient'
|
|
import { PageContainerFooter } from '../page-container'
|
|
import { ConfirmPageContainerHeader, ConfirmPageContainerContent } from './'
|
|
|
|
export default class ConfirmPageContainer extends Component {
|
|
static contextTypes = {
|
|
t: PropTypes.func,
|
|
}
|
|
|
|
static propTypes = {
|
|
// Header
|
|
action: PropTypes.string,
|
|
hideSubtitle: PropTypes.bool,
|
|
onEdit: PropTypes.func,
|
|
showEdit: PropTypes.bool,
|
|
subtitle: PropTypes.string,
|
|
subtitleComponent: PropTypes.node,
|
|
title: PropTypes.string,
|
|
titleComponent: PropTypes.node,
|
|
// Sender to Recipient
|
|
fromAddress: PropTypes.string,
|
|
fromName: PropTypes.string,
|
|
toAddress: PropTypes.string,
|
|
toName: PropTypes.string,
|
|
// Content
|
|
contentComponent: PropTypes.node,
|
|
errorKey: PropTypes.string,
|
|
errorMessage: PropTypes.string,
|
|
fiatTransactionAmount: PropTypes.string,
|
|
fiatTransactionFee: PropTypes.string,
|
|
fiatTransactionTotal: PropTypes.string,
|
|
ethTransactionAmount: PropTypes.string,
|
|
ethTransactionFee: PropTypes.string,
|
|
ethTransactionTotal: PropTypes.string,
|
|
onEditGas: PropTypes.func,
|
|
dataComponent: PropTypes.node,
|
|
detailsComponent: PropTypes.node,
|
|
identiconAddress: PropTypes.string,
|
|
nonce: PropTypes.string,
|
|
assetImage: PropTypes.string,
|
|
summaryComponent: PropTypes.node,
|
|
warning: PropTypes.string,
|
|
unapprovedTxCount: PropTypes.number,
|
|
// Footer
|
|
onCancelAll: PropTypes.func,
|
|
onCancel: PropTypes.func,
|
|
onSubmit: PropTypes.func,
|
|
disabled: PropTypes.bool,
|
|
}
|
|
|
|
render () {
|
|
const {
|
|
showEdit,
|
|
onEdit,
|
|
fromName,
|
|
fromAddress,
|
|
toName,
|
|
toAddress,
|
|
disabled,
|
|
errorKey,
|
|
errorMessage,
|
|
contentComponent,
|
|
action,
|
|
title,
|
|
titleComponent,
|
|
subtitle,
|
|
subtitleComponent,
|
|
hideSubtitle,
|
|
summaryComponent,
|
|
detailsComponent,
|
|
dataComponent,
|
|
onCancelAll,
|
|
onCancel,
|
|
onSubmit,
|
|
identiconAddress,
|
|
nonce,
|
|
unapprovedTxCount,
|
|
assetImage,
|
|
warning,
|
|
} = this.props
|
|
const renderAssetImage = contentComponent || (!contentComponent && !identiconAddress)
|
|
|
|
return (
|
|
<div className="page-container">
|
|
<ConfirmPageContainerHeader
|
|
showEdit={showEdit}
|
|
onEdit={() => onEdit()}
|
|
>
|
|
<SenderToRecipient
|
|
senderName={fromName}
|
|
senderAddress={fromAddress}
|
|
recipientName={toName}
|
|
recipientAddress={toAddress}
|
|
assetImage={renderAssetImage ? assetImage : undefined}
|
|
/>
|
|
</ConfirmPageContainerHeader>
|
|
{
|
|
contentComponent || (
|
|
<ConfirmPageContainerContent
|
|
action={action}
|
|
title={title}
|
|
titleComponent={titleComponent}
|
|
subtitle={subtitle}
|
|
subtitleComponent={subtitleComponent}
|
|
hideSubtitle={hideSubtitle}
|
|
summaryComponent={summaryComponent}
|
|
detailsComponent={detailsComponent}
|
|
dataComponent={dataComponent}
|
|
errorMessage={errorMessage}
|
|
errorKey={errorKey}
|
|
identiconAddress={identiconAddress}
|
|
nonce={nonce}
|
|
assetImage={assetImage}
|
|
warning={warning}
|
|
/>
|
|
)
|
|
}
|
|
<PageContainerFooter
|
|
onCancel={() => onCancel()}
|
|
cancelText={this.context.t('reject')}
|
|
onSubmit={() => onSubmit()}
|
|
submitText={this.context.t('confirm')}
|
|
submitButtonType="confirm"
|
|
disabled={disabled}
|
|
>
|
|
{unapprovedTxCount > 1 && (
|
|
<a onClick={() => onCancelAll()}>
|
|
{this.context.t('rejectTxsN', [unapprovedTxCount])}
|
|
</a>
|
|
)}
|
|
</PageContainerFooter>
|
|
</div>
|
|
)
|
|
}
|
|
}
|