import React from 'react';
import lbry from 'lbry.js';
import Link from 'component/link';
import Modal from 'component/modal';
import {
FormField,
FormRow
} from 'component/form';
import {
Address,
BusyMessage,
CreditAmount
} from 'component/common';
class AddressSection extends React.Component {
componentWillMount() {
this.props.checkAddressIsMine(this.props.receiveAddress)
}
render() {
const {
receiveAddress,
getNewAddress,
gettingNewAddress,
} = this.props
return (
Wallet Address
Other LBRY users may send credits to you by entering this address on the "Send" page.
You can generate a new address at any time, and any previous addresses will continue to work. Using multiple addresses can be helpful for keeping track of incoming payments from multiple sources.
);
}
}
const SendToAddressSection = (props) => {
const {
sendToAddress,
closeModal,
modal,
setAmount,
setAddress,
amount,
address,
} = props
const results = null
return (
{modal == 'insufficientBalance' &&
Insufficient balance: after this transaction you would have less than 1 LBC in your wallet.
}
)
}
// var SendToAddressSection = React.createClass({
// handleSubmit: function(event) {
// if (typeof event !== 'undefined') {
// event.preventDefault();
// }
// if ((this.state.balance - this.state.amount) < 1)
// {
// this.setState({
// modal: 'insufficientBalance',
// });
// return;
// }
// this.setState({
// results: "",
// });
// lbry.sendToAddress(this.state.amount, this.state.address, (results) => {
// if(results === true)
// {
// this.setState({
// results: "Your transaction was successfully placed in the queue.",
// });
// }
// else
// {
// this.setState({
// results: "Something went wrong: " + results
// });
// }
// }, (error) => {
// this.setState({
// results: "Something went wrong: " + error.message
// })
// });
// },
// closeModal: function() {
// this.setState({
// modal: null,
// });
// },
// getInitialState: function() {
// return {
// address: "",
// amount: 0.0,
// balance: ,
// results: "",
// }
// },
// componentWillMount: function() {
// lbry.getBalance((results) => {
// this.setState({
// balance: results,
// });
// });
// },
// setAmount: function(event) {
// this.setState({
// amount: parseFloat(event.target.value),
// })
// },
// setAddress: function(event) {
// this.setState({
// address: event.target.value,
// })
// },
// render: function() {
// return (
//
//
//
// Insufficient balance: after this transaction you would have less than 1 LBC in your wallet.
//
//
// );
// }
// });
const TransactionList = (props) => {
const {
fetchingTransactions,
transactionItems,
} = props
const rows = []
if (transactionItems.length > 0) {
transactionItems.forEach(function(item) {
rows.push(
{ (item.amount > 0 ? '+' : '' ) + item.amount }
{ item.date ? item.date.toLocaleDateString() : (Transaction pending) }
{ item.date ? item.date.toLocaleTimeString() : (Transaction pending) }
{item.id.substr(0, 7)}
);
});
}
return (
Transaction History
{ fetchingTransactions ?
: '' }
{ !fetchingTransactions && rows.length === 0 ?
You have no transactions.
: '' }
{ rows.length > 0 ?
Amount
Date
Time
Transaction
{rows}
: ''
}
)
}
const WalletPage = (props) => {
const {
balance,
currentPage
} = props
return (
{ currentPage === 'wallet' ? : '' }
{ currentPage === 'send' ? : '' }
{ currentPage === 'receive' ? : '' }
)
}
export default WalletPage;