copyedit: username in bet list empty state

This commit is contained in:
Sinclair Chen 2022-06-02 18:07:47 -07:00
parent 397d90c6b7
commit 749f7aad40

View File

@ -101,7 +101,7 @@ export function BetsList(props: { user: User; hideBetsBefore?: number }) {
return <LoadingIndicator /> return <LoadingIndicator />
} }
if (bets.length === 0) return <NoBets /> if (bets.length === 0) return <NoBets user={user} />
// Decending creation time. // Decending creation time.
bets.sort((bet1, bet2) => bet2.createdTime - bet1.createdTime) bets.sort((bet1, bet2) => bet2.createdTime - bet1.createdTime)
const contractBets = groupBy(bets, 'contractId') const contractBets = groupBy(bets, 'contractId')
@ -219,7 +219,7 @@ export function BetsList(props: { user: User; hideBetsBefore?: number }) {
<Col className="mt-6 divide-y"> <Col className="mt-6 divide-y">
{displayedContracts.length === 0 ? ( {displayedContracts.length === 0 ? (
<NoBets /> <NoBets user={user} />
) : ( ) : (
displayedContracts.map((contract) => ( displayedContracts.map((contract) => (
<ContractBets <ContractBets
@ -236,13 +236,20 @@ export function BetsList(props: { user: User; hideBetsBefore?: number }) {
) )
} }
const NoBets = () => { const NoBets = ({ user }: { user: User }) => {
const me = useUser()
return ( return (
<div className="mx-4 text-gray-500"> <div className="mx-4 text-gray-500">
You have not made any bets yet.{' '} {user.id === me?.id ? (
<SiteLink href="/home" className="underline"> <>
Find a prediction market! You have not made any bets yet.{' '}
</SiteLink> <SiteLink href="/home" className="underline">
Find a prediction market!
</SiteLink>
</>
) : (
<>{user.name} has not made any public bets yet.</>
)}
</div> </div>
) )
} }