@@ -34,12 +34,18 @@ export const ReviewModal = ({
3434 handleBridgeToTari ,
3535 )
3636 const [ clicked , setClicked ] = useState ( false )
37- const [ copied , setCopied ] = useState ( false )
37+ const [ sourceCopied , setSourceCopied ] = useState ( false )
38+ const [ destCopied , setDestCopied ] = useState ( false )
3839
39- const handleCopy = ( text : string ) => {
40+ const handleCopy = ( text : string , type : 'source' | 'dest' ) => {
4041 navigator . clipboard . writeText ( text )
41- setCopied ( true )
42- setTimeout ( ( ) => setCopied ( false ) , 2000 )
42+ if ( type === 'source' ) {
43+ setSourceCopied ( true )
44+ setTimeout ( ( ) => setSourceCopied ( false ) , 2000 )
45+ } else {
46+ setDestCopied ( true )
47+ setTimeout ( ( ) => setDestCopied ( false ) , 2000 )
48+ }
4349 }
4450
4551 const handleClick = useCallback ( ( ) => {
@@ -118,10 +124,11 @@ export const ReviewModal = ({
118124 { destAddress === ethAddress ? truncateAddress ( tariWalletAddress ! , 15 ) : ethAddress }
119125 < button
120126 className = "ml-2 text-gray-500 hover:text-gray-700"
121- onClick = { ( ) => handleCopy ( destAddress === ethAddress ? tariWalletAddress ! : ethAddress ! ) }
127+ onClick = { ( ) => handleCopy ( destAddress === ethAddress ? tariWalletAddress ! : ethAddress ! , 'source' ) }
122128 >
123129 < FaRegCopy />
124130 </ button >
131+ { sourceCopied && < div className = "ml-2 text-xs text-green-500" > Copied!</ div > }
125132 </ div >
126133 </ div >
127134
@@ -136,11 +143,11 @@ export const ReviewModal = ({
136143 { destAddress === tariWalletAddress ? truncateAddress ( tariWalletAddress ! , 15 ) : ethAddress }
137144 < button
138145 className = "ml-2 text-gray-500 hover:text-gray-700"
139- onClick = { ( ) => handleCopy ( destAddress === tariWalletAddress ? tariWalletAddress ! : ethAddress ! ) }
146+ onClick = { ( ) => handleCopy ( destAddress === tariWalletAddress ? tariWalletAddress ! : ethAddress ! , 'dest' ) }
140147 >
141148 < FaRegCopy />
142149 </ button >
143- { copied && < div className = "ml-2 text-xs text-green-500" > Copied!</ div > }
150+ { destCopied && < div className = "ml-2 text-xs text-green-500" > Copied!</ div > }
144151 </ div >
145152 </ div >
146153
0 commit comments