From 48f5c28d75a0448840f67446e0c7de54d086829f Mon Sep 17 00:00:00 2001 From: James Grugett Date: Sun, 20 Mar 2022 16:05:16 -0500 Subject: [PATCH] Simplified contract embed --- web/components/contract-card.tsx | 7 +- web/components/contract-overview.tsx | 2 +- web/pages/embed/[username]/[contractSlug].tsx | 105 +++++++++--------- 3 files changed, 56 insertions(+), 58 deletions(-) diff --git a/web/components/contract-card.tsx b/web/components/contract-card.tsx index 78093d6c..a33b65cc 100644 --- a/web/components/contract-card.tsx +++ b/web/components/contract-card.tsx @@ -172,8 +172,9 @@ function AbbrContractDetails(props: { export function ContractDetails(props: { contract: Contract isCreator?: boolean + hideTweetBtn?: boolean }) { - const { contract, isCreator } = props + const { contract, isCreator, hideTweetBtn } = props const { closeTime, creatorName, creatorUsername } = contract const { liquidityLabel, createdDate, resolvedDate } = contractMetrics(contract) @@ -233,7 +234,9 @@ export function ContractDetails(props: {
{liquidityLabel}
- + {!hideTweetBtn && ( + + )} ) diff --git a/web/components/contract-overview.tsx b/web/components/contract-overview.tsx index bf2be78d..dc314712 100644 --- a/web/components/contract-overview.tsx +++ b/web/components/contract-overview.tsx @@ -62,7 +62,7 @@ export const ContractOverview = (props: { {(isBinary || resolution) && ( - + c1.createdTime - c2.createdTime) bets.sort((bet1, bet2) => bet1.createdTime - bet2.createdTime) - const folds = (useFoldsWithTags(contract?.tags) ?? props.folds).filter( - (fold) => fold.followCount > 1 || user?.id === fold.curatorId - ) - if (!contract) { return } + return +} + +function ContractEmbed(props: { contract: Contract; bets: Bet[] }) { + const { contract, bets } = props + const { question, resolution, outcomeType } = contract + + const isBinary = outcomeType === 'BINARY' + return ( - - - {contract.outcomeType === 'FREE_RESPONSE' && ( - <> - - - -
- + +
+ +
+ + + + + + + {(isBinary || resolution) && } + + + + +
+ {isBinary ? ( + + ) : ( + } + bets={bets} + /> )} - +
) }