From 30ce80d0c94dbc23b3af42f79c7cbf95ab6b6763 Mon Sep 17 00:00:00 2001 From: Marshall Polaris Date: Tue, 20 Sep 2022 14:04:07 -0700 Subject: [PATCH] Extract signup UI from contract tabs component (#901) --- web/components/contract/contract-tabs.tsx | 68 ++++++++--------------- web/pages/[username]/[contractSlug].tsx | 18 ++++++ 2 files changed, 42 insertions(+), 44 deletions(-) diff --git a/web/components/contract/contract-tabs.tsx b/web/components/contract/contract-tabs.tsx index b5895f60..c1ff2186 100644 --- a/web/components/contract/contract-tabs.tsx +++ b/web/components/contract/contract-tabs.tsx @@ -1,5 +1,5 @@ import { Bet } from 'common/bet' -import { Contract, CPMMBinaryContract } from 'common/contract' +import { Contract } from 'common/contract' import { ContractComment } from 'common/comment' import { PAST_BETS, User } from 'common/user' import { @@ -11,13 +11,9 @@ import { ContractBetsTable, BetsSummary } from '../bets-list' import { Spacer } from '../layout/spacer' import { Tabs } from '../layout/tabs' import { Col } from '../layout/col' -import { tradingAllowed } from 'web/lib/firebase/contracts' import { CommentTipMap } from 'web/hooks/use-tip-txns' import { useComments } from 'web/hooks/use-comments' import { useLiquidity } from 'web/hooks/use-liquidity' -import { BetSignUpPrompt } from '../sign-up-prompt' -import { PlayMoneyDisclaimer } from '../play-money-disclaimer' -import BetButton from '../bet-button' import { capitalize } from 'lodash' import { DEV_HOUSE_LIQUIDITY_PROVIDER_ID, @@ -123,44 +119,28 @@ export function ContractTabs(props: { ) return ( - <> - - {!user ? ( - - - - - ) : ( - outcomeType === 'BINARY' && - tradingAllowed(contract) && ( - - ) - )} - + ) } diff --git a/web/pages/[username]/[contractSlug].tsx b/web/pages/[username]/[contractSlug].tsx index 84cc271a..45bcd0d4 100644 --- a/web/pages/[username]/[contractSlug].tsx +++ b/web/pages/[username]/[contractSlug].tsx @@ -45,6 +45,10 @@ import { ContractsGrid } from 'web/components/contract/contracts-grid' import { Title } from 'web/components/title' import { usePrefetch } from 'web/hooks/use-prefetch' import { useAdmin } from 'web/hooks/use-admin' +import { BetSignUpPrompt } from 'web/components/sign-up-prompt' +import { PlayMoneyDisclaimer } from 'web/components/play-money-disclaimer' +import BetButton from 'web/components/bet-button' + import dayjs from 'dayjs' export const getStaticProps = fromPropz(getStaticPropz) @@ -288,6 +292,20 @@ export function ContractPageContent( tips={tips} comments={comments} /> + {!user ? ( + + + + + ) : ( + outcomeType === 'BINARY' && + allowTrade && ( + + ) + )}