Show user balance on bet panels

This commit is contained in:
Ian Philips 2022-09-01 08:12:46 -06:00
parent a7c8b8aec4
commit 6706fe7350
3 changed files with 26 additions and 8 deletions

View File

@ -1,5 +1,5 @@
import clsx from 'clsx' import clsx from 'clsx'
import { useEffect, useRef, useState } from 'react' import React, { useEffect, useRef, useState } from 'react'
import { XIcon } from '@heroicons/react/solid' import { XIcon } from '@heroicons/react/solid'
import { Answer } from 'common/answer' import { Answer } from 'common/answer'
@ -132,7 +132,10 @@ export function AnswerBetPanel(props: {
</button> </button>
)} )}
</Row> </Row>
<div className="my-3 text-left text-sm text-gray-500">Amount </div> <Row className="my-3 justify-between text-left text-sm text-gray-500">
Amount
<span>(balance: {formatMoney(user?.balance ?? 0)})</span>
</Row>
<BuyAmountInput <BuyAmountInput
inputClassName="w-full max-w-none" inputClassName="w-full max-w-none"
amount={betAmount} amount={betAmount}

View File

@ -1,5 +1,5 @@
import clsx from 'clsx' import clsx from 'clsx'
import { useState } from 'react' import React, { useState } from 'react'
import Textarea from 'react-expanding-textarea' import Textarea from 'react-expanding-textarea'
import { findBestMatch } from 'string-similarity' import { findBestMatch } from 'string-similarity'
@ -149,7 +149,12 @@ export function CreateAnswerPanel(props: { contract: FreeResponseContract }) {
{text && ( {text && (
<> <>
<Col className="mt-1 gap-2"> <Col className="mt-1 gap-2">
<div className="text-sm text-gray-500">Bet amount</div> <Row className="my-3 justify-between text-left text-sm text-gray-500">
Bet Amount
<span className={'sm:hidden'}>
(balance: {formatMoney(user?.balance ?? 0)})
</span>
</Row>{' '}
<BuyAmountInput <BuyAmountInput
amount={betAmount} amount={betAmount}
onChange={setBetAmount} onChange={setBetAmount}

View File

@ -280,7 +280,12 @@ function BuyPanel(props: {
isPseudoNumeric={isPseudoNumeric} isPseudoNumeric={isPseudoNumeric}
/> />
<div className="my-3 text-left text-sm text-gray-500">Amount</div> <Row className="my-3 justify-between text-left text-sm text-gray-500">
Amount
<span className={'xl:hidden'}>
(balance: {formatMoney(user?.balance ?? 0)})
</span>
</Row>
<BuyAmountInput <BuyAmountInput
inputClassName="w-full max-w-none" inputClassName="w-full max-w-none"
amount={betAmount} amount={betAmount}
@ -598,9 +603,14 @@ function LimitOrderPanel(props: {
</div> </div>
)} )}
<div className="mt-1 mb-3 text-left text-sm text-gray-500"> <Row className="mt-1 mb-3 justify-between text-left text-sm text-gray-500">
<span>
Max amount<span className="ml-1 text-red-500">*</span> Max amount<span className="ml-1 text-red-500">*</span>
</div> </span>
<span className={'xl:hidden'}>
(balance: {formatMoney(user?.balance ?? 0)})
</span>
</Row>
<BuyAmountInput <BuyAmountInput
inputClassName="w-full max-w-none" inputClassName="w-full max-w-none"
amount={betAmount} amount={betAmount}