Only show 'Show more' for free response answers if there are more answers to show
This commit is contained in:
parent
d66a81bc6b
commit
f49cb9b399
|
@ -34,6 +34,8 @@ export function AnswersPanel(props: {
|
||||||
const [showAllAnswers, setShowAllAnswers] = useState(false)
|
const [showAllAnswers, setShowAllAnswers] = useState(false)
|
||||||
|
|
||||||
const answers = useAnswers(contract.id) ?? contract.answers
|
const answers = useAnswers(contract.id) ?? contract.answers
|
||||||
|
const hasZeroBetAnswers = answers.some((answer) => totalBets[answer.id] === 0)
|
||||||
|
|
||||||
const [winningAnswers, losingAnswers] = partition(
|
const [winningAnswers, losingAnswers] = partition(
|
||||||
answers.filter((answer) =>
|
answers.filter((answer) =>
|
||||||
(answer.id !== '0' || outcomeType === 'MULTIPLE_CHOICE') && showAllAnswers
|
(answer.id !== '0' || outcomeType === 'MULTIPLE_CHOICE') && showAllAnswers
|
||||||
|
@ -130,7 +132,7 @@ export function AnswersPanel(props: {
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
<Row className={'justify-end'}>
|
<Row className={'justify-end'}>
|
||||||
{!showAllAnswers && (
|
{hasZeroBetAnswers && !showAllAnswers && (
|
||||||
<Button
|
<Button
|
||||||
color={'gray-white'}
|
color={'gray-white'}
|
||||||
onClick={() => setShowAllAnswers(true)}
|
onClick={() => setShowAllAnswers(true)}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user