From 99bff6b7940be05dab20f548a746c42002fbd919 Mon Sep 17 00:00:00 2001 From: James Grugett Date: Fri, 26 Aug 2022 18:17:15 -0500 Subject: [PATCH] Improve group market selection UI --- web/components/contract/contract-card.tsx | 64 ++++++++++++----------- web/components/contract/quick-bet.tsx | 4 +- web/pages/group/[...slugs]/index.tsx | 9 +++- 3 files changed, 43 insertions(+), 34 deletions(-) diff --git a/web/components/contract/contract-card.tsx b/web/components/contract/contract-card.tsx index 6ada9b6f..4464063b 100644 --- a/web/components/contract/contract-card.tsx +++ b/web/components/contract/contract-card.tsx @@ -70,41 +70,14 @@ export function ContractCard(props: { return ( - - {onClick ? ( - { - // Let the browser handle the link click (opens in new tab). - if (e.ctrlKey || e.metaKey) return - - e.preventDefault() - track('click market card', { - slug: contract.slug, - contractId: contract.id, - }) - onClick() - }} - /> - ) : ( - - - - )} +

{showQuickBet ? ( - + ) : ( <> {outcomeType === 'BINARY' && ( @@ -177,6 +150,35 @@ export function ContractCard(props: { hideGroupLink={hideGroupLink} /> + + {/* Add click layer */} + {onClick ? ( + { + // Let the browser handle the link click (opens in new tab). + if (e.ctrlKey || e.metaKey) return + + e.preventDefault() + track('click market card', { + slug: contract.slug, + contractId: contract.id, + }) + onClick() + }} + /> + ) : ( + + + + )} ) } diff --git a/web/components/contract/quick-bet.tsx b/web/components/contract/quick-bet.tsx index 7ef371f0..7b19306f 100644 --- a/web/components/contract/quick-bet.tsx +++ b/web/components/contract/quick-bet.tsx @@ -41,8 +41,9 @@ const BET_SIZE = 10 export function QuickBet(props: { contract: BinaryContract | PseudoNumericContract user: User + className?: string }) { - const { contract, user } = props + const { contract, user, className } = props const { mechanism, outcomeType } = contract const isCpmm = mechanism === 'cpmm-1' @@ -139,6 +140,7 @@ export function QuickBet(props: { return ( - - + +

Add a market to your group