Split out "Your bets" from "For you"

This commit is contained in:
James Grugett 2022-07-20 15:30:07 -05:00
parent 44afa92b58
commit c35d0a8bc6

View File

@ -125,7 +125,9 @@ export function ContractSearch(props: {
additionalFilter?.groupSlug additionalFilter?.groupSlug
? `groupSlugs:${additionalFilter.groupSlug}` ? `groupSlugs:${additionalFilter.groupSlug}`
: '', : '',
pillFilter && pillFilter !== 'personal' ? `groupSlugs:${pillFilter}` : '', pillFilter && pillFilter !== 'personal' && pillFilter !== 'your-bets'
? `groupSlugs:${pillFilter}`
: '',
pillFilter === 'personal' pillFilter === 'personal'
? // Show contracts in groups that the user is a member of ? // Show contracts in groups that the user is a member of
memberGroupSlugs memberGroupSlugs
@ -135,9 +137,13 @@ export function ContractSearch(props: {
// Show contracts bet on by users the user follows // Show contracts bet on by users the user follows
.concat( .concat(
follows?.map((followId) => `uniqueBettorIds:${followId}`) ?? [] follows?.map((followId) => `uniqueBettorIds:${followId}`) ?? []
// Show contracts bet on by the user
) )
.concat(user ? `uniqueBettorIds:${user.id}` : []) : '',
// Subtract contracts you bet on from For you.
pillFilter === 'personal' && user ? `uniqueBettorIds:-${user.id}` : '',
pillFilter === 'your-bets' && user
? // Show contracts bet on by the user
`uniqueBettorIds:${user.id}`
: '', : '',
].filter((f) => f) ].filter((f) => f)
// Hack to make Algolia work. // Hack to make Algolia work.
@ -228,6 +234,14 @@ export function ContractSearch(props: {
For you For you
</PillButton> </PillButton>
<PillButton
key={'your-bets'}
selected={pillFilter === 'your-bets'}
onSelect={() => setPillFilter('your-bets')}
>
Your bets
</PillButton>
{pillGroups.map(({ name, slug }) => { {pillGroups.map(({ name, slug }) => {
return ( return (
<PillButton <PillButton