Don't show "No markets found" when loading markets

This commit is contained in:
jahooma 2021-12-19 14:37:31 -06:00
parent 0a4e05ad32
commit 6efdf46bb3
3 changed files with 12 additions and 6 deletions

View File

@ -197,7 +197,7 @@ export function MyBetsSummary(props: {
{resolution ? (
<>
<Col>
<div className="text-sm text-gray-500">Winnings</div>
<div className="text-sm text-gray-500">Payout</div>
<div className="whitespace-nowrap">{formatMoney(betsPayout)}</div>
</Col>
</>

View File

@ -173,7 +173,7 @@ export function SearchableGrid(props: {
export function ContractsList(props: { creator: User }) {
const { creator } = props
const [contracts, setContracts] = useState<Contract[]>([])
const [contracts, setContracts] = useState<Contract[] | 'loading'>('loading')
useEffect(() => {
if (creator?.id) {
@ -182,5 +182,9 @@ export function ContractsList(props: { creator: User }) {
}
}, [creator])
return <SearchableGrid contracts={contracts} defaultSort="all" />
return (
contracts !== 'loading' && (
<SearchableGrid contracts={contracts} defaultSort="all" />
)
)
}

View File

@ -21,9 +21,11 @@ export default function Markets(props: { contracts: Contract[] }) {
return (
<div className="max-w-4xl px-4 pb-8 mx-auto">
<Header />
<SearchableGrid
contracts={contracts === 'loading' ? props.contracts || [] : contracts}
/>
{(props.contracts || contracts !== 'loading') && (
<SearchableGrid
contracts={contracts === 'loading' ? props.contracts : contracts}
/>
)}
</div>
)
}