// @flow import React from 'react'; import { MODALS } from 'lbry-redux'; import Button from 'component/button'; import { Form, FormRow, FormField } from 'component/common/form'; import { Formik } from 'formik'; import { validateSendTx } from 'util/form-validation'; type DraftTransaction = { address: string, amount: ?number, // So we can use a placeholder in the input }; type Props = { openModal: ({ id: string }, { address: string, amount: number }) => void, balance: number, }; class WalletSend extends React.PureComponent { constructor() { super(); (this: any).handleSubmit = this.handleSubmit.bind(this); } handleSubmit(values: DraftTransaction) { const { openModal } = this.props; const { address, amount } = values; if (amount && address) { const notificationId = { id: MODALS.CONFIRM_TRANSACTION }; const modalProps = { address, amount }; openModal(notificationId, modalProps); } } render() { const { balance } = this.props; return (
{__('Send Credits')}
(
balance && __('Not enough credits')) } />
)} />
); } } export default WalletSend;