@@ -43,6 +43,7 @@ const ConnectWallet = (props: ConnectWalletProps) => {
4343 const [ isLoading , setIsLoading ] = createSignal < boolean > ( true ) ;
4444 const [ selectedChain , setSelectedChain ] = createSignal < "all" | "ethereum" | "polygon" | "solana" > ( "all" ) ;
4545 const [ isInputFocused , setIsInputFocused ] = createSignal ( false ) ;
46+ const [ initialWalletCount , setInitialWalletCount ] = createSignal < number > ( 0 ) ;
4647
4748 const handleBack = ( ) => {
4849 log . debug ( "handleBack" , selectedWallet ( ) , currentPage ( ) ) ;
@@ -111,9 +112,12 @@ const ConnectWallet = (props: ConnectWalletProps) => {
111112 createEffect ( ( ) => {
112113 if ( walletDiscoverySupported ( ) ) {
113114 setExternalButtons ( sortedButtons ( ) ) ;
115+ log . debug ( "sortedButtons" , sortedButtons ( ) . length ) ;
116+ setInitialWalletCount ( sortedButtons ( ) . length ) ;
114117 setTotalExternalWallets ( props . totalExternalWallets ) ;
115118 } else {
116119 setExternalButtons ( visibleButtons ( ) ) ;
120+ log . debug ( "visibleButtons" , visibleButtons ( ) . length ) ;
117121 setTotalExternalWallets ( visibleButtons ( ) . length ) ;
118122 }
119123 setTimeout ( ( ) => {
@@ -139,7 +143,15 @@ const ConnectWallet = (props: ConnectWalletProps) => {
139143 }
140144 } ;
141145
142- // const headerLogo = createMemo(() => ([DEFAULT_LOGO_DARK, DEFAULT_LOGO_LIGHT].includes(props.appLogo) ? "" : props.appLogo));
146+ const handleMoreWallets = ( ) => {
147+ // setIsLoading(true);
148+ log . debug ( "handleMoreWallets" , initialWalletCount ( ) , props . allExternalButtons , props . customAdapterButtons ) ;
149+ setInitialWalletCount ( ( prev ) => prev + 10 ) ;
150+ const allButtons = [ ...props . allExternalButtons , ...props . customAdapterButtons ] ;
151+ const buttons = allButtons . slice ( initialWalletCount ( ) , initialWalletCount ( ) + 10 ) ;
152+ log . debug ( "buttons" , buttons ) ;
153+ setExternalButtons ( ( prev ) => [ ...prev , ...buttons ] ) ;
154+ } ;
143155
144156 return (
145157 < div class = "w3a--flex w3a--flex-col w3a--gap-y-4 w3a--flex-1 w3a--relative" >
@@ -289,19 +301,27 @@ const ConnectWallet = (props: ConnectWalletProps) => {
289301 </ Show >
290302 </ ul >
291303 < Show
292- when = { totalExternalWallets ( ) > 15 && ! isLoading ( ) }
293- fallback = { < div class = "w3a--w-full w3a--h-12 w3a--animate-pulse w3a--rounded-full w3a--bg-app-gray-200 dark:w3a--bg-app-gray-700" /> }
304+ when = { totalExternalWallets ( ) > 15 && ! isLoading ( ) && initialWalletCount ( ) < totalExternalWallets ( ) }
305+ fallback = {
306+ < Show when = { initialWalletCount ( ) < totalExternalWallets ( ) } >
307+ < div class = "w3a--w-full w3a--h-12 w3a--animate-pulse w3a--rounded-full w3a--bg-app-gray-200 dark:w3a--bg-app-gray-700" />
308+ </ Show >
309+ }
294310 >
295- < div class = "w3a--flex w3a--items-center w3a--justify-start w3a--gap-x-2 w3a--p-3 w3a--rounded-2xl w3a--bg-app-gray-50 dark:w3a--bg-app-gray-800 hover:w3a--bg-app-gray-200 dark:hover:w3a--bg-app-gray-600" >
311+ < button
312+ type = "button"
313+ class = "w3a--flex w3a--items-center w3a--justify-start w3a--gap-x-2 w3a--p-3 w3a--rounded-2xl w3a--bg-app-gray-50 dark:w3a--bg-app-gray-800 hover:w3a--bg-app-gray-200 dark:hover:w3a--bg-app-gray-600"
314+ onClick = { handleMoreWallets }
315+ >
296316 < img src = { getIcons ( props . isDark ? "view-dark" : "view-light" ) } alt = "view" height = "24" width = "24" />
297317 < p class = "w3a--text-base w3a--font-normal w3a--text-app-gray-700 dark:w3a--text-app-white" > More Wallets</ p >
298318 < span
299319 class = "w3a--inline-flex w3a--items-center w3a--rounded-full w3a--px-2 w3a--py-1 w3a--text-xs w3a--font-medium w3a--bg-app-primary-100 w3a--text-app-primary-800
300320 dark:w3a--bg-transparent dark:w3a--text-app-primary-400 dark:w3a--border dark:w3a--border-app-primary-400"
301321 >
302- { props . totalExternalWallets }
322+ { props . totalExternalWallets - initialWalletCount ( ) }
303323 </ span >
304- </ div >
324+ </ button >
305325 </ Show >
306326 </ div >
307327 }
0 commit comments