import { Route as RouteType } from '@lifi/sdk' import { Col, Row, Typography } from 'antd' import { animate, stagger } from 'motion' import { useEffect, useRef } from 'react' import LoadingIndicator from '../LoadingIndicator' import RouteCard from './RouteCard' const fadeInAnimation = (element: React.MutableRefObject) => { setTimeout(() => { const nodes = element.current?.childNodes if (nodes) { animate( nodes as NodeListOf, { y: ['50px', '0px'], opacity: [0, 1], }, { delay: stagger(0.2), duration: 0.5, easing: 'ease-in-out', }, ) } }, 0) } interface RouteCarouselProps { highlightedIndex: number routes: RouteType[] routesLoading: boolean noRoutesAvailable: boolean setHighlightedIndex: Function } export const RouteList = ({ highlightedIndex, routes, routesLoading, noRoutesAvailable, setHighlightedIndex, }: RouteCarouselProps) => { // Elements used for animations const routeCards = useRef(null) useEffect(() => { if (routes.length) { fadeInAnimation(routeCards) } }, [routes]) return ( <> {routes.length > 0 && (
{routes.map((route, index) => { return ( setHighlightedIndex(index)} /> ) })} {/* {routesByX.map((routeChunk, chunkIndex) => { return ( {routeChunk.map((route, index) => { const combinedIndex = chunkIndex + index // chunkIndex === 0 ? chunkIndex + index : chunkIndex + 1 + index return ( setHighlightedIndex(combinedIndex)} /> ) })} ) })} */}
)} {routesLoading && !routes.length && ( )} {!routesLoading && noRoutesAvailable && (

No Route Found

We couldn't find suitable routes for your desired transfer. We do have some suggestions why that could be:
A route for this transaction does not exist yet possibly due to liquidity issues or because the amount of tokens you are sending is below the bridge minimum amount. Please try again later or change the tokens you intend to swap. If the problem persists, come to our Discord and leave a message in the support channel. )} ) }