import { Contract } from 'web/lib/firebase/contracts' import { User } from 'web/lib/firebase/users' import { Col } from '../layout/col' import { SiteLink } from '../site-link' import { ContractCard } from './contract-card' import { ShowTime } from './contract-details' import { ContractSearch } from '../contract-search' import { useIsVisible } from 'web/hooks/use-is-visible' import { useEffect, useState } from 'react' import clsx from 'clsx' import { LoadingIndicator } from '../loading-indicator' export type ContractHighlightOptions = { contractIds?: string[] highlightClassName?: string } export function ContractsGrid(props: { contracts: Contract[] | undefined loadMore: () => void hasMore: boolean showTime?: ShowTime onContractClick?: (contract: Contract) => void overrideGridClassName?: string cardHideOptions?: { hideQuickBet?: boolean hideGroupLink?: boolean } highlightOptions?: ContractHighlightOptions }) { const { contracts, showTime, hasMore, loadMore, onContractClick, overrideGridClassName, cardHideOptions, highlightOptions, } = props const { hideQuickBet, hideGroupLink } = cardHideOptions || {} const { contractIds, highlightClassName } = highlightOptions || {} const [elem, setElem] = useState(null) const isBottomVisible = useIsVisible(elem) useEffect(() => { if (isBottomVisible && hasMore) { loadMore() } }, [isBottomVisible, hasMore, loadMore]) if (contracts === undefined) { return } if (contracts.length === 0) { return (

No markets found. Why not{' '} create one?

) } return (
) } export function CreatorContractsList(props: { creator: User }) { const { creator } = props return ( ) }