Changeset View
Changeset View
Standalone View
Standalone View
web/cashtab/src/components/Send/Send.js
import React, { useState, useEffect } from 'react'; | import React, { useState, useEffect } from 'react'; | ||||
import { WalletContext } from '@utils/context'; | import { WalletContext } from '@utils/context'; | ||||
import { Form, notification, message, Modal, Alert } from 'antd'; | import { Form, notification, message, Modal, Alert } from 'antd'; | ||||
import { CashLoader } from '@components/Common/CustomIcons'; | |||||
import { Row, Col } from 'antd'; | import { Row, Col } from 'antd'; | ||||
import Paragraph from 'antd/lib/typography/Paragraph'; | import Paragraph from 'antd/lib/typography/Paragraph'; | ||||
import PrimaryButton, { | import PrimaryButton, { | ||||
SecondaryButton, | SecondaryButton, | ||||
} from '@components/Common/PrimaryButton'; | } from '@components/Common/PrimaryButton'; | ||||
import { | import { | ||||
SendBchInput, | SendBchInput, | ||||
FormItemWithQRCodeAddon, | FormItemWithQRCodeAddon, | ||||
Show All 13 Lines | |||||
import { BalanceHeaderFiat } from '@components/Common/BalanceHeaderFiat'; | import { BalanceHeaderFiat } from '@components/Common/BalanceHeaderFiat'; | ||||
import { | import { | ||||
ZeroBalanceHeader, | ZeroBalanceHeader, | ||||
ConvertAmount, | ConvertAmount, | ||||
AlertMsg, | AlertMsg, | ||||
} from '@components/Common/Atoms'; | } from '@components/Common/Atoms'; | ||||
import { getWalletState } from '@utils/cashMethods'; | import { getWalletState } from '@utils/cashMethods'; | ||||
import { CashReceivedNotificationIcon } from '@components/Common/CustomIcons'; | import { CashReceivedNotificationIcon } from '@components/Common/CustomIcons'; | ||||
import { ApiError } from '@components/Common/ApiError'; | |||||
// Note jestBCH is only used for unit tests; BCHJS must be mocked for jest | // Note jestBCH is only used for unit tests; BCHJS must be mocked for jest | ||||
const SendBCH = ({ jestBCH, passLoadingStatus }) => { | const SendBCH = ({ jestBCH, passLoadingStatus }) => { | ||||
// use balance parameters from wallet.state object and not legacy balances parameter from walletState, if user has migrated wallet | // use balance parameters from wallet.state object and not legacy balances parameter from walletState, if user has migrated wallet | ||||
// this handles edge case of user with old wallet who has not opened latest Cashtab version yet | // this handles edge case of user with old wallet who has not opened latest Cashtab version yet | ||||
// If the wallet object from ContextValue has a `state key`, then check which keys are in the wallet object | // If the wallet object from ContextValue has a `state key`, then check which keys are in the wallet object | ||||
// Else set it as blank | // Else set it as blank | ||||
▲ Show 20 Lines • Show All 463 Lines • ▼ Show 20 Lines | return ( | ||||
)} | )} | ||||
</div> | </div> | ||||
{queryStringText && ( | {queryStringText && ( | ||||
<Alert | <Alert | ||||
message={`You are sending a transaction to an address including query parameters "${queryStringText}." Only the "amount" parameter, in units of ${currency.ticker} satoshis, is currently supported.`} | message={`You are sending a transaction to an address including query parameters "${queryStringText}." Only the "amount" parameter, in units of ${currency.ticker} satoshis, is currently supported.`} | ||||
type="warning" | type="warning" | ||||
/> | /> | ||||
)} | )} | ||||
{apiError && ( | {apiError && <ApiError />} | ||||
<> | |||||
<CashLoader /> | |||||
<p | |||||
style={{ | |||||
color: 'red', | |||||
}} | |||||
> | |||||
<b> | |||||
An error occured on our end. | |||||
Reconnecting... | |||||
</b> | |||||
</p> | |||||
</> | |||||
)} | |||||
</Form> | </Form> | ||||
</Col> | </Col> | ||||
</Row> | </Row> | ||||
</> | </> | ||||
); | ); | ||||
}; | }; | ||||
/* | /* | ||||
Show All 13 Lines |