11import React , { useEffect , useState } from 'react' ;
22import { Link } from 'react-router-dom' ;
3- import { Clock , Filter , DollarSign , ArrowRight , Zap , BarChart2 } from 'lucide-react' ;
3+ import { Clock , Filter , DollarSign , ArrowRight , Zap , BarChart2 , Copy } from 'lucide-react' ;
44import websocketService from '../services/websocketService' ;
55import { WebSocketTransaction } from '../types' ;
66
@@ -196,6 +196,10 @@ export const MempoolExplorer: React.FC = () => {
196196 } )
197197 : transactions ;
198198
199+ const copyToClipboard = ( text : string ) => {
200+ navigator . clipboard . writeText ( text ) ;
201+ } ;
202+
199203 return (
200204 < div className = "max-w-7xl mx-auto space-y-6" >
201205 < div className = "flex items-center justify-between mb-6" >
@@ -344,13 +348,26 @@ export const MempoolExplorer: React.FC = () => {
344348 < div className = "space-y-1" >
345349 { tx . inputs . slice ( 0 , 2 ) . map ( ( input , idx ) => (
346350 input . prev_out ?. addr && (
347- < div key = { idx } className = "text-sm truncate" >
348- < Link
349- to = { `/address/${ input . prev_out . addr } ` }
350- className = "text-blue-400 hover:text-blue-300 font-mono"
351- >
352- { input . prev_out . addr }
353- </ Link >
351+ < div key = { idx } className = "text-sm" >
352+ < div className = "flex items-center gap-2" >
353+ < Link
354+ to = { `/address/${ input . prev_out . addr } ` }
355+ className = "text-blue-400 hover:text-blue-300 font-mono break-all flex-1"
356+ style = { {
357+ wordBreak : 'break-word' ,
358+ overflowWrap : 'break-word'
359+ } }
360+ >
361+ { input . prev_out . addr }
362+ </ Link >
363+ < button
364+ onClick = { ( ) => input . prev_out ?. addr && copyToClipboard ( input . prev_out . addr ) }
365+ className = "p-1 hover:bg-gray-800 rounded flex-shrink-0"
366+ title = "Copy address"
367+ >
368+ < Copy className = "w-4 h-4" />
369+ </ button >
370+ </ div >
354371 </ div >
355372 )
356373 ) ) }
@@ -371,13 +388,26 @@ export const MempoolExplorer: React.FC = () => {
371388 < div className = "space-y-1" >
372389 { tx . out . slice ( 0 , 2 ) . map ( ( output , idx ) => (
373390 output . addr && (
374- < div key = { idx } className = "text-sm truncate" >
375- < Link
376- to = { `/address/${ output . addr } ` }
377- className = "text-green-400 hover:text-green-300 font-mono"
378- >
379- { output . addr }
380- </ Link >
391+ < div key = { idx } className = "text-sm" >
392+ < div className = "flex items-center gap-2" >
393+ < Link
394+ to = { `/address/${ output . addr } ` }
395+ className = "text-green-400 hover:text-green-300 font-mono break-all flex-1"
396+ style = { {
397+ wordBreak : 'break-word' ,
398+ overflowWrap : 'break-word'
399+ } }
400+ >
401+ { output . addr }
402+ </ Link >
403+ < button
404+ onClick = { ( ) => output . addr && copyToClipboard ( output . addr ) }
405+ className = "p-1 hover:bg-gray-800 rounded flex-shrink-0"
406+ title = "Copy address"
407+ >
408+ < Copy className = "w-4 h-4" />
409+ </ button >
410+ </ div >
381411 </ div >
382412 )
383413 ) ) }
0 commit comments