2020-06-19 06:57:57 +03:00
|
|
|
import * as React from "react";
|
|
|
|
import * as Strings from "~/common/strings";
|
|
|
|
import * as Constants from "~/common/constants";
|
|
|
|
import * as System from "~/components/system";
|
2020-04-09 00:29:13 +03:00
|
|
|
|
2020-06-19 06:57:57 +03:00
|
|
|
import { css } from "@emotion/react";
|
2020-04-09 00:29:13 +03:00
|
|
|
|
2020-06-19 06:57:57 +03:00
|
|
|
import Section from "~/components/core/Section";
|
|
|
|
import ScenePage from "~/components/core/ScenePage";
|
2020-08-22 07:25:34 +03:00
|
|
|
import ScenePageHeader from "~/components/core/ScenePageHeader";
|
2020-04-09 00:29:13 +03:00
|
|
|
|
2020-07-23 13:05:13 +03:00
|
|
|
const STYLES_NESTED_TABLE = css`
|
|
|
|
display: grid;
|
|
|
|
grid-template-columns: 160px 1fr;
|
|
|
|
`;
|
|
|
|
|
2020-07-24 02:56:50 +03:00
|
|
|
let iterator = 0;
|
2020-07-23 13:05:13 +03:00
|
|
|
const NestedTable = (data) => {
|
|
|
|
let values = [];
|
|
|
|
for (let entries of Object.entries(data)) {
|
|
|
|
if (entries[0] !== "rootCid") {
|
|
|
|
iterator += 1;
|
|
|
|
values.push(<div key={iterator}>{entries[0]}</div>);
|
|
|
|
values.push(<div key={iterator}>{entries[1]}</div>);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return <div css={STYLES_NESTED_TABLE}>{values}</div>;
|
|
|
|
};
|
|
|
|
|
2020-04-09 00:29:13 +03:00
|
|
|
export default class SceneDeals extends React.Component {
|
|
|
|
state = {};
|
|
|
|
|
|
|
|
_handleChange = (e) => {
|
|
|
|
this.setState({ [e.target.name]: e.target.value });
|
|
|
|
};
|
|
|
|
|
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<ScenePage>
|
2020-08-22 07:25:34 +03:00
|
|
|
<ScenePageHeader title="Deals [WIP]">
|
|
|
|
This scene is currently a work in progress.
|
|
|
|
</ScenePageHeader>
|
2020-07-23 13:05:13 +03:00
|
|
|
|
2020-08-02 07:58:58 +03:00
|
|
|
<Section title="Filecoin storage deal history">
|
2020-07-23 13:05:13 +03:00
|
|
|
<System.Table
|
|
|
|
data={{
|
|
|
|
columns: [
|
|
|
|
{
|
|
|
|
key: "address",
|
|
|
|
name: "Address",
|
2020-07-24 19:35:00 +03:00
|
|
|
width: "248px",
|
2020-07-23 13:05:13 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
key: "rootCid",
|
|
|
|
name: "Root CID",
|
2020-07-24 19:35:00 +03:00
|
|
|
width: "100%",
|
2020-07-23 13:05:13 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
key: "time",
|
|
|
|
name: "Time",
|
|
|
|
},
|
2020-08-02 07:58:58 +03:00
|
|
|
{
|
|
|
|
key: "status",
|
|
|
|
name: "Status",
|
|
|
|
},
|
2020-07-23 13:05:13 +03:00
|
|
|
],
|
|
|
|
rows: this.props.viewer.storageList.map((each) => {
|
|
|
|
return {
|
|
|
|
id: each.rootCid,
|
|
|
|
address: each.addr,
|
|
|
|
rootCid: each.rootCid,
|
|
|
|
status: each.pending ? "2" : "1",
|
|
|
|
time: each.time,
|
|
|
|
children: NestedTable(each.dealInfo),
|
|
|
|
};
|
|
|
|
}),
|
|
|
|
}}
|
|
|
|
selectedRowId={this.state.selectedRowId}
|
|
|
|
onClick={this._handleClick}
|
|
|
|
/>
|
|
|
|
</Section>
|
|
|
|
|
2020-08-02 07:58:58 +03:00
|
|
|
<Section title="Filecoin retrieval deal history">
|
2020-04-09 00:29:13 +03:00
|
|
|
<System.Table
|
2020-07-23 13:05:13 +03:00
|
|
|
data={{
|
|
|
|
columns: [
|
|
|
|
{
|
|
|
|
key: "address",
|
|
|
|
name: "Address",
|
|
|
|
width: "248px",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: "rootCid",
|
|
|
|
name: "Root CID",
|
2020-07-24 19:35:00 +03:00
|
|
|
width: "100%",
|
2020-07-23 13:05:13 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
key: "time",
|
|
|
|
name: "Time",
|
|
|
|
},
|
|
|
|
],
|
|
|
|
rows: this.props.viewer.retrievalList.map((each) => {
|
|
|
|
return {
|
|
|
|
id: each.dealInfo.rootCid,
|
|
|
|
address: each.addr,
|
|
|
|
rootCid: each.dealInfo.rootCid,
|
|
|
|
time: each.time,
|
|
|
|
children: NestedTable(each.dealInfo),
|
|
|
|
};
|
|
|
|
}),
|
|
|
|
}}
|
|
|
|
selectedRowId={this.state.selectedRowId}
|
|
|
|
onClick={this._handleClick}
|
|
|
|
name={this.props.name}
|
2020-04-09 00:29:13 +03:00
|
|
|
/>
|
|
|
|
</Section>
|
|
|
|
</ScenePage>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|