1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

convert contextType to static prop for refactored components

This commit is contained in:
trejgun 2018-07-02 10:09:28 +08:00 committed by TrejGun
parent b2e64f24ec
commit c94f639de5
14 changed files with 57 additions and 60 deletions

View File

@ -17,6 +17,10 @@ export default class AccountListItem extends Component {
icon: PropTypes.node, icon: PropTypes.node,
}; };
static contextTypes = {
t: PropTypes.func,
};
render () { render () {
const { const {
account, account,
@ -67,8 +71,3 @@ export default class AccountListItem extends Component {
</div>) </div>)
} }
} }
AccountListItem.contextTypes = {
t: PropTypes.func,
}

View File

@ -13,6 +13,10 @@ export default class AmountMaxButton extends Component {
tokenBalance: PropTypes.string, tokenBalance: PropTypes.string,
}; };
static contextTypes = {
t: PropTypes.func,
};
setMaxAmount () { setMaxAmount () {
const { const {
balance, balance,
@ -48,7 +52,3 @@ export default class AmountMaxButton extends Component {
} }
} }
AmountMaxButton.contextTypes = {
t: PropTypes.func,
}

View File

@ -24,7 +24,11 @@ export default class SendAmountRow extends Component {
updateSendAmount: PropTypes.func, updateSendAmount: PropTypes.func,
updateSendAmountError: PropTypes.func, updateSendAmountError: PropTypes.func,
updateGas: PropTypes.func, updateGas: PropTypes.func,
} };
static contextTypes = {
t: PropTypes.func,
};
validateAmount (amount) { validateAmount (amount) {
const { const {
@ -102,8 +106,3 @@ export default class SendAmountRow extends Component {
} }
} }
SendAmountRow.contextTypes = {
t: PropTypes.func,
}

View File

@ -11,6 +11,10 @@ export default class SendDropdownList extends Component {
activeAddress: PropTypes.string, activeAddress: PropTypes.string,
}; };
static contextTypes = {
t: PropTypes.func,
};
getListItemIcon (accountAddress, activeAddress) { getListItemIcon (accountAddress, activeAddress) {
return accountAddress === activeAddress return accountAddress === activeAddress
? <i className={`fa fa-check fa-lg`} style={ { color: '#02c9b1' } }/> ? <i className={`fa fa-check fa-lg`} style={ { color: '#02c9b1' } }/>
@ -46,7 +50,3 @@ export default class SendDropdownList extends Component {
} }
} }
SendDropdownList.contextTypes = {
t: PropTypes.func,
}

View File

@ -14,6 +14,10 @@ export default class FromDropdown extends Component {
selectedAccount: PropTypes.object, selectedAccount: PropTypes.object,
}; };
static contextTypes = {
t: PropTypes.func,
};
render () { render () {
const { const {
accounts, accounts,
@ -40,7 +44,3 @@ export default class FromDropdown extends Component {
} }
} }
FromDropdown.contextTypes = {
t: PropTypes.func,
}

View File

@ -17,6 +17,10 @@ export default class SendFromRow extends Component {
setSendTokenBalance: PropTypes.func, setSendTokenBalance: PropTypes.func,
}; };
static contextTypes = {
t: PropTypes.func,
};
async handleFromChange (newFrom) { async handleFromChange (newFrom) {
const { const {
updateSendFrom, updateSendFrom,
@ -57,7 +61,3 @@ export default class SendFromRow extends Component {
} }
} }
SendFromRow.contextTypes = {
t: PropTypes.func,
}

View File

@ -14,6 +14,10 @@ export default class GasFeeDisplay extends Component {
onClick: PropTypes.func, onClick: PropTypes.func,
}; };
static contextTypes = {
t: PropTypes.func,
};
render() { render() {
const { const {
conversionRate, conversionRate,
@ -55,7 +59,3 @@ export default class GasFeeDisplay extends Component {
) )
} }
} }
GasFeeDisplay.contextTypes = {
t: PropTypes.func,
}

