@@ -36,6 +36,7 @@ export const SendModal: React.FC<SendModalProps> = ({ wallet, allWallets, onClos
3636
3737 const amountInputRef = useRef < HTMLInputElement > ( null ) ;
3838 const addressInputRef = useRef < HTMLInputElement > ( null ) ;
39+ const walletDropdownRef = useRef < HTMLDivElement > ( null ) ;
3940
4041 // Check if wallet is locked
4142 const walletLocked = isWalletLocked ( wallet ) ;
@@ -74,14 +75,16 @@ export const SendModal: React.FC<SendModalProps> = ({ wallet, allWallets, onClos
7475 // Filter compatible wallets by curve
7576 useEffect ( ( ) => {
7677 const currentCurve = wallet . curve || 'secp256k1' ;
77- const filtered = allWallets . filter ( w =>
78+ const filtered = allWallets . filter ( w =>
7879 w . id !== wallet . id && // Exclude current wallet
7980 ( w . curve || 'secp256k1' ) === currentCurve // Same curve
8081 ) ;
82+ console . log ( 'Current wallet curve:' , currentCurve ) ;
83+ console . log ( 'All wallets:' , allWallets . length ) ;
84+ console . log ( 'Compatible wallets:' , filtered . length ) ;
85+ console . log ( 'Compatible wallets details:' , filtered . map ( w => ( { id : w . id , name : w . name , curve : w . curve } ) ) ) ;
8186 setCompatibleWallets ( filtered ) ;
82- } , [ allWallets , wallet ] ) ;
83-
84- // Focus inputs when step changes
87+ } , [ allWallets , wallet ] ) ; // Focus inputs when step changes
8588 useEffect ( ( ) => {
8689 if ( step === 'enter-details' ) {
8790 setTimeout ( ( ) => {
@@ -95,7 +98,7 @@ export const SendModal: React.FC<SendModalProps> = ({ wallet, allWallets, onClos
9598 // Close wallet dropdown when clicking outside
9699 useEffect ( ( ) => {
97100 const handleClickOutside = ( event : MouseEvent ) => {
98- if ( showWalletDropdown ) {
101+ if ( showWalletDropdown && walletDropdownRef . current && ! walletDropdownRef . current . contains ( event . target as Node ) ) {
99102 setShowWalletDropdown ( false ) ;
100103 }
101104 } ;
@@ -122,6 +125,7 @@ export const SendModal: React.FC<SendModalProps> = ({ wallet, allWallets, onClos
122125 } ;
123126
124127 const handleWalletSelect = ( selectedWallet : Wallet ) => {
128+ console . log ( 'Wallet selected:' , selectedWallet . name , selectedWallet . address ) ;
125129 setSelectedRecipientWallet ( selectedWallet ) ;
126130 setRecipientAddress ( selectedWallet . address ) ;
127131 setShowWalletDropdown ( false ) ;
@@ -480,9 +484,12 @@ export const SendModal: React.FC<SendModalProps> = ({ wallet, allWallets, onClos
480484 Recipient Address
481485 </ label >
482486 { compatibleWallets . length > 0 && (
483- < div style = { { position : 'relative' } } >
487+ < div style = { { position : 'relative' } } ref = { walletDropdownRef } >
484488 < button
485- onClick = { ( ) => setShowWalletDropdown ( ! showWalletDropdown ) }
489+ onClick = { ( ) => {
490+ console . log ( 'Dropdown button clicked, current state:' , showWalletDropdown ) ;
491+ setShowWalletDropdown ( ! showWalletDropdown ) ;
492+ } }
486493 style = { {
487494 background : '#8b5cf6' ,
488495 border : 'none' ,
@@ -522,7 +529,11 @@ export const SendModal: React.FC<SendModalProps> = ({ wallet, allWallets, onClos
522529 { compatibleWallets . map ( ( compatibleWallet ) => (
523530 < div
524531 key = { compatibleWallet . id }
525- onClick = { ( ) => handleWalletSelect ( compatibleWallet ) }
532+ onClick = { ( e ) => {
533+ e . preventDefault ( ) ;
534+ e . stopPropagation ( ) ;
535+ handleWalletSelect ( compatibleWallet ) ;
536+ } }
526537 style = { {
527538 padding : '12px' ,
528539 cursor : 'pointer' ,
0 commit comments