Changeset View
Changeset View
Standalone View
Standalone View
web/cashtab/src/components/Send/SendToken.js
Show All 27 Lines | |||||
const SendToken = ({ tokenId }) => { | const SendToken = ({ tokenId }) => { | ||||
const { wallet, tokens, slpBalancesAndUtxos, apiError } = React.useContext( | const { wallet, tokens, slpBalancesAndUtxos, apiError } = React.useContext( | ||||
WalletContext, | WalletContext, | ||||
); | ); | ||||
const token = tokens.find(token => token.tokenId === tokenId); | const token = tokens.find(token => token.tokenId === tokenId); | ||||
const [queryStringText, setQueryStringText] = useState(null); | const [queryStringText, setQueryStringText] = useState(null); | ||||
const [sendTokenAddressError, setSendTokenAddressError] = useState(false); | const [sendTokenAddressError, setSendTokenAddressError] = useState(false); | ||||
const [sendTokenAmountError, setSendTokenAmountError] = useState(false); | const [sendTokenAmountError, setSendTokenAmountError] = useState(false); | ||||
// Get device window width | // Get device window width | ||||
// If this is less than 769, the page will open with QR scanner open | // If this is less than 769, the page will open with QR scanner open | ||||
const { width } = useWindowDimensions(); | const { width } = useWindowDimensions(); | ||||
// Load with QR code open if device is mobile and NOT iOS + anything but safari | // Load with QR code open if device is mobile and NOT iOS + anything but safari | ||||
const scannerSupported = width < 769 && isMobile && !(isIOS && !isSafari); | const scannerSupported = width < 769 && isMobile && !(isIOS && !isSafari); | ||||
const [formData, setFormData] = useState({ | const [formData, setFormData] = useState({ | ||||
dirty: true, | dirty: true, | ||||
▲ Show 20 Lines • Show All 229 Lines • ▼ Show 20 Lines | return ( | ||||
help={ | help={ | ||||
sendTokenAmountError | sendTokenAmountError | ||||
? sendTokenAmountError | ? sendTokenAmountError | ||||
: '' | : '' | ||||
} | } | ||||
onMax={onMax} | onMax={onMax} | ||||
inputProps={{ | inputProps={{ | ||||
name: 'value', | name: 'value', | ||||
step: 1 / 10 ** token.info.decimals, | |||||
placeholder: 'Amount', | placeholder: 'Amount', | ||||
prefix: | prefix: | ||||
currency.tokenIconsUrl !== | currency.tokenIconsUrl !== | ||||
'' ? ( | '' ? ( | ||||
<Img | <Img | ||||
src={`${currency.tokenIconsUrl}/${tokenId}.png`} | src={`${currency.tokenIconsUrl}/${tokenId}.png`} | ||||
width={16} | width={16} | ||||
height={16} | height={16} | ||||
▲ Show 20 Lines • Show All 80 Lines • Show Last 20 Lines |