remove swap

This commit is contained in:
zeppi 2021-12-07 13:29:32 -05:00
parent faa21cb681
commit 6a8ff3f0f1
5 changed files with 92 additions and 148 deletions

View file

@ -23,7 +23,6 @@ import SignInVerifyPage from 'page/signInVerify';
import BuyPage from 'page/buy';
import ReceivePage from 'page/receive';
import SendPage from 'page/send';
import SwapPage from 'page/swap';
import WalletPage from 'page/wallet';
// Chunk: none
@ -300,7 +299,6 @@ function AppRouter(props: Props) {
<PrivateRoute {...props} path={`/$/${PAGES.BUY}`} component={BuyPage} />
<PrivateRoute {...props} path={`/$/${PAGES.RECEIVE}`} component={ReceivePage} />
<PrivateRoute {...props} path={`/$/${PAGES.SEND}`} component={SendPage} />
<PrivateRoute {...props} path={`/$/${PAGES.SWAP}`} component={SwapPage} />
<PrivateRoute {...props} path={`/$/${PAGES.NOTIFICATIONS}`} component={NotificationsPage} />
<PrivateRoute {...props} path={`/$/${PAGES.AUTH_WALLET_PASSWORD}`} component={SignInWalletPasswordPage} />
<PrivateRoute {...props} path={`/$/${PAGES.SETTINGS_OWN_COMMENTS}`} component={OwnComments} />

View file

@ -1,4 +1,8 @@
// @flow
/*
This component is not used at this time.
*/
import React from 'react';
import Button from 'component/button';
import { FormField, Form } from 'component/common/form';

View file

@ -1,5 +1,4 @@
// @flow
import * as ICONS from 'constants/icons';
import React from 'react';
import Page from 'component/page';
import Card from 'component/common/card';
@ -14,8 +13,6 @@ import Button from 'component/button';
import Nag from 'component/common/nag';
import I18nMessage from 'component/i18nMessage';
import LbcSymbol from 'component/common/lbc-symbol';
import classnames from 'classnames';
import WalletSwap from 'component/walletSwap';
const MOONPAY_KEY = process.env.MOONPAY_SECRET_KEY;
const COUNTRIES = Array.from(
@ -37,11 +34,6 @@ const COUNTRIES = Array.from(
)
);
const TAB = {
BUY: 'BUY',
SWAP: 'SWAP',
};
type Props = {
receiveAddress: ?string,
gettingNewAddress: boolean,
@ -54,7 +46,6 @@ type Props = {
export default function BuyPage(props: Props) {
const { receiveAddress, gettingNewAddress, doGetNewAddress, email, user, doUserSetCountry } = props;
const initialCountry = (user && user.country) || '';
const [tab, setTab] = React.useState(TAB.BUY);
const [url, setUrl] = React.useState();
const [country, setCountry] = React.useState(initialCountry);
const [showPurchaseScreen, setShowPurchaseScreen] = React.useState(false);
@ -107,121 +98,99 @@ export default function BuyPage(props: Props) {
className="main--swap"
backout={{
backoutLabel: __('Done'),
title: <LbcSymbol prefix={__('Buy or Swap')} size={28} />,
title: <LbcSymbol prefix={__('Buy')} size={28} />,
}}
>
<div className="section">
<Button
key="tip"
icon={ICONS.BUY}
label={__('Buy')}
button="alt"
onClick={() => setTab(TAB.BUY)}
className={classnames('button-toggle', { 'button-toggle--active': tab === TAB.BUY })}
/>
<Button
key="boost"
icon={ICONS.COIN_SWAP}
label={__('Swap')}
button="alt"
onClick={() => setTab(TAB.SWAP)}
className={classnames('button-toggle', { 'button-toggle--active': tab === TAB.SWAP })}
/>
</div>
<div className="section">
{tab === TAB.SWAP && <WalletSwap />}
{tab === TAB.BUY && (
<>
{!user && (
<div className="main--empty">
<Spinner delayed />
</div>
)}
<>
{!user && (
<div className="main--empty">
<Spinner delayed />
</div>
)}
{user && (
<>
{showPurchaseScreen ? (
<Card
title={title}
subtitle={subtitle}
actions={
url ? (
<iframe
allow="accelerometer; autoplay; camera; gyroscope; payment"
frameBorder="0"
src={url}
width="100%"
>
<p>{__('Your browser does not support iframes.')}</p>
</iframe>
) : (
<div className="main--empty">
<Spinner delayed />
</div>
)
}
/>
) : (
<Card
title={title}
subtitle={subtitle}
nag={
country &&
!isValid && <Nag relative type="helpful" message={"This country isn't supported yet."} />
}
actions={
<div>
<div className="section">
<FormField
label={__('Country')}
type="select"
name="country-codes"
helper={__(
'Only some countries are eligible at this time. We are working to make this available to everyone.'
)}
value={country}
onChange={(e) => setCountry(e.target.value)}
>
<option value="" disabled defaultValue>
{__('Select your country')}
</option>
{COUNTRIES.map((country, index) => (
<option key={country} value={country}>
{country}
</option>
))}
</FormField>
</div>
{country && (
<div className="section">
{isValid ? (
<div className="section__actions">
<Button
button="primary"
label={__('Continue')}
onClick={() => setShowPurchaseScreen(true)}
/>
</div>
) : (
<div className="section__actions">
<Button button="alt" label={__('Go Back')} onClick={() => goBack()} />
<Button
button="link"
label={__('Try Anyway')}
onClick={() => setShowPurchaseScreen(true)}
/>
</div>
)}
</div>
)}
{user && (
<>
{showPurchaseScreen ? (
<Card
title={title}
subtitle={subtitle}
actions={
url ? (
<iframe
allow="accelerometer; autoplay; camera; gyroscope; payment"
frameBorder="0"
src={url}
width="100%"
>
<p>{__('Your browser does not support iframes.')}</p>
</iframe>
) : (
<div className="main--empty">
<Spinner delayed />
</div>
}
/>
)}
</>
)}
</>
)}
)
}
/>
) : (
<Card
title={title}
subtitle={subtitle}
nag={
country && !isValid && <Nag relative type="helpful" message={"This country isn't supported yet."} />
}
actions={
<div>
<div className="section">
<FormField
label={__('Country')}
type="select"
name="country-codes"
helper={__(
'Only some countries are eligible at this time. We are working to make this available to everyone.'
)}
value={country}
onChange={(e) => setCountry(e.target.value)}
>
<option value="" disabled defaultValue>
{__('Select your country')}
</option>
{COUNTRIES.map((country, index) => (
<option key={country} value={country}>
{country}
</option>
))}
</FormField>
</div>
{country && (
<div className="section">
{isValid ? (
<div className="section__actions">
<Button
button="primary"
label={__('Continue')}
onClick={() => setShowPurchaseScreen(true)}
/>
</div>
) : (
<div className="section__actions">
<Button button="alt" label={__('Go Back')} onClick={() => goBack()} />
<Button
button="link"
label={__('Try Anyway')}
onClick={() => setShowPurchaseScreen(true)}
/>
</div>
)}
</div>
)}
</div>
}
/>
)}
</>
)}
</>
</div>
</Page>
);

View file

@ -1,6 +0,0 @@
import { connect } from 'react-redux';
import SwapPage from './view';
const select = (state) => ({});
export default connect(select, null)(SwapPage);

View file

@ -1,21 +0,0 @@
// @flow
import React from 'react';
import Page from 'component/page';
import WalletSwap from 'component/walletSwap';
type Props = {};
export default function SwapPage(props: Props) {
return (
<Page
noSideNavigation
className="main--swap"
backout={{
backoutLabel: __('Done'),
title: __('Swap Crypto'),
}}
>
<WalletSwap />
</Page>
);
}