Fix incorrect error message for no bets

This commit is contained in:
James Grugett 2022-09-02 16:19:10 -05:00
parent 00de66cd79
commit 231d3e65c4
2 changed files with 24 additions and 18 deletions

View File

@ -209,26 +209,27 @@ export function BetsList(props: { user: User }) {
<Col className="mt-6 divide-y"> <Col className="mt-6 divide-y">
{displayedContracts.length === 0 ? ( {displayedContracts.length === 0 ? (
<NoBets user={user} /> <NoMatchingBets />
) : ( ) : (
displayedContracts.map((contract) => ( <>
<ContractBets {displayedContracts.map((contract) => (
key={contract.id} <ContractBets
contract={contract} key={contract.id}
bets={contractBets[contract.id] ?? []} contract={contract}
metric={sort === 'profit' ? 'profit' : 'value'} bets={contractBets[contract.id] ?? []}
isYourBets={isYourBets} metric={sort === 'profit' ? 'profit' : 'value'}
isYourBets={isYourBets}
/>
))}
<Pagination
page={page}
itemsPerPage={CONTRACTS_PER_PAGE}
totalItems={filteredContracts.length}
setPage={setPage}
/> />
)) </>
)} )}
</Col> </Col>
<Pagination
page={page}
itemsPerPage={CONTRACTS_PER_PAGE}
totalItems={filteredContracts.length}
setPage={setPage}
/>
</Col> </Col>
) )
} }
@ -236,7 +237,7 @@ export function BetsList(props: { user: User }) {
const NoBets = ({ user }: { user: User }) => { const NoBets = ({ user }: { user: User }) => {
const me = useUser() const me = useUser()
return ( return (
<div className="mx-4 text-gray-500"> <div className="mx-4 py-4 text-gray-500">
{user.id === me?.id ? ( {user.id === me?.id ? (
<> <>
You have not made any bets yet.{' '} You have not made any bets yet.{' '}
@ -250,6 +251,11 @@ const NoBets = ({ user }: { user: User }) => {
</div> </div>
) )
} }
const NoMatchingBets = () => (
<div className="mx-4 py-4 text-gray-500">
No bets matching the current filter.
</div>
)
function ContractBets(props: { function ContractBets(props: {
contract: Contract contract: Contract

View File

@ -58,7 +58,7 @@ export function Pagination(props: {
const maxPage = Math.ceil(totalItems / itemsPerPage) - 1 const maxPage = Math.ceil(totalItems / itemsPerPage) - 1
if (maxPage === 0) return <Spacer h={4} /> if (maxPage <= 0) return <Spacer h={4} />
return ( return (
<nav <nav