2017-06-06 17:19:12 -04:00
|
|
|
import React from "react";
|
2017-09-04 23:05:41 +05:30
|
|
|
import TransactionTableHeader from "./internal/TransactionListHeader";
|
|
|
|
import TransactionTableBody from "./internal/TransactionListBody";
|
2017-09-02 21:06:27 +05:30
|
|
|
import FormField from "component/formField";
|
2017-05-10 20:59:47 -04:00
|
|
|
|
2017-09-02 21:06:27 +05:30
|
|
|
class TransactionList extends React.PureComponent {
|
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
|
|
|
|
this.state = {
|
|
|
|
filter: "unfiltered",
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
handleFilterChanged(event) {
|
|
|
|
this.setState({
|
|
|
|
filter: event.target.value,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2017-09-04 23:05:41 +05:30
|
|
|
handleClaimNameClicked(uri) {
|
|
|
|
this.props.navigate("/show", { uri });
|
|
|
|
}
|
|
|
|
|
2017-09-02 21:06:27 +05:30
|
|
|
render() {
|
|
|
|
const { emptyMessage, transactions } = this.props;
|
|
|
|
const { filter } = this.state;
|
|
|
|
|
|
|
|
if (!transactions || !transactions.length) {
|
|
|
|
return (
|
|
|
|
<div className="empty">
|
|
|
|
{emptyMessage || __("No transactions to list.")}
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
2017-05-10 20:59:47 -04:00
|
|
|
|
|
|
|
return (
|
2017-09-02 21:06:27 +05:30
|
|
|
<div>
|
|
|
|
<span className="sort-section">
|
|
|
|
{__("Filter")} {" "}
|
|
|
|
<FormField
|
|
|
|
type="select"
|
|
|
|
onChange={this.handleFilterChanged.bind(this)}
|
|
|
|
>
|
2017-09-04 23:05:41 +05:30
|
|
|
<option value="unfiltered">{__("All")}</option>
|
|
|
|
<option value="claim">{__("Publishes")}</option>
|
2017-09-02 23:20:40 +05:30
|
|
|
<option value="support">{__("Supports")}</option>
|
|
|
|
<option value="tipSupport">{__("Tips")}</option>
|
|
|
|
<option value="update">{__("Updates")}</option>
|
2017-09-02 21:06:27 +05:30
|
|
|
</FormField>
|
|
|
|
</span>
|
|
|
|
<table className="table-standard table-stretch">
|
|
|
|
<TransactionTableHeader filter={filter} />
|
2017-09-04 23:05:41 +05:30
|
|
|
<TransactionTableBody
|
|
|
|
transactions={transactions}
|
|
|
|
filter={filter}
|
|
|
|
navigate={this.handleClaimNameClicked.bind(this)}
|
|
|
|
/>
|
2017-09-02 21:06:27 +05:30
|
|
|
</table>
|
2017-08-20 17:42:00 -04:00
|
|
|
</div>
|
2017-06-06 17:19:12 -04:00
|
|
|
);
|
2017-05-10 20:59:47 -04:00
|
|
|
}
|
2017-09-02 21:06:27 +05:30
|
|
|
}
|
2017-05-10 20:59:47 -04:00
|
|
|
|
2017-06-05 21:21:55 -07:00
|
|
|
export default TransactionList;
|