import * as React from "react"; import * as Constants from "~/common/constants"; import * as Strings from "~/common/strings"; import { css } from "@emotion/react"; import { Table } from "~/components/system/components/Table"; import Group from "~/components/system/Group"; const STYLES_NESTED_TABLE = css` display: grid; grid-template-columns: 160px 1fr; `; let iterator = 0; const NestedTable = (data) => { let values = []; for (let entries of Object.entries(data)) { if (entries[0] !== "rootCid") { iterator += 1; values.push(
{entries[0]}
); values.push(
{entries[1]}
); } } return
{values}
; }; export class FilecoinStorageDealsList extends React.Component { state = { selectedRowId: null, }; _handleClick = (e) => { this.setState({ selectedRowId: e.target.value }); }; render() { return ( { 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} name={"hello"} /> ); } } export class FilecoinRetrievalDealsList extends React.Component { state = { selectedRowId: null, }; _handleClick = (e) => { this.setState({ selectedRowId: e.target.value }); }; render() { return (
{ 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} /> ); } }