Remove unused transaction base props (#10295)

These props were never given. They have been removed to simplify the
component.
feature/default_network_editable
Mark Stacey 4 years ago committed by GitHub
parent 419897cba6
commit ecff9dfcb0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      ui/app/components/app/confirm-page-container/confirm-page-container-content/confirm-page-container-content.component.js
  2. 4
      ui/app/components/app/confirm-page-container/confirm-page-container-content/confirm-page-container-summary/confirm-page-container-summary.component.js
  3. 6
      ui/app/components/app/confirm-page-container/confirm-page-container.component.js
  4. 75
      ui/app/pages/confirm-transaction-base/confirm-transaction-base.component.js

@ -17,9 +17,7 @@ export default class ConfirmPageContainerContent extends Component {
identiconAddress: PropTypes.string,
nonce: PropTypes.string,
assetImage: PropTypes.string,
subtitle: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
subtitleComponent: PropTypes.node,
summaryComponent: PropTypes.node,
title: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
titleComponent: PropTypes.node,
warning: PropTypes.string,
@ -65,13 +63,11 @@ export default class ConfirmPageContainerContent extends Component {
errorMessage,
title,
titleComponent,
subtitle,
subtitleComponent,
hideSubtitle,
identiconAddress,
nonce,
assetImage,
summaryComponent,
detailsComponent,
dataComponent,
warning,
@ -88,7 +84,6 @@ export default class ConfirmPageContainerContent extends Component {
return (
<div className="confirm-page-container-content">
{warning && <ConfirmPageContainerWarning warning={warning} />}
{summaryComponent || (
<ConfirmPageContainerSummary
className={classnames({
'confirm-page-container-summary--border':
@ -97,14 +92,12 @@ export default class ConfirmPageContainerContent extends Component {
action={action}
title={title}
titleComponent={titleComponent}
subtitle={subtitle}
subtitleComponent={subtitleComponent}
hideSubtitle={hideSubtitle}
identiconAddress={identiconAddress}
nonce={nonce}
assetImage={assetImage}
/>
)}
{this.renderContent()}
{(errorKey || errorMessage) && (
<div className="confirm-page-container-content__error-container">

@ -8,7 +8,6 @@ const ConfirmPageContainerSummary = (props) => {
action,
title,
titleComponent,
subtitle,
subtitleComponent,
hideSubtitle,
className,
@ -42,7 +41,7 @@ const ConfirmPageContainerSummary = (props) => {
</div>
{hideSubtitle || (
<div className="confirm-page-container-summary__subtitle">
{subtitleComponent || subtitle}
{subtitleComponent}
</div>
)}
</div>
@ -53,7 +52,6 @@ ConfirmPageContainerSummary.propTypes = {
action: PropTypes.string,
title: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
titleComponent: PropTypes.node,
subtitle: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
subtitleComponent: PropTypes.node,
hideSubtitle: PropTypes.bool,
className: PropTypes.string,

@ -19,7 +19,6 @@ export default class ConfirmPageContainer extends Component {
hideSubtitle: PropTypes.bool,
onEdit: PropTypes.func,
showEdit: PropTypes.bool,
subtitle: PropTypes.string,
subtitleComponent: PropTypes.node,
title: PropTypes.string,
titleComponent: PropTypes.node,
@ -41,7 +40,6 @@ export default class ConfirmPageContainer extends Component {
identiconAddress: PropTypes.string,
nonce: PropTypes.string,
assetImage: PropTypes.string,
summaryComponent: PropTypes.node,
warning: PropTypes.string,
unapprovedTxCount: PropTypes.number,
// Navigation
@ -79,10 +77,8 @@ export default class ConfirmPageContainer extends Component {
action,
title,
titleComponent,
subtitle,
subtitleComponent,
hideSubtitle,
summaryComponent,
detailsComponent,
dataComponent,
onCancelAll,
@ -146,10 +142,8 @@ export default class ConfirmPageContainer extends Component {
action={action}
title={title}
titleComponent={titleComponent}
subtitle={subtitle}
subtitleComponent={subtitleComponent}
hideSubtitle={hideSubtitle}
summaryComponent={summaryComponent}
detailsComponent={detailsComponent}
dataComponent={dataComponent}
errorMessage={errorMessage}

@ -70,31 +70,19 @@ export default class ConfirmTransactionBase extends Component {
actionKey: PropTypes.string,
contentComponent: PropTypes.node,
dataComponent: PropTypes.node,
detailsComponent: PropTypes.node,
errorKey: PropTypes.string,
errorMessage: PropTypes.string,
primaryTotalTextOverride: PropTypes.oneOfType([
PropTypes.string,
PropTypes.node,
]),
secondaryTotalTextOverride: PropTypes.string,
hideData: PropTypes.bool,
hideDetails: PropTypes.bool,
hideSubtitle: PropTypes.bool,
identiconAddress: PropTypes.string,
onCancel: PropTypes.func,
onEdit: PropTypes.func,
onEditGas: PropTypes.func,
onSubmit: PropTypes.func,
setMetaMetricsSendCount: PropTypes.func,
metaMetricsSendCount: PropTypes.number,
subtitle: PropTypes.string,
subtitleComponent: PropTypes.node,
summaryComponent: PropTypes.node,
title: PropTypes.string,
titleComponent: PropTypes.node,
valid: PropTypes.bool,
warning: PropTypes.string,
advancedInlineGasShown: PropTypes.bool,
insufficientBalance: PropTypes.bool,
hideFiatConversion: PropTypes.bool,
@ -212,7 +200,6 @@ export default class ConfirmTransactionBase extends Component {
handleEditGas() {
const {
onEditGas,
showCustomizeGasModal,
actionKey,
txData: { origin },
@ -235,21 +222,15 @@ export default class ConfirmTransactionBase extends Component {
},
})
if (onEditGas) {
onEditGas()
} else {
showCustomizeGasModal()
}
}
renderDetails() {
const {
detailsComponent,
primaryTotalTextOverride,
secondaryTotalTextOverride,
hexTransactionFee,
hexTransactionTotal,
hideDetails,
useNonceField,
customNonceValue,
updateCustomNonce,
@ -263,14 +244,9 @@ export default class ConfirmTransactionBase extends Component {
isMainnet,
} = this.props
if (hideDetails) {
return null
}
const notMainnetOrTest = !(isMainnet || process.env.IN_TEST)
return (
detailsComponent || (
<div className="confirm-page-container-content__details">
<div className="confirm-page-container-content__gas-fee">
<ConfirmDetailRow
@ -280,9 +256,7 @@ export default class ConfirmTransactionBase extends Component {
headerTextClassName={
notMainnetOrTest ? '' : 'confirm-detail-row__header-text--edit'
}
onHeaderClick={
notMainnetOrTest ? null : () => this.handleEditGas()
}
onHeaderClick={notMainnetOrTest ? null : () => this.handleEditGas()}
secondaryText={
hideFiatConversion
? this.context.t('noConversionRateAvailable')
@ -335,9 +309,7 @@ export default class ConfirmTransactionBase extends Component {
type="number"
min="0"
placeholder={
typeof nextNonce === 'number'
? nextNonce.toString()
: null
typeof nextNonce === 'number' ? nextNonce.toString() : null
}
onChange={({ target: { value } }) => {
if (!value.length || Number(value) < 0) {
@ -357,7 +329,6 @@ export default class ConfirmTransactionBase extends Component {
) : null}
</div>
)
)
}
renderData(functionType) {
@ -455,7 +426,6 @@ export default class ConfirmTransactionBase extends Component {
handleCancel() {
const { metricsEvent } = this.context
const {
onCancel,
txData,
cancelTransaction,
history,
@ -484,15 +454,11 @@ export default class ConfirmTransactionBase extends Component {
},
})
updateCustomNonce('')
if (onCancel) {
onCancel(txData)
} else {
cancelTransaction(txData).then(() => {
clearConfirmTransaction()
history.push(mostRecentOverviewPage)
})
}
}
handleSubmit() {
const { metricsEvent } = this.context
@ -502,7 +468,6 @@ export default class ConfirmTransactionBase extends Component {
clearConfirmTransaction,
txData,
history,
onSubmit,
actionKey,
mostRecentOverviewPage,
metaMetricsSendCount = 0,
@ -540,14 +505,6 @@ export default class ConfirmTransactionBase extends Component {
})
setMetaMetricsSendCount(metaMetricsSendCount + 1).then(() => {
if (onSubmit) {
Promise.resolve(onSubmit(txData)).then(() => {
this.setState({
submitting: false,
})
updateCustomNonce('')
})
} else {
sendTransaction(txData)
.then(() => {
clearConfirmTransaction()
@ -568,14 +525,13 @@ export default class ConfirmTransactionBase extends Component {
})
updateCustomNonce('')
})
}
})
},
)
}
renderTitleComponent() {
const { title, titleComponent, hexTransactionAmount } = this.props
const { title, hexTransactionAmount } = this.props
// Title string passed in by props takes priority
if (title) {
@ -583,7 +539,6 @@ export default class ConfirmTransactionBase extends Component {
}
return (
titleComponent || (
<UserPreferencedCurrencyDisplay
value={hexTransactionAmount}
type={PRIMARY}
@ -592,16 +547,10 @@ export default class ConfirmTransactionBase extends Component {
hideLabel
/>
)
)
}
renderSubtitleComponent() {
const { subtitle, subtitleComponent, hexTransactionAmount } = this.props
// Subtitle string passed in by props takes priority
if (subtitle) {
return null
}
const { subtitleComponent, hexTransactionAmount } = this.props
return (
subtitleComponent || (
@ -708,20 +657,14 @@ export default class ConfirmTransactionBase extends Component {
toEns,
toNickname,
methodData,
valid: propsValid = true,
errorMessage,
errorKey: propsErrorKey,
title,
subtitle,
hideSubtitle,
identiconAddress,
summaryComponent,
contentComponent,
onEdit,
nonce,
customNonceValue,
assetImage,
warning,
unapprovedTxCount,
transactionCategory,
hideSenderToRecipient,
@ -765,10 +708,8 @@ export default class ConfirmTransactionBase extends Component {
action={functionType}
title={title}
titleComponent={this.renderTitleComponent()}
subtitle={subtitle}
subtitleComponent={this.renderSubtitleComponent()}
hideSubtitle={hideSubtitle}
summaryComponent={summaryComponent}
detailsComponent={this.renderDetails()}
dataComponent={this.renderData(functionType)}
contentComponent={contentComponent}
@ -776,9 +717,9 @@ export default class ConfirmTransactionBase extends Component {
unapprovedTxCount={unapprovedTxCount}
assetImage={assetImage}
identiconAddress={identiconAddress}
errorMessage={errorMessage || submitError}
errorKey={propsErrorKey || errorKey}
warning={warning || submitWarning}
errorMessage={submitError}
errorKey={errorKey}
warning={submitWarning}
totalTx={totalTx}
positionOfCurrentTx={positionOfCurrentTx}
nextTxId={nextTxId}
@ -789,7 +730,7 @@ export default class ConfirmTransactionBase extends Component {
lastTx={lastTx}
ofText={ofText}
requestsWaitingText={requestsWaitingText}
disabled={!propsValid || !valid || submitting}
disabled={!valid || submitting}
onEdit={() => this.handleEdit()}
onCancelAll={() => this.handleCancelAll()}
onCancel={() => this.handleCancel()}

Loading…
Cancel
Save