Show hot market 24 hour volume instead of pool
This commit is contained in:
parent
d1c6e5bc91
commit
cedd8df45c
|
@ -9,8 +9,11 @@ import { Col } from './layout/col'
|
||||||
import { parseTags } from '../lib/util/parse'
|
import { parseTags } from '../lib/util/parse'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
|
|
||||||
export function ContractCard(props: { contract: Contract }) {
|
export function ContractCard(props: {
|
||||||
const { contract } = props
|
contract: Contract
|
||||||
|
showHotVolume?: boolean
|
||||||
|
}) {
|
||||||
|
const { contract, showHotVolume } = props
|
||||||
const { question, resolution } = contract
|
const { question, resolution } = contract
|
||||||
const { probPercent } = compute(contract)
|
const { probPercent } = compute(contract)
|
||||||
|
|
||||||
|
@ -28,7 +31,10 @@ export function ContractCard(props: { contract: Contract }) {
|
||||||
probPercent={probPercent}
|
probPercent={probPercent}
|
||||||
/>
|
/>
|
||||||
</Row>
|
</Row>
|
||||||
<AbbrContractDetails contract={contract} />
|
<AbbrContractDetails
|
||||||
|
contract={contract}
|
||||||
|
showHotVolume={showHotVolume}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
@ -86,8 +92,12 @@ export function ResolutionOrChance(props: {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function AbbrContractDetails(props: { contract: Contract }) {
|
export function AbbrContractDetails(props: {
|
||||||
const { contract } = props
|
contract: Contract
|
||||||
|
showHotVolume?: boolean
|
||||||
|
}) {
|
||||||
|
const { contract, showHotVolume } = props
|
||||||
|
const { volume24Hours } = contract
|
||||||
const { truePool } = compute(contract)
|
const { truePool } = compute(contract)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -96,8 +106,14 @@ export function AbbrContractDetails(props: { contract: Contract }) {
|
||||||
<div className="whitespace-nowrap">
|
<div className="whitespace-nowrap">
|
||||||
<UserLink username={contract.creatorUsername} />
|
<UserLink username={contract.creatorUsername} />
|
||||||
</div>
|
</div>
|
||||||
<div className="">•</div>
|
<div>•</div>
|
||||||
<div className="whitespace-nowrap">{formatMoney(truePool)} pool</div>
|
{showHotVolume ? (
|
||||||
|
<div className="whitespace-nowrap">
|
||||||
|
{formatMoney(volume24Hours)} 🔥
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<div className="whitespace-nowrap">{formatMoney(truePool)} pool</div>
|
||||||
|
)}
|
||||||
</Row>
|
</Row>
|
||||||
</Col>
|
</Col>
|
||||||
)
|
)
|
||||||
|
|
|
@ -11,7 +11,12 @@ import { parseTags } from '../lib/util/parse'
|
||||||
import { ContractCard } from './contract-card'
|
import { ContractCard } from './contract-card'
|
||||||
import { Sort, useQueryAndSortParams } from '../hooks/use-sort-and-query-params'
|
import { Sort, useQueryAndSortParams } from '../hooks/use-sort-and-query-params'
|
||||||
|
|
||||||
export function ContractsGrid(props: { contracts: Contract[] }) {
|
export function ContractsGrid(props: {
|
||||||
|
contracts: Contract[]
|
||||||
|
showHotVolume?: boolean
|
||||||
|
}) {
|
||||||
|
const { showHotVolume } = props
|
||||||
|
|
||||||
const [resolvedContracts, activeContracts] = _.partition(
|
const [resolvedContracts, activeContracts] = _.partition(
|
||||||
props.contracts,
|
props.contracts,
|
||||||
(c) => c.isResolved
|
(c) => c.isResolved
|
||||||
|
@ -35,7 +40,11 @@ export function ContractsGrid(props: { contracts: Contract[] }) {
|
||||||
return (
|
return (
|
||||||
<ul role="list" className="grid grid-cols-1 gap-6 lg:grid-cols-2">
|
<ul role="list" className="grid grid-cols-1 gap-6 lg:grid-cols-2">
|
||||||
{contracts.map((contract) => (
|
{contracts.map((contract) => (
|
||||||
<ContractCard contract={contract} key={contract.id} />
|
<ContractCard
|
||||||
|
contract={contract}
|
||||||
|
key={contract.id}
|
||||||
|
showHotVolume={showHotVolume}
|
||||||
|
/>
|
||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
)
|
)
|
||||||
|
|
|
@ -42,7 +42,7 @@ export default function Markets(props: {
|
||||||
<Page>
|
<Page>
|
||||||
<div className="w-full bg-indigo-50 border-2 border-indigo-100 p-6 rounded-lg shadow-md">
|
<div className="w-full bg-indigo-50 border-2 border-indigo-100 p-6 rounded-lg shadow-md">
|
||||||
<Title className="mt-0" text="🔥 Markets" />
|
<Title className="mt-0" text="🔥 Markets" />
|
||||||
<ContractsGrid contracts={readyHotContracts} />
|
<ContractsGrid contracts={readyHotContracts} showHotVolume />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Spacer h={10} />
|
<Spacer h={10} />
|
||||||
|
|
Loading…
Reference in New Issue
Block a user