import { useIntersectionObserver } from '@uidotdev/usehooks' import { useEffect } from 'react' import { cn, Skeleton, TableCell, TableRow } from 'ui' import { ShimmeringCard } from './ShimmeringCard' interface LoadMoreRowProps { type?: 'card' | 'table' isFetchingNextPage: boolean fetchNextPage: () => void } export const LoadMoreRows = ({ type, isFetchingNextPage, fetchNextPage }: LoadMoreRowProps) => { const [sentinelRef, entry] = useIntersectionObserver({ threshold: 0, rootMargin: '200px 0px 200px 0px', }) useEffect(() => { if (entry?.isIntersecting && !isFetchingNextPage) { fetchNextPage?.() } }, [entry?.isIntersecting, isFetchingNextPage, fetchNextPage]) if (type === 'card') { return ( ) } return ( ) }