Only show 'Show more' for free response answers if there are more answers to show

This commit is contained in:
James Grugett 2022-09-12 17:40:17 -05:00
parent d66a81bc6b
commit f49cb9b399

View File

@ -34,6 +34,8 @@ export function AnswersPanel(props: {
const [showAllAnswers, setShowAllAnswers] = useState(false)
const answers = useAnswers(contract.id) ?? contract.answers
const hasZeroBetAnswers = answers.some((answer) => totalBets[answer.id] === 0)
const [winningAnswers, losingAnswers] = partition(
answers.filter((answer) =>
(answer.id !== '0' || outcomeType === 'MULTIPLE_CHOICE') && showAllAnswers
@ -130,7 +132,7 @@ export function AnswersPanel(props: {
</div>
))}
<Row className={'justify-end'}>
{!showAllAnswers && (
{hasZeroBetAnswers && !showAllAnswers && (
<Button
color={'gray-white'}
onClick={() => setShowAllAnswers(true)}