From c35d0a8bc6aeaa709018719a913f8c7abc25ec53 Mon Sep 17 00:00:00 2001 From: James Grugett Date: Wed, 20 Jul 2022 15:30:07 -0500 Subject: [PATCH] Split out "Your bets" from "For you" --- web/components/contract-search.tsx | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/web/components/contract-search.tsx b/web/components/contract-search.tsx index 01a65610..730b113f 100644 --- a/web/components/contract-search.tsx +++ b/web/components/contract-search.tsx @@ -125,7 +125,9 @@ export function ContractSearch(props: { additionalFilter?.groupSlug ? `groupSlugs:${additionalFilter.groupSlug}` : '', - pillFilter && pillFilter !== 'personal' ? `groupSlugs:${pillFilter}` : '', + pillFilter && pillFilter !== 'personal' && pillFilter !== 'your-bets' + ? `groupSlugs:${pillFilter}` + : '', pillFilter === 'personal' ? // Show contracts in groups that the user is a member of memberGroupSlugs @@ -135,9 +137,13 @@ export function ContractSearch(props: { // Show contracts bet on by users the user follows .concat( 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) // Hack to make Algolia work. @@ -228,6 +234,14 @@ export function ContractSearch(props: { For you + setPillFilter('your-bets')} + > + Your bets + + {pillGroups.map(({ name, slug }) => { return (