Displays additional fields in the transaction list
This commit is contained in:
parent
de40578608
commit
a2cc9afe05
4 changed files with 36 additions and 2 deletions
|
@ -47,7 +47,7 @@ export function doSendSupport(amount, claim_id) {
|
||||||
};
|
};
|
||||||
|
|
||||||
lbry
|
lbry
|
||||||
.claim_send_tip({
|
.wallet_send({
|
||||||
claim_id: claim_id,
|
claim_id: claim_id,
|
||||||
amount: amount,
|
amount: amount,
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
|
import { doNavigate } from "actions/app";
|
||||||
import { doFetchTransactions } from "actions/wallet";
|
import { doFetchTransactions } from "actions/wallet";
|
||||||
import {
|
import {
|
||||||
selectBalance,
|
selectBalance,
|
||||||
|
@ -15,6 +16,7 @@ const select = state => ({
|
||||||
});
|
});
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
|
navigate: (path, params) => dispatch(doNavigate(path, params)),
|
||||||
fetchTransactions: () => dispatch(doFetchTransactions()),
|
fetchTransactions: () => dispatch(doFetchTransactions()),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -7,13 +7,38 @@ class TransactionList extends React.PureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { fetchingTransactions, transactionItems } = this.props;
|
const { fetchingTransactions, transactionItems, navigate } = this.props;
|
||||||
|
|
||||||
|
function findTypeOfTx(type, is_tip) {
|
||||||
|
if (is_tip && type === "support") return "tip";
|
||||||
|
else return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getClaimLink(claim_name, claim_id) {
|
||||||
|
if (claim_id !== "----" && claim_name !== "----") {
|
||||||
|
let uri = `lbry://${claim_name}#${claim_id}`;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<td>
|
||||||
|
<a
|
||||||
|
className="button-text"
|
||||||
|
onClick={() => navigate("/show", { uri })}
|
||||||
|
>
|
||||||
|
{claim_name}
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return <td>{__("N/A")}</td>;
|
||||||
|
}
|
||||||
|
|
||||||
const rows = [];
|
const rows = [];
|
||||||
if (transactionItems.length > 0) {
|
if (transactionItems.length > 0) {
|
||||||
transactionItems.forEach(function(item) {
|
transactionItems.forEach(function(item) {
|
||||||
rows.push(
|
rows.push(
|
||||||
<tr key={item.id}>
|
<tr key={item.id}>
|
||||||
|
<td>{findTypeOfTx(item.type, item.is_tip)}</td>
|
||||||
<td>{(item.amount > 0 ? "+" : "") + item.amount}</td>
|
<td>{(item.amount > 0 ? "+" : "") + item.amount}</td>
|
||||||
<td>
|
<td>
|
||||||
{item.date
|
{item.date
|
||||||
|
@ -25,6 +50,7 @@ class TransactionList extends React.PureComponent {
|
||||||
? item.date.toLocaleTimeString()
|
? item.date.toLocaleTimeString()
|
||||||
: <span className="empty">{__("(Transaction pending)")}</span>}
|
: <span className="empty">{__("(Transaction pending)")}</span>}
|
||||||
</td>
|
</td>
|
||||||
|
{getClaimLink(item.claim_name, item.claim_id)}
|
||||||
<td>
|
<td>
|
||||||
<a
|
<a
|
||||||
className="button-text"
|
className="button-text"
|
||||||
|
@ -53,9 +79,11 @@ class TransactionList extends React.PureComponent {
|
||||||
? <table className="table-standard table-stretch">
|
? <table className="table-standard table-stretch">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
<th>{__("Type")}</th>
|
||||||
<th>{__("Amount")}</th>
|
<th>{__("Amount")}</th>
|
||||||
<th>{__("Date")}</th>
|
<th>{__("Date")}</th>
|
||||||
<th>{__("Time")}</th>
|
<th>{__("Time")}</th>
|
||||||
|
<th>{__("Claim")}</th>
|
||||||
<th>{__("Transaction")}</th>
|
<th>{__("Transaction")}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
|
@ -29,6 +29,10 @@ export const selectTransactionItems = createSelector(
|
||||||
id: txid,
|
id: txid,
|
||||||
date: tx.timestamp ? new Date(parseInt(tx.timestamp) * 1000) : null,
|
date: tx.timestamp ? new Date(parseInt(tx.timestamp) * 1000) : null,
|
||||||
amount: parseFloat(tx.value),
|
amount: parseFloat(tx.value),
|
||||||
|
type: tx.type,
|
||||||
|
claim_id: tx.claim_id,
|
||||||
|
claim_name: tx.claim_name,
|
||||||
|
is_tip: tx.is_tip,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
return transactionItems.reverse();
|
return transactionItems.reverse();
|
||||||
|
|
Loading…
Reference in a new issue