Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix bet input #2881

Merged
merged 3 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion common/src/util/format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export function formatSweepiesNumber(
}
) {
const { toDecimal, short } = parameters ?? {}
if (short && amount >= 1000) {
if (short) {
return formatLargeNumber(amount)
}
const toDecimalPlace = toDecimal ?? 2
Expand Down
10 changes: 5 additions & 5 deletions web/components/bet/bet-slider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@ export const SMALL_SLIDER_VALUES = [

export const SMALL_SLIDER_VALUE_LABELS = [1, 100, 1000]

export const MAX_CASH_SMALL_SLIDER_VALUE = 100
export const MAX_CASH_LARGE_SLIDER_VALUE = 500
export const MAX_CASH_SMALL_SLIDER_VALUE = 500
export const MAX_CASH_LARGE_SLIDER_VALUE = 1000

export const CASH_SMALL_SLIDER_VALUES = SMALL_SLIDER_VALUES.filter(
(a) => a <= MAX_CASH_SMALL_SLIDER_VALUE
)

export const CASH_SMALL_SLIDER_VALUE_LABELS = [1, 10, 100]
export const CASH_SMALL_SLIDER_VALUE_LABELS = [1, 100, 500]

export const CASH_LARGE_SLIDER_VALUES = LARGE_SLIDER_VALUES.filter(
(a) => a <= MAX_CASH_LARGE_SLIDER_VALUE
)

export const CASH_LARGE_SLIDER_VALUE_LABELS = [1, 100, 500]
export const CASH_LARGE_SLIDER_VALUE_LABELS = [1, 100, 1000]

export const BetSlider = (props: {
amount: number | undefined
Expand Down Expand Up @@ -77,7 +77,7 @@ export const BetSlider = (props: {
label: formatWithToken({
amount: a,
token: token,
short: token === 'CASH' ? false : true,
short: true,
}),
}
})
Expand Down
6 changes: 3 additions & 3 deletions web/components/bet/limit-order-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@ export default function LimitOrderPanel(props: {
}
const isPseudoNumeric = contract.outcomeType === 'PSEUDO_NUMERIC'

const defaultBetAmount = 1000
const isCashContract = contract.token === 'CASH'
const defaultBetAmount = isCashContract ? 50 : 1000

const [betAmount, setBetAmount] = useState<number | undefined>(
defaultBetAmount
)
Expand Down Expand Up @@ -280,8 +282,6 @@ export default function LimitOrderPanel(props: {
const returnPercent = formatPercent(currentReturn)
const totalFees = getFeeTotal(fees)

const isCashContract = contract.token === 'CASH'

const hideYesNo = isBinaryMC || !!pseudonym

return (
Expand Down
1 change: 0 additions & 1 deletion web/components/nav/profile-summary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export function ProfileSummary(props: { user: User; className?: string }) {
/>
<div className="mr-1 w-2 shrink-[2]" />
<div className="shrink-0 grow">
{!SPICE_PRODUCTION_ENABLED && <div>{user.name}</div>}
<div className="flex items-center text-sm">
<CoinNumber
amount={user?.balance}
Expand Down
1 change: 1 addition & 0 deletions web/components/widgets/amount-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ export function AmountInput(
onChangeAmount(Math.max(0, (amount ?? 0) - 5))
}
}}
min={isSweepies ? 1 : 0}
/>
<Row className="divide-ink-300 absolute right-[1px] h-full divide-x">
{!disableClearButton && (
Expand Down
Loading