From 595c3fddd2d948919366592e4419cd47c374fdf4 Mon Sep 17 00:00:00 2001 From: Ian Philips Date: Fri, 22 Jul 2022 07:53:56 -0600 Subject: [PATCH] Cleanup --- web/components/bet-panel.tsx | 85 +++++++++---------- web/components/bet-row.tsx | 3 +- web/components/contract/contract-overview.tsx | 12 ++- web/pages/[username]/[contractSlug].tsx | 17 ++-- web/pages/challenges/index.tsx | 54 +----------- web/pages/embed/[username]/[contractSlug].tsx | 20 ++--- 6 files changed, 72 insertions(+), 119 deletions(-) diff --git a/web/components/bet-panel.tsx b/web/components/bet-panel.tsx index e0cde323..42391f3a 100644 --- a/web/components/bet-panel.tsx +++ b/web/components/bet-panel.tsx @@ -365,26 +365,24 @@ function BuyPanel(props: { {user && ( - - - + )} {wasSubmitted && ( @@ -401,32 +399,29 @@ function QuickOrLimitBet(props: { const { isLimitOrder, setIsLimitOrder } = props return ( - - -
Bet
- - { - setIsLimitOrder(false) - track('select quick order') - }} - > - Quick - - { - setIsLimitOrder(true) - track('select limit order') - }} - > - Limit - - + +
Bet
+ + { + setIsLimitOrder(false) + track('select quick order') + }} + > + Quick + + { + setIsLimitOrder(true) + track('select limit order') + }} + > + Limit + - - +
) } diff --git a/web/components/bet-row.tsx b/web/components/bet-row.tsx index 28dabb86..56fff9bd 100644 --- a/web/components/bet-row.tsx +++ b/web/components/bet-row.tsx @@ -1,4 +1,4 @@ -import React, { useState } from 'react' +import { useState } from 'react' import clsx from 'clsx' import { SimpleBetPanel } from './bet-panel' @@ -48,6 +48,7 @@ export default function BetRow(props: { : ''} + } {(contract.description || isCreator) && } {isCreator && } + {user && ( + +
Challenge a friend
+ + + + + )} ) : ( -
- -
+ ))} {allowResolve && (isNumeric || isPseudoNumeric ? ( diff --git a/web/pages/challenges/index.tsx b/web/pages/challenges/index.tsx index 4add5fab..0d1ee039 100644 --- a/web/pages/challenges/index.tsx +++ b/web/pages/challenges/index.tsx @@ -7,9 +7,8 @@ import { Row } from 'web/components/layout/row' import { Page } from 'web/components/page' import { SEO } from 'web/components/SEO' import { Title } from 'web/components/title' -import { useUser } from 'web/hooks/use-user' +import { useUser, useUserById } from 'web/hooks/use-user' import { fromNow } from 'web/lib/util/time' -import { useUserById } from 'web/hooks/use-user' import dayjs from 'dayjs' import customParseFormat from 'dayjs/plugin/customParseFormat' @@ -18,13 +17,14 @@ import { useAcceptedChallenges, useUserChallenges, } from 'web/lib/firebase/challenges' -import { Challenge, Acceptance } from 'common/challenge' +import { Acceptance, Challenge } from 'common/challenge' import { copyToClipboard } from 'web/lib/util/copy' import { ToastClipboard } from 'web/components/toast-clipboard' import { Tabs } from 'web/components/layout/tabs' import { SiteLink } from 'web/components/site-link' import { UserLink } from 'web/components/user-page' import { Avatar } from 'web/components/avatar' + dayjs.extend(customParseFormat) export function getManalinkUrl(slug: string) { @@ -72,54 +72,6 @@ export default function LinkPage() { ) } -// -// export function ClaimsList(props: { txns: ManalinkTxn[] }) { -// const { txns } = props -// return ( -// <> -//

-// Claimed links -//

-// {txns.map((txn) => ( -// -// ))} -// -// ) -// } - -// export function ClaimDescription(props: { txn: ManalinkTxn }) { -// const { txn } = props -// const from = useUserById(txn.fromId) -// const to = useUserById(txn.toId) -// -// if (!from || !to) { -// return <>Loading... -// } -// -// return ( -//
-//
-// -//
-//

-// {' '} -// claimed {formatMoney(txn.amount)} from{' '} -// -// -//

-//
-//
-//
-// ) -// } function ClaimTableRow(props: { claim: Acceptance }) { const { claim } = props diff --git a/web/pages/embed/[username]/[contractSlug].tsx b/web/pages/embed/[username]/[contractSlug].tsx index 42e5bf5e..d38c6e5b 100644 --- a/web/pages/embed/[username]/[contractSlug].tsx +++ b/web/pages/embed/[username]/[contractSlug].tsx @@ -21,8 +21,11 @@ import { useMeasureSize } from 'web/hooks/use-measure-size' import { fromPropz, usePropz } from 'web/hooks/use-propz' import { useWindowSize } from 'web/hooks/use-window-size' import { listAllBets } from 'web/lib/firebase/bets' -import { contractPath, getContractFromSlug } from 'web/lib/firebase/contracts' -import { tradingAllowed } from 'web/lib/firebase/contracts' +import { + contractPath, + getContractFromSlug, + tradingAllowed, +} from 'web/lib/firebase/contracts' import Custom404 from '../../404' export const getStaticProps = fromPropz(getStaticPropz) @@ -76,12 +79,8 @@ export default function ContractEmbedPage(props: { return } -export function ContractEmbed(props: { - contract: Contract - bets: Bet[] - height?: number -}) { - const { contract, bets, height } = props +export function ContractEmbed(props: { contract: Contract; bets: Bet[] }) { + const { contract, bets } = props const { question, outcomeType } = contract const isBinary = outcomeType === 'BINARY' @@ -93,11 +92,10 @@ export function ContractEmbed(props: { const { setElem, height: topSectionHeight } = useMeasureSize() const paddingBottom = 8 - const graphHeight = !height - ? windowHeight && topSectionHeight + const graphHeight = + windowHeight && topSectionHeight ? windowHeight - topSectionHeight - paddingBottom : 0 - : height return (