Small fixes to existing sell shares client
This commit is contained in:
parent
c00681abd8
commit
2041e39b45
|
@ -46,6 +46,8 @@ import { useUser } from 'web/hooks/use-user'
|
||||||
import { SellSharesModal } from './sell-modal'
|
import { SellSharesModal } from './sell-modal'
|
||||||
import { useUnfilledBets } from 'web/hooks/use-bets'
|
import { useUnfilledBets } from 'web/hooks/use-bets'
|
||||||
import { LimitBet } from 'common/bet'
|
import { LimitBet } from 'common/bet'
|
||||||
|
import { useSaveShares } from './use-save-shares'
|
||||||
|
import { floatingEqual } from 'common/util/math'
|
||||||
|
|
||||||
type BetSort = 'newest' | 'profit' | 'closeTime' | 'value'
|
type BetSort = 'newest' | 'profit' | 'closeTime' | 'value'
|
||||||
type BetFilter = 'open' | 'sold' | 'closed' | 'resolved' | 'all'
|
type BetFilter = 'open' | 'sold' | 'closed' | 'resolved' | 'all'
|
||||||
|
@ -392,6 +394,12 @@ export function BetsSummary(props: {
|
||||||
const [showSellModal, setShowSellModal] = useState(false)
|
const [showSellModal, setShowSellModal] = useState(false)
|
||||||
const user = useUser()
|
const user = useUser()
|
||||||
|
|
||||||
|
const sharesOutcome = floatingEqual(totalShares.YES, 0)
|
||||||
|
? floatingEqual(totalShares.NO, 0)
|
||||||
|
? undefined
|
||||||
|
: 'NO'
|
||||||
|
: 'YES'
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Row className={clsx('flex-wrap gap-4 sm:flex-nowrap sm:gap-6', className)}>
|
<Row className={clsx('flex-wrap gap-4 sm:flex-nowrap sm:gap-6', className)}>
|
||||||
<Row className="flex-wrap gap-4 sm:gap-6">
|
<Row className="flex-wrap gap-4 sm:gap-6">
|
||||||
|
@ -471,6 +479,7 @@ export function BetsSummary(props: {
|
||||||
!isClosed &&
|
!isClosed &&
|
||||||
!resolution &&
|
!resolution &&
|
||||||
hasShares &&
|
hasShares &&
|
||||||
|
sharesOutcome &&
|
||||||
user && (
|
user && (
|
||||||
<>
|
<>
|
||||||
<button
|
<button
|
||||||
|
@ -484,8 +493,8 @@ export function BetsSummary(props: {
|
||||||
contract={contract}
|
contract={contract}
|
||||||
user={user}
|
user={user}
|
||||||
userBets={bets}
|
userBets={bets}
|
||||||
shares={totalShares.YES || totalShares.NO}
|
shares={totalShares[sharesOutcome]}
|
||||||
sharesOutcome={totalShares.YES ? 'YES' : 'NO'}
|
sharesOutcome={sharesOutcome}
|
||||||
setOpen={setShowSellModal}
|
setOpen={setShowSellModal}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -64,7 +64,7 @@ export function SellRow(props: {
|
||||||
contract={contract}
|
contract={contract}
|
||||||
user={user}
|
user={user}
|
||||||
userBets={userBets ?? []}
|
userBets={userBets ?? []}
|
||||||
shares={yesShares || noShares}
|
shares={sharesOutcome === 'YES' ? yesShares : noShares}
|
||||||
sharesOutcome={sharesOutcome}
|
sharesOutcome={sharesOutcome}
|
||||||
setOpen={setShowSellModal}
|
setOpen={setShowSellModal}
|
||||||
/>
|
/>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user