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,
};
static contextTypes = {
t: PropTypes.func,
};
render () {
const {
account,
@ -67,8 +71,3 @@ export default class AccountListItem extends Component {
</div>)
}
}
AccountListItem.contextTypes = {
t: PropTypes.func,
}

View File

@ -13,6 +13,10 @@ export default class AmountMaxButton extends Component {
tokenBalance: PropTypes.string,
};
static contextTypes = {
t: PropTypes.func,
};
setMaxAmount () {
const {
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,
updateSendAmountError: PropTypes.func,
updateGas: PropTypes.func,
}
};
static contextTypes = {
t: PropTypes.func,
};
validateAmount (amount) {
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,
};
static contextTypes = {
t: PropTypes.func,
};
getListItemIcon (accountAddress, activeAddress) {
return accountAddress === activeAddress
? <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,
};
static contextTypes = {
t: PropTypes.func,
};
render () {
const {
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,
};
static contextTypes = {
t: PropTypes.func,
};
async handleFromChange (newFrom) {
const {
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,
};
static contextTypes = {
t: PropTypes.func,
};
render() {
const {
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,
};
static contextTypes = {
t: PropTypes.func,
};
render () {
const {
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,
};
static contextTypes = {
t: PropTypes.func,
};
render () {
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,
};
static contextTypes = {
t: PropTypes.func,
};
render () {
const {
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,
};
static contextTypes = {
t: PropTypes.func,
};
handleToChange (to, nickname = '', toError) {
const { updateSendTo, updateSendToError, updateGas } = this.props
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,
};
static contextTypes = {
t: PropTypes.func,
};
onCancel () {
this.props.clearSend()
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,
};
static contextTypes = {
t: PropTypes.func,
};
onClose () {
this.props.clearSend()
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,
};
static contextTypes = {
t: PropTypes.func,
};
updateGas ({ to: updatedToAddress, amount: value } = {}) {
const {
amount,
@ -156,7 +160,3 @@ export default class SendTransactionScreen extends PersistentForm {
}
}
SendTransactionScreen.contextTypes = {
t: PropTypes.func,
}