<commit_before>// @flow
import React from 'react';
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 | string, // So we can use a placeholder in the input
};

type Props = {
  sendToAddress: DraftTransaction => void,
  balance: number,
};

class WalletSend extends React.PureComponent<Props> {
  constructor() {
    super();

    (this: any).handleSubmit = this.handleSubmit.bind(this);
  }

  handleSubmit(values: DraftTransaction) {
    const { sendToAddress } = this.props;
    sendToAddress(values);
  }

  render() {
    const { balance } = this.props;

    return (
      <section className="card card--section">
        <div className="card__title">{__('Send Credits')}</div>
        <div className="card__content">
          <Formik
            initialValues={{
              address: '',
              amount: '',
            }}
            onSubmit={this.handleSubmit}
            validate={validateSendTx}
            render={({ values, errors, touched, handleChange, handleBlur, handleSubmit }) => (
              <Form onSubmit={handleSubmit}>
                <FormRow>
                  <FormField
                    type="number"
                    name="amount"
                    label={__('Amount')}
                    postfix={__('LBC')}
                    className="input--price-amount"
                    min="0"
                    onChange={handleChange}
                    onBlur={handleBlur}
                    value={values.amount}
                    error={
                      (!!values.amount && touched.amount && errors.amount) ||
                      (values.amount > balance && __('Not enough'))
                    }
                  />

                  <FormField
                    type="text"
                    name="address"
                    placeholder="bbFxRyXXXXXXXXXXXZD8nE7XTLUxYnddTs"
                    className="input--address"
                    label={__('Recipient address')}
                    error={!!values.address && touched.address && errors.address}
                    onChange={handleChange}
                    onBlur={handleBlur}
                    value={values.address}
                  /><commit_msg>fix: allow sending amounts less that 1 lbc<commit_after>// @flow
import React from 'react';
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 | string, // So we can use a placeholder in the input
};

type Props = {
  sendToAddress: DraftTransaction => void,
  balance: number,
};

class WalletSend extends React.PureComponent<Props> {
  constructor() {
    super();

    (this: any).handleSubmit = this.handleSubmit.bind(this);
  }

  handleSubmit(values: DraftTransaction) {
    const { sendToAddress } = this.props;
    sendToAddress(values);
  }

  render() {
    const { balance } = this.props;

    return (
      <section className="card card--section">
        <div className="card__title">{__('Send Credits')}</div>
        <div className="card__content">
          <Formik
            initialValues={{
              address: '',
              amount: '',
            }}
            onSubmit={this.handleSubmit}
            validate={validateSendTx}
            render={({ values, errors, touched, handleChange, handleBlur, handleSubmit }) => (
              <Form onSubmit={handleSubmit}>
                <FormRow>
                  <FormField
                    type="number"
                    name="amount"
                    label={__('Amount')}
                    postfix={__('LBC')}
                    className="input--price-amount"
                    min="0"
                    step="any"
                    onChange={handleChange}
                    onBlur={handleBlur}
                    value={values.amount}
                    error={
                      (!!values.amount && touched.amount && errors.amount) ||
                      (values.amount > balance && __('Not enough'))
                    }
                  />

                  <FormField
                    type="text"
                    name="address"
                    placeholder="bbFxRyXXXXXXXXXXXZD8nE7XTLUxYnddTs"
                    className="input--address"
                    label={__('Recipient address')}
                    error={!!values.address && touched.address && errors.address}
                    onChange={handleChange}
                    onBlur={handleBlur}
                    value={values.address}
                  />
{'fraction_non_alphanumeric': 0.11624072547403133, 'fraction_numerical': 0.0014427040395713108, 'mean_word_length': 1.6049382716049383, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7309429', 'n_tokens_mistral': 1258, 'n_tokens_neox': 1185, 'n_words': 252}