View File

@ -13,6 +13,10 @@ export default class SendGasRow extends Component {
showCustomizeGasModal: PropTypes.func, showCustomizeGasModal: PropTypes.func,
}; };
static contextTypes = {
t: PropTypes.func,
};
render () { render () {
const { const {
conversionRate, conversionRate,
@ -36,7 +40,3 @@ export default class SendGasRow extends Component {
} }
} }
SendGasRow.contextTypes = {
t: PropTypes.func,
}

View File

@ -8,6 +8,10 @@ export default class SendRowErrorMessage extends Component {
errorType: PropTypes.string, errorType: PropTypes.string,
}; };
static contextTypes = {
t: PropTypes.func,
};
render () { render () {
const { errors, errorType } = this.props const { errors, errorType } = this.props
@ -21,7 +25,3 @@ export default class SendRowErrorMessage extends Component {
} }
} }
SendRowErrorMessage.contextTypes = {
t: PropTypes.func,
}

View File

@ -11,6 +11,10 @@ export default class SendRowWrapper extends Component {
showError: PropTypes.bool, showError: PropTypes.bool,
}; };
static contextTypes = {
t: PropTypes.func,
};
render () { render () {
const { const {
children, children,
@ -37,7 +41,3 @@ export default class SendRowWrapper extends Component {
} }
} }
SendRowWrapper.contextTypes = {
t: PropTypes.func,
}

View File

@ -19,6 +19,10 @@ export default class SendToRow extends Component {
updateSendToError: PropTypes.func, updateSendToError: PropTypes.func,
}; };
static contextTypes = {
t: PropTypes.func,
};
handleToChange (to, nickname = '', toError) { handleToChange (to, nickname = '', toError) {
const { updateSendTo, updateSendToError, updateGas } = this.props const { updateSendTo, updateSendToError, updateGas } = this.props
const toErrorObject = getToErrorObject(to, toError) const toErrorObject = getToErrorObject(to, toError)
@ -63,8 +67,3 @@ export default class SendToRow extends Component {
} }
} }
SendToRow.contextTypes = {
t: PropTypes.func,
}

View File

@ -27,6 +27,10 @@ export default class SendFooter extends Component {
update: PropTypes.func, update: PropTypes.func,
}; };
static contextTypes = {
t: PropTypes.func,
};
onCancel () { onCancel () {
this.props.clearSend() this.props.clearSend()
this.props.history.push(DEFAULT_ROUTE) this.props.history.push(DEFAULT_ROUTE)
@ -93,7 +97,3 @@ export default class SendFooter extends Component {
} }
} }
SendFooter.contextTypes = {
t: PropTypes.func,
}

View File

@ -12,6 +12,10 @@ export default class SendHeader extends Component {
subtitleParams: PropTypes.array, subtitleParams: PropTypes.array,
}; };
static contextTypes = {
t: PropTypes.func,
};
onClose () { onClose () {
this.props.clearSend() this.props.clearSend()
this.props.history.push(DEFAULT_ROUTE) this.props.history.push(DEFAULT_ROUTE)
@ -28,7 +32,3 @@ export default class SendHeader extends Component {
} }
} }
SendHeader.contextTypes = {
t: PropTypes.func,
}

View File

@ -39,6 +39,10 @@ export default class SendTransactionScreen extends PersistentForm {
updateSendTokenBalance: PropTypes.func, updateSendTokenBalance: PropTypes.func,
}; };
static contextTypes = {
t: PropTypes.func,
};
updateGas ({ to: updatedToAddress, amount: value } = {}) { updateGas ({ to: updatedToAddress, amount: value } = {}) {
const { const {
amount, amount,
@ -156,7 +160,3 @@ export default class SendTransactionScreen extends PersistentForm {
} }
} }
SendTransactionScreen.contextTypes = {
t: PropTypes.func,
}