@@ -66,6 +66,7 @@ export default function UsageContent() {
6666 const [ showTopup , setShowTopup ] = useState ( false ) ;
6767 const [ payLoading , setPayLoading ] = useState ( false ) ;
6868 const [ paymentError , setPaymentError ] = useState ( "" ) ;
69+ const [ copiedField , setCopiedField ] = useState < string | null > ( null ) ;
6970 const [ paymentStatus , setPaymentStatus ] = useState < {
7071 paymentId : string ;
7172 checkoutUrl : string | null ;
@@ -113,6 +114,7 @@ export default function UsageContent() {
113114 if ( ! topupAmount || topupAmount < 1 ) return ;
114115 setPayLoading ( true ) ;
115116 setPaymentError ( "" ) ;
117+ setCopiedField ( null ) ;
116118 try {
117119 const res = await fetch ( "/api/usage/topup" , {
118120 method : "POST" ,
@@ -546,11 +548,15 @@ export default function UsageContent() {
546548 < span className = "text-tc-green font-mono font-bold" > { paymentStatus . amountCrypto } { paymentStatus . currency . split ( "_" ) [ 0 ] . toUpperCase ( ) } </ span >
547549 < span className = "text-tc-text-dim font-mono text-xs" > (${ paymentStatus . amountUsd . toFixed ( 2 ) } )</ span >
548550 < button
549- onClick = { ( ) => { navigator . clipboard . writeText ( `${ paymentStatus . amountCrypto } ` ) ; } }
550- className = "text-xs text-tc-text-dim hover:text-tc-green transition-colors"
551+ onClick = { ( ) => {
552+ navigator . clipboard . writeText ( `${ paymentStatus . amountCrypto } ` ) ;
553+ setCopiedField ( "crypto" ) ;
554+ setTimeout ( ( ) => setCopiedField ( null ) , 1500 ) ;
555+ } }
556+ className = { `text-xs transition-colors ${ copiedField === "crypto" ? "text-tc-green font-bold" : "text-tc-text-dim hover:text-tc-green" } ` }
551557 title = "Click to copy"
552558 >
553- 📋
559+ { copiedField === "crypto" ? "✓ Copied!" : "📋" }
554560 </ button >
555561 </ div >
556562 </ div >
@@ -570,12 +576,18 @@ export default function UsageContent() {
570576 < div className = "mb-6 p-4 border border-tc-border rounded-xl bg-tc-darker" >
571577 < p className = "text-xs text-tc-text-dim mb-2" > Send payment to:</ p >
572578 < code className = "block bg-black/40 border border-tc-border rounded-lg p-3 text-xs text-tc-green font-mono break-all select-all cursor-pointer"
573- onClick = { ( ) => { navigator . clipboard . writeText ( paymentStatus . paymentAddress || "" ) ; } }
579+ onClick = { ( ) => {
580+ navigator . clipboard . writeText ( paymentStatus . paymentAddress || "" ) ;
581+ setCopiedField ( "address" ) ;
582+ setTimeout ( ( ) => setCopiedField ( null ) , 1500 ) ;
583+ } }
574584 title = "Click to copy"
575585 >
576586 { paymentStatus . paymentAddress }
577587 </ code >
578- < p className = "text-[10px] text-tc-text-dim mt-1.5" > Click address to copy</ p >
588+ < p className = "text-[10px] text-tc-text-dim mt-1.5" >
589+ { copiedField === "address" ? "✓ Copied to clipboard!" : "Click address to copy" }
590+ </ p >
579591 </ div >
580592 ) }
581593
0 commit comments