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 { useLocation } from 'react-router-dom'; | import { useLocation } from 'react-router-dom'; | ||||
import PropTypes from 'prop-types'; | import PropTypes from 'prop-types'; | ||||
import { WalletContext } from 'utils/context'; | import { WalletContext } from 'utils/context'; | ||||
import { | import { | ||||
AntdFormWrapper, | AntdFormWrapper, | ||||
SendBchInput, | SendBchInput, | ||||
DestinationAddressSingle, | DestinationAddressSingle, | ||||
DestinationAddressMulti, | DestinationAddressMulti, | ||||
} from 'components/Common/EnhancedInputs'; | } from 'components/Common/EnhancedInputs'; | ||||
import { ThemedMailOutlined } from 'components/Common/CustomIcons'; | |||||
import { CustomCollapseCtn } from 'components/Common/StyledCollapse'; | import { CustomCollapseCtn } from 'components/Common/StyledCollapse'; | ||||
import { Form, message, Modal, Alert, Input } from 'antd'; | import { Form, message, Modal, Alert, Input } from 'antd'; | ||||
import { Row, Col, Switch } from 'antd'; | import { Row, Col, Switch } from 'antd'; | ||||
import PrimaryButton, { DisabledButton } from 'components/Common/PrimaryButton'; | import PrimaryButton, { DisabledButton } from 'components/Common/PrimaryButton'; | ||||
import useBCH from 'hooks/useBCH'; | import useBCH from 'hooks/useBCH'; | ||||
import useWindowDimensions from 'hooks/useWindowDimensions'; | import useWindowDimensions from 'hooks/useWindowDimensions'; | ||||
import { | import { | ||||
sendXecNotification, | sendXecNotification, | ||||
▲ Show 20 Lines • Show All 70 Lines • ▼ Show 20 Lines | ${DestinationAddressSingleCtn} { | ||||
max-height: ${props => (props.open ? '0rem' : '17rem')}; | max-height: ${props => (props.open ? '0rem' : '17rem')}; | ||||
} | } | ||||
${DestinationAddressMultiCtn} { | ${DestinationAddressMultiCtn} { | ||||
overflow: hidden; | overflow: hidden; | ||||
max-height: ${props => (props.open ? '17rem' : '0rem')}; | max-height: ${props => (props.open ? '17rem' : '0rem')}; | ||||
} | } | ||||
`; | `; | ||||
const PanelHeaderCtn = styled.div` | |||||
display: flex; | |||||
justify-content: center; | |||||
align-items: center; | |||||
gap: 1rem; | |||||
`; | |||||
// 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 | ||||
const ContextValue = React.useContext(WalletContext); | const ContextValue = React.useContext(WalletContext); | ||||
▲ Show 20 Lines • Show All 785 Lines • ▼ Show 20 Lines | return ( | ||||
Send | Send | ||||
</PrimaryButton> | </PrimaryButton> | ||||
)} | )} | ||||
</> | </> | ||||
)} | )} | ||||
</div> | </div> | ||||
<CustomCollapseCtn | <CustomCollapseCtn | ||||
panelHeader="Advanced" | panelHeader={ | ||||
<PanelHeaderCtn> | |||||
<ThemedMailOutlined /> Message | |||||
</PanelHeaderCtn> | |||||
} | |||||
optionalDefaultActiveKey={ | optionalDefaultActiveKey={ | ||||
location && | location && | ||||
location.state && | location.state && | ||||
location.state.replyAddress | location.state.replyAddress | ||||
? ['1'] | ? ['1'] | ||||
: ['0'] | : ['0'] | ||||
} | } | ||||
optionalKey="1" | optionalKey="1" | ||||
▲ Show 20 Lines • Show All 121 Lines • Show Last 20 Lines |