11import React , { useState , useCallback , useMemo } from 'react'
22import { RouteComponentProps } from 'react-router-dom'
33import { useTranslation } from 'react-i18next'
4- import { Stack , Text , TextField , TooltipHost , Modal , FontSizes , IconButton } from 'office-ui-fabric-react'
4+ import { Stack , Text , TextField , TooltipHost , Modal , IconButton } from 'office-ui-fabric-react'
55
66import { StateWithDispatch } from 'states/stateProvider/reducer'
77import QRCode from 'widgets/QRCode'
@@ -28,35 +28,43 @@ const Receive = ({
2828 addPopup ( 'addr-copied' ) ( dispatch )
2929 } , [ accountAddress , dispatch ] )
3030
31+ const Address = useMemo (
32+ ( ) => (
33+ < Stack styles = { { root : { flex : 1 , minWidth : 500 } } } >
34+ < TooltipHost content = { t ( 'receive.click-to-copy' ) } calloutProps = { { gapSpace : 0 } } >
35+ < Stack horizontal horizontalAlign = "stretch" tokens = { { childrenGap : 15 } } >
36+ < TextField
37+ styles = { {
38+ root : {
39+ flex : 1 ,
40+ color : '#888' ,
41+ } ,
42+ fieldGroup : {
43+ borderColor : '#eee!important' ,
44+ } ,
45+ } }
46+ readOnly
47+ placeholder = { accountAddress }
48+ onClick = { copyAddress }
49+ />
50+ < IconButton iconProps = { { iconName : 'Copy' } } onClick = { copyAddress } />
51+ </ Stack >
52+ </ TooltipHost >
53+ </ Stack >
54+ ) ,
55+ [ copyAddress , accountAddress , t ]
56+ )
57+
3158 if ( ! accountAddress ) {
3259 return < div > { t ( 'receive.address-not-found' ) } </ div >
3360 }
3461
3562 return (
3663 < >
37- < Stack horizontal tokens = { { childrenGap : 40 , padding : '20px 0 0 0' } } horizontalAlign = "space-between" >
38- < Stack styles = { { root : { flex : 1 } } } >
39- < TooltipHost content = { t ( 'receive.click-to-copy' ) } calloutProps = { { gapSpace : 0 } } >
40- < Stack horizontal horizontalAlign = "stretch" tokens = { { childrenGap : 15 } } >
41- < TextField
42- styles = { {
43- root : {
44- flex : 1 ,
45- } ,
46- description : {
47- fontSize : FontSizes . medium ,
48- } ,
49- } }
50- readOnly
51- placeholder = { accountAddress }
52- onClick = { copyAddress }
53- description = { t ( 'receive.prompt' ) }
54- />
55- < IconButton iconProps = { { iconName : 'Copy' } } onClick = { copyAddress } />
56- </ Stack >
57- </ TooltipHost >
58- </ Stack >
59-
64+ < Stack tokens = { { childrenGap : 10 } } horizontalAlign = "center" >
65+ < Text as = "p" variant = "medium" >
66+ { `${ t ( 'receive.address' , { network : accountAddress . startsWith ( 'ckb' ) ? 'CKB Mainnet' : 'CKB Testnet' } ) } ` }
67+ </ Text >
6068 < Stack style = { { alignSelf : 'center' } } >
6169 < QRCode
6270 value = { accountAddress }
@@ -65,8 +73,12 @@ const Receive = ({
6573 exportable
6674 includeMargin
6775 dispatch = { dispatch }
76+ remark = { Address }
6877 />
6978 </ Stack >
79+ < Text as = "p" variant = "medium" >
80+ { t ( 'receive.prompt' ) }
81+ </ Text >
7082 </ Stack >
7183
7284 < Modal isOpen = { showLargeQRCode } onDismiss = { ( ) => setShowLargeQRCode ( false ) } >
0 commit comments