Fix hiding bet row on market page
This commit is contained in:
parent
aebf572dc9
commit
077eeec2c7
|
@ -1,4 +1,4 @@
|
|||
/* This example requires Tailwind CSS v2.0+ */
|
||||
import clsx from 'clsx'
|
||||
import { Fragment, useState } from 'react'
|
||||
import { Dialog, Transition } from '@headlessui/react'
|
||||
import { Contract } from '../lib/firebase/contracts'
|
||||
|
@ -10,7 +10,9 @@ import { YesNoSelector } from './yes-no-selector'
|
|||
export default function BetRow(props: {
|
||||
contract: Contract
|
||||
className?: string
|
||||
labelClassName?: string
|
||||
}) {
|
||||
const { className, labelClassName } = props
|
||||
const [open, setOpen] = useState(false)
|
||||
const [betChoice, setBetChoice] = useState<'YES' | 'NO' | undefined>(
|
||||
undefined
|
||||
|
@ -18,23 +20,27 @@ export default function BetRow(props: {
|
|||
|
||||
return (
|
||||
<>
|
||||
<Row className="items-center gap-2 justify-end">
|
||||
<div className=" text-gray-400 mr-2">Place a trade</div>
|
||||
<YesNoSelector
|
||||
btnClassName="btn-sm w-20"
|
||||
onSelect={(choice) => {
|
||||
setOpen(true)
|
||||
setBetChoice(choice)
|
||||
}}
|
||||
/>
|
||||
</Row>
|
||||
<Modal open={open} setOpen={setOpen}>
|
||||
<BetPanel
|
||||
contract={props.contract}
|
||||
title={props.contract.question}
|
||||
selected={betChoice}
|
||||
/>
|
||||
</Modal>
|
||||
<div className={className}>
|
||||
<Row className="items-center gap-2 justify-end">
|
||||
<div className={clsx('text-gray-400 mr-2', labelClassName)}>
|
||||
Place a trade
|
||||
</div>
|
||||
<YesNoSelector
|
||||
btnClassName="btn-sm w-20"
|
||||
onSelect={(choice) => {
|
||||
setOpen(true)
|
||||
setBetChoice(choice)
|
||||
}}
|
||||
/>
|
||||
</Row>
|
||||
<Modal open={open} setOpen={setOpen}>
|
||||
<BetPanel
|
||||
contract={props.contract}
|
||||
title={props.contract.question}
|
||||
selected={betChoice}
|
||||
/>
|
||||
</Modal>
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
|
|
@ -626,8 +626,9 @@ export function ContractFeed(props: {
|
|||
comments: Comment[]
|
||||
// Feed types: 'activity' = Activity feed, 'market' = Comments feed on a market
|
||||
feedType: 'activity' | 'market'
|
||||
betRowClassName?: string
|
||||
}) {
|
||||
const { contract, feedType } = props
|
||||
const { contract, feedType, betRowClassName } = props
|
||||
const { id } = contract
|
||||
const [expanded, setExpanded] = useState(false)
|
||||
const user = useUser()
|
||||
|
@ -702,7 +703,10 @@ export function ContractFeed(props: {
|
|||
))}
|
||||
</ul>
|
||||
{tradingAllowed(contract) && (
|
||||
<BetRow contract={contract} className="-mt-4" />
|
||||
<BetRow
|
||||
contract={contract}
|
||||
className={clsx('-mt-4', betRowClassName)}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
|
|
|
@ -52,7 +52,7 @@ export const ContractOverview = (props: {
|
|||
<Linkify text={contract.question} />
|
||||
</div>
|
||||
|
||||
<Row className="justify-between gap-4">
|
||||
<Row className="justify-between items-center gap-4">
|
||||
<ResolutionOrChance
|
||||
className="md:hidden"
|
||||
resolution={resolution}
|
||||
|
@ -60,7 +60,11 @@ export const ContractOverview = (props: {
|
|||
large
|
||||
/>
|
||||
|
||||
<BetRow contract={contract} className="md:hidden" />
|
||||
<BetRow
|
||||
contract={contract}
|
||||
className="md:hidden"
|
||||
labelClassName="hidden"
|
||||
/>
|
||||
</Row>
|
||||
|
||||
<ContractDetails contract={contract} />
|
||||
|
@ -109,6 +113,7 @@ export const ContractOverview = (props: {
|
|||
bets={bets}
|
||||
comments={comments}
|
||||
feedType="market"
|
||||
betRowClassName="md:hidden !mt-0"
|
||||
/>
|
||||
</Col>
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue
Block a user