2018-03-26 23:32:43 +02:00
// @flow
2017-12-21 22:08:54 +01:00
import React from 'react' ;
2018-03-26 23:32:43 +02:00
import Button from 'component/button' ;
2017-12-21 22:08:54 +01:00
import Address from 'component/address' ;
2018-03-26 23:32:43 +02:00
import * as icons from 'constants/icons' ;
2017-05-11 02:59:47 +02:00
2018-03-26 23:32:43 +02:00
type Props = {
checkAddressIsMine : string => void ,
receiveAddress : string ,
getNewAddress : ( ) => void ,
gettingNewAddress : boolean ,
} ;
class WalletAddress extends React . PureComponent < Props > {
2017-05-11 02:59:47 +02:00
componentWillMount ( ) {
2017-06-06 23:19:12 +02:00
this . props . checkAddressIsMine ( this . props . receiveAddress ) ;
2017-05-11 02:59:47 +02:00
}
render ( ) {
2017-06-06 23:19:12 +02:00
const { receiveAddress , getNewAddress , gettingNewAddress } = this . props ;
2017-05-11 02:59:47 +02:00
return (
2018-03-26 23:32:43 +02:00
< section className = "card card--section" >
< div className = "card__title" > { _ _ ( 'Receive Credits' ) } < / div >
< p className = "card__subtitle" >
{ _ _ ( 'Use this wallet address to receive credits sent by another user (or yourself).' ) }
< / p >
2017-05-11 02:59:47 +02:00
< div className = "card__content" >
2017-12-15 21:46:50 +01:00
< Address address = { receiveAddress } showCopyButton / >
2017-05-11 02:59:47 +02:00
< / div >
2018-03-26 23:32:43 +02:00
2017-05-11 02:59:47 +02:00
< div className = "card__actions" >
2018-03-26 23:32:43 +02:00
< Button
2018-03-30 20:57:03 +02:00
button = "primary"
2017-12-21 22:08:54 +01:00
label = { _ _ ( 'Get New Address' ) }
2018-03-26 23:32:43 +02:00
icon = { icons . REFRESH }
2017-06-06 23:19:12 +02:00
onClick = { getNewAddress }
disabled = { gettingNewAddress }
/ >
2017-05-11 02:59:47 +02:00
< / div >
< div className = "card__content" >
< div className = "help" >
2017-06-06 23:19:12 +02:00
< p >
{ _ _ (
2017-12-21 22:08:54 +01:00
'You can generate a new address at any time, and any previous addresses will continue to work. Using multiple addresses can be helpful for keeping track of incoming payments from multiple sources.'
2017-06-06 23:19:12 +02:00
) }
< / p >
2017-05-11 02:59:47 +02:00
< / div >
< / div >
< / section >
) ;
}
}
2017-06-06 06:21:55 +02:00
export default WalletAddress ;