@@ -40,6 +40,9 @@ import { getRelationshipBetweenAccounts } from "../../api/bridge";
40
40
import { Skeleton } from "../skeleton" ;
41
41
import { ResourceCreditsInfo } from "../resource-credits" ;
42
42
import { getBtcWalletBalance , getUserByUsername } from "../../api/breakaway" ;
43
+ import { copyContent } from "../../img/svg" ;
44
+ import { Button } from "react-bootstrap" ;
45
+ import { success } from "../feedback" ;
43
46
44
47
interface Props {
45
48
global : Global ;
@@ -172,6 +175,16 @@ export const ProfileCard = (props: Props) => {
172
175
173
176
const formatString = ( str : string ) => str ?. length <= 20 ? str : str ?. slice ( 0 , 10 ) + "..." + str ?. slice ( - 10 ) ;
174
177
178
+ const copyToClipboard = ( text : string ) => {
179
+ const textField = document . createElement ( 'textarea' ) ;
180
+ textField . innerText = text ;
181
+ document . body . appendChild ( textField ) ;
182
+ textField . select ( ) ;
183
+ document . execCommand ( 'copy' ) ;
184
+ textField . remove ( ) ;
185
+ success ( "Copied to clipboard" ) ;
186
+ }
187
+
175
188
const vPower = votingPower ( account ) ;
176
189
177
190
const isMyProfile = activeUser && activeUser . username === account . name && activeUser . data . __loaded && activeUser . data . profile ;
@@ -212,19 +225,22 @@ export const ProfileCard = (props: Props) => {
212
225
< h5 > BTC info</ h5 >
213
226
< div className = "btc-info" >
214
227
< span > Address:</ span >
215
- < span className = "b-info" > { formatString ( jsonMetaData ?. bitcoin . address ) } </ span >
228
+ < span className = "b-info" onClick = { ( ) => copyToClipboard ( jsonMetaData ?. bitcoin . address ) } > { formatString ( jsonMetaData ?. bitcoin . address ) } { copyContent } </ span >
216
229
</ div >
217
230
< div className = "btc-info" >
218
231
< span > Btc Balance:</ span >
219
232
< span className = "b-info" > { btcBalance ?. toFixed ( 2 ) } </ span >
220
233
</ div >
221
234
< div className = "btc-info" >
222
235
< span > Message:</ span >
223
- < span className = "b-info" > { jsonMetaData ?. bitcoin . message } </ span >
236
+ < span className = "b-info" onClick = { ( ) => copyToClipboard ( jsonMetaData ?. bitcoin . message ) } > { jsonMetaData ?. bitcoin . message } { copyContent } </ span >
224
237
</ div >
225
238
< div className = "btc-info" >
226
239
< span > Signature:</ span >
227
- < span className = "b-info" > { formatString ( jsonMetaData ?. bitcoin . signature ) } </ span >
240
+ < span className = "b-info" onClick = { ( ) => copyToClipboard ( jsonMetaData ?. bitcoin . signature ) } > { formatString ( jsonMetaData ?. bitcoin . signature ) } { copyContent } </ span >
241
+ < a href = "https://www.verifybitcoinmessage.com/" target = "_blank" rel = "noopener noreferrer" >
242
+ Click to Verify signature
243
+ </ a >
228
244
</ div >
229
245
</ div > : < > </ > ) }
230
246
0 commit comments