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