11import { useNavigation } from '@react-navigation/native' ;
22import React , { useCallback , useEffect , useMemo , useState } from 'react' ;
3- import { Image , ListRenderItemInfo , Pressable } from 'react-native' ;
3+ import { ListRenderItemInfo , Pressable } from 'react-native' ;
44import { FlatList , ScrollView } from 'react-native-gesture-handler' ;
55import { SafeAreaView } from 'react-native-safe-area-context' ;
66import { useDispatch , useSelector } from 'react-redux' ;
@@ -12,7 +12,6 @@ import {
1212 Box ,
1313 BoxAlignItems ,
1414 BoxFlexDirection ,
15- BoxJustifyContent ,
1615 Button ,
1716 ButtonSize ,
1817 ButtonVariant ,
@@ -30,7 +29,6 @@ import { CaipChainId } from '@metamask/utils';
3029
3130import { getHeaderCompactStandardNavbarOptions } from '../../../../../component-library/components-temp/HeaderCompactStandard' ;
3231import { strings } from '../../../../../../locales/i18n' ;
33- import AppConstants from '../../../../../core/AppConstants' ;
3432import Routes from '../../../../../constants/navigation/Routes' ;
3533import {
3634 selectBatchSellDestStablecoinsByChain ,
@@ -41,7 +39,6 @@ import { useTokensWithBalance } from '../../hooks/useTokensWithBalance';
4139import ButtonToggle from '../../../../../component-library/components-temp/Buttons/ButtonToggle' ;
4240import { ButtonSize as ButtonToggleSize } from '../../../../../component-library/components/Buttons/Button' ;
4341import { getNetworkImageSource } from '../../../../../util/networks' ;
44- import emptyStateDefiLight from '../../../../../images/empty-state-defi-light.png' ;
4542import {
4643 buildBatchSellEligibleChains ,
4744 removeStablecoinsFromSourceTokens ,
@@ -53,6 +50,7 @@ import {
5350} from './BatchSellTokenSelect.utils' ;
5451import { BatchSellTokenSelectSelectorsIDs } from './BatchSellTokenSelect.testIds' ;
5552import { BatchSellTokenRow } from './BatchSellTokenRow' ;
53+ import { BatchSellEmptyState } from './BatchSellEmptyState' ;
5654
5755const getTokenKey = ( token : BridgeToken ) =>
5856 `${ formatChainIdToCaip ( token . chainId ) } :${ token . address } ` ;
@@ -220,12 +218,8 @@ export function BatchSellTokenSelect() {
220218 } , [ dispatch , navigation , selectedTokens , stablecoinsByChain ] ) ;
221219
222220 const handleExploreTokensPress = useCallback ( ( ) => {
223- navigation . navigate ( Routes . BROWSER . HOME , {
224- screen : Routes . BROWSER . VIEW ,
225- params : {
226- newTabUrl : AppConstants . EXPLORE_TOKENS . URL ,
227- timestamp : Date . now ( ) ,
228- } ,
221+ navigation . navigate ( Routes . TRENDING_VIEW , {
222+ screen : Routes . TRENDING_FEED ,
229223 } ) ;
230224 } , [ navigation ] ) ;
231225
@@ -308,45 +302,7 @@ export function BatchSellTokenSelect() {
308302
309303 if ( eligibleSourceTokens . length === 0 ) {
310304 return (
311- < SafeAreaView style = { tw . style ( 'flex-1 bg-default' ) } edges = { [ 'bottom' ] } >
312- < Box
313- testID = { BatchSellTokenSelectSelectorsIDs . EMPTY_STATE }
314- alignItems = { BoxAlignItems . Center }
315- justifyContent = { BoxJustifyContent . Center }
316- twClassName = "flex-1 px-8"
317- >
318- < Image
319- source = { emptyStateDefiLight }
320- resizeMode = "contain"
321- style = { tw . style ( 'h-[96px] w-[96px] mb-6' ) }
322- />
323- < Text
324- variant = { TextVariant . HeadingMd }
325- color = { TextColor . TextDefault }
326- twClassName = "text-center"
327- >
328- { strings ( 'bridge.batch_sell_empty_state_title' ) }
329- </ Text >
330- < Text
331- variant = { TextVariant . BodyMd }
332- color = { TextColor . TextAlternative }
333- twClassName = "mt-2 text-center"
334- >
335- { strings ( 'bridge.batch_sell_empty_state_description' ) }
336- </ Text >
337- < Box twClassName = "mt-6 w-full" >
338- < Button
339- variant = { ButtonVariant . Secondary }
340- size = { ButtonSize . Lg }
341- isFullWidth
342- onPress = { handleExploreTokensPress }
343- testID = { BatchSellTokenSelectSelectorsIDs . EXPLORE_TOKENS_BUTTON }
344- >
345- { strings ( 'bridge.explore_tokens' ) }
346- </ Button >
347- </ Box >
348- </ Box >
349- </ SafeAreaView >
305+ < BatchSellEmptyState onExploreTokensPress = { handleExploreTokensPress } />
350306 ) ;
351307 }
352308
@@ -420,28 +376,6 @@ export function BatchSellTokenSelect() {
420376 keyExtractor = { getTokenKey }
421377 showsVerticalScrollIndicator = { false }
422378 contentContainerStyle = { tw . style ( 'pb-4' ) }
423- ListEmptyComponent = {
424- < Box
425- testID = { BatchSellTokenSelectSelectorsIDs . SEARCH_EMPTY_STATE }
426- alignItems = { BoxAlignItems . Center }
427- twClassName = "px-8 py-20"
428- >
429- < Text
430- variant = { TextVariant . HeadingMd }
431- color = { TextColor . TextDefault }
432- twClassName = "text-center"
433- >
434- { strings ( 'bridge.no_tokens_found' ) }
435- </ Text >
436- < Text
437- variant = { TextVariant . BodyMd }
438- color = { TextColor . TextAlternative }
439- twClassName = "mt-2 text-center"
440- >
441- { strings ( 'bridge.no_tokens_found_description' ) }
442- </ Text >
443- </ Box >
444- }
445379 />
446380 < Box twClassName = "border-t border-muted px-4 pb-4 pt-3" >
447381 < Button
0 commit comments