Fix tooltip styles in your bets (#783)
* Only show answer tooltips if truncated * Always wrap in tooltip * refactor. make title in dialog less big
This commit is contained in:
parent
099764a931
commit
a9f846e8fc
|
@ -534,9 +534,8 @@ export function ContractBetsTable(props: {
|
||||||
contract: Contract
|
contract: Contract
|
||||||
bets: Bet[]
|
bets: Bet[]
|
||||||
isYourBets: boolean
|
isYourBets: boolean
|
||||||
className?: string
|
|
||||||
}) {
|
}) {
|
||||||
const { contract, className, isYourBets } = props
|
const { contract, isYourBets } = props
|
||||||
|
|
||||||
const bets = sortBy(
|
const bets = sortBy(
|
||||||
props.bets.filter((b) => !b.isAnte && b.amount !== 0),
|
props.bets.filter((b) => !b.isAnte && b.amount !== 0),
|
||||||
|
@ -568,7 +567,7 @@ export function ContractBetsTable(props: {
|
||||||
const unfilledBets = useUnfilledBets(contract.id) ?? []
|
const unfilledBets = useUnfilledBets(contract.id) ?? []
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={clsx('overflow-x-auto', className)}>
|
<div className="overflow-x-auto">
|
||||||
{amountRedeemed > 0 && (
|
{amountRedeemed > 0 && (
|
||||||
<>
|
<>
|
||||||
<div className="pl-2 text-sm text-gray-500">
|
<div className="pl-2 text-sm text-gray-500">
|
||||||
|
@ -771,7 +770,7 @@ function SellButton(props: {
|
||||||
setIsSubmitting(false)
|
setIsSubmitting(false)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div className="mb-4 text-2xl">
|
<div className="mb-4 text-xl">
|
||||||
Sell {formatWithCommas(shares)} shares of{' '}
|
Sell {formatWithCommas(shares)} shares of{' '}
|
||||||
<OutcomeLabel outcome={outcome} contract={contract} truncate="long" />{' '}
|
<OutcomeLabel outcome={outcome} contract={contract} truncate="long" />{' '}
|
||||||
for {formatMoney(saleAmount)}?
|
for {formatMoney(saleAmount)}?
|
||||||
|
|
|
@ -120,7 +120,7 @@ export function ContractCard(props: {
|
||||||
truncate={'long'}
|
truncate={'long'}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<FreeResponseTopAnswer contract={contract} truncate="long" />
|
<FreeResponseTopAnswer contract={contract} />
|
||||||
))}
|
))}
|
||||||
</Col>
|
</Col>
|
||||||
{showQuickBet ? (
|
{showQuickBet ? (
|
||||||
|
@ -230,10 +230,9 @@ export function BinaryResolutionOrChance(props: {
|
||||||
|
|
||||||
function FreeResponseTopAnswer(props: {
|
function FreeResponseTopAnswer(props: {
|
||||||
contract: FreeResponseContract | MultipleChoiceContract
|
contract: FreeResponseContract | MultipleChoiceContract
|
||||||
truncate: 'short' | 'long' | 'none'
|
|
||||||
className?: string
|
className?: string
|
||||||
}) {
|
}) {
|
||||||
const { contract, truncate } = props
|
const { contract } = props
|
||||||
|
|
||||||
const topAnswer = getTopAnswer(contract)
|
const topAnswer = getTopAnswer(contract)
|
||||||
|
|
||||||
|
@ -241,7 +240,7 @@ function FreeResponseTopAnswer(props: {
|
||||||
<AnswerLabel
|
<AnswerLabel
|
||||||
className="!text-gray-600"
|
className="!text-gray-600"
|
||||||
answer={topAnswer}
|
answer={topAnswer}
|
||||||
truncate={truncate}
|
truncate="long"
|
||||||
/>
|
/>
|
||||||
) : null
|
) : null
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,13 +90,11 @@ export function FreeResponseOutcomeLabel(props: {
|
||||||
const chosen = contract.answers?.find((answer) => answer.id === resolution)
|
const chosen = contract.answers?.find((answer) => answer.id === resolution)
|
||||||
if (!chosen) return <AnswerNumberLabel number={resolution} />
|
if (!chosen) return <AnswerNumberLabel number={resolution} />
|
||||||
return (
|
return (
|
||||||
<Tooltip text={chosen.text}>
|
<AnswerLabel
|
||||||
<AnswerLabel
|
answer={chosen}
|
||||||
answer={chosen}
|
truncate={truncate}
|
||||||
truncate={truncate}
|
className={answerClassName}
|
||||||
className={answerClassName}
|
/>
|
||||||
/>
|
|
||||||
</Tooltip>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,11 +163,13 @@ export function AnswerLabel(props: {
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<span
|
<Tooltip text={truncated === text ? false : text}>
|
||||||
style={{ wordBreak: 'break-word' }}
|
<span
|
||||||
className={clsx('whitespace-pre-line break-words', className)}
|
style={{ wordBreak: 'break-word' }}
|
||||||
>
|
className={clsx('whitespace-pre-line break-words', className)}
|
||||||
{truncated}
|
>
|
||||||
</span>
|
{truncated}
|
||||||
|
</span>
|
||||||
|
</Tooltip>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,7 +79,7 @@ export function Tooltip(props: {
|
||||||
role="tooltip"
|
role="tooltip"
|
||||||
ref={floating}
|
ref={floating}
|
||||||
style={{ position: strategy, top: y ?? 0, left: x ?? 0 }}
|
style={{ position: strategy, top: y ?? 0, left: x ?? 0 }}
|
||||||
className="z-10 max-w-xs rounded bg-slate-700 px-2 py-1 text-center text-sm text-white"
|
className="z-10 max-w-xs whitespace-normal rounded bg-slate-700 px-2 py-1 text-center text-sm text-white"
|
||||||
{...getFloatingProps()}
|
{...getFloatingProps()}
|
||||||
>
|
>
|
||||||
{text}
|
{text}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user