From 4f3202f90bbc5aaa1a3e5eae7a06c9d5cdf0406e Mon Sep 17 00:00:00 2001 From: Sinclair Chen Date: Fri, 19 Aug 2022 10:07:48 -0700 Subject: [PATCH] Simple bet interface in embeds (#775) * rename BetRow -> BetButton * Replace bet modal in embed with inline betting - Also simplifies graph height calculation * Move bet row above graph, in "mini modal" * Show signup button if not signed up * Show probability change * Show error after modal - Show balance if insufficient funds - Clear error from amount input if amount deleted entirely * Fix error state conditions - Reset amount input on success - Reset success state on user input * Make input smaller (80px) --- web/components/amount-input.tsx | 7 +- .../{bet-row.tsx => bet-button.tsx} | 4 +- web/components/bet-inline.tsx | 127 ++++++++++++++++++ web/components/button.tsx | 23 ++-- web/components/contract/contract-card.tsx | 16 ++- web/components/contract/contract-overview.tsx | 8 +- web/components/feed/feed-items.tsx | 4 +- web/components/sign-up-prompt.tsx | 12 +- web/components/yes-no-selector.tsx | 4 +- web/pages/embed/[username]/[contractSlug].tsx | 62 +++++---- 10 files changed, 209 insertions(+), 58 deletions(-) rename web/components/{bet-row.tsx => bet-button.tsx} (94%) create mode 100644 web/components/bet-inline.tsx diff --git a/web/components/amount-input.tsx b/web/components/amount-input.tsx index 426a9371..cb071850 100644 --- a/web/components/amount-input.tsx +++ b/web/components/amount-input.tsx @@ -3,7 +3,6 @@ import React from 'react' import { useUser } from 'web/hooks/use-user' import { formatMoney } from 'common/util/format' import { Col } from './layout/col' -import { Spacer } from './layout/spacer' import { SiteLink } from './site-link' import { ENV_CONFIG } from 'common/envs/constants' @@ -37,7 +36,7 @@ export function AmountInput(props: { return ( -