-
Notifications
You must be signed in to change notification settings - Fork 0
/
IntermediaryTable.js
69 lines (51 loc) · 1.83 KB
/
IntermediaryTable.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import {useEffect,useState } from 'react'
import './Table.css';
import { DataGrid } from '@mui/x-data-grid';
// components for showing the table in the dashboard
//takes in props which it uses to load the table with data
// this is a material ui component mainly, which was edited to take a prop rather than const variables to load the table
// https://mui.com/material-ui/react-table/
const IntermediaryTable = (list) => {
// console.log(list);
// console.log(list.list);
// console.log(list.list.length);
// console.log(list.list[0].attributes);
// console.log(list.length);
const tempArray = []
for (let index = 0; index < list.list.length; index++) {
const element = list.list[index];
// console.log("hello world");
// console.log(element.id);
// console.log(element.attributes.name);
tempArray.push({id:element.id, name:element.attributes.name, ethAddress: element.attributes.ethAddress})
}
// console.log(temp);
// column headings
const columns = [
{ field: 'id', headerName: 'ID', width: 200 },
{ field: 'name', headerName: 'Name', width: 150 },
{ field: 'ethAddress', headerName: 'ETH Address', width: 200 },
];
// use tempArray as the row data
const rows = tempArray
return(
<>
{/* {assets>0 &&
<>
<Button classVar='dark' text={'asset'} onClick={(e)=> {asset.map((item)=>{console.log(item)})}}/>
<Button classVar='dark' text={'count'} onClick={(e)=> {asset.map((item)=>{console.log(assetCount)})}}/>
</>
} */}
<div className='table' style={{ height: 400, width: '100%' }}>
<DataGrid
rows={rows}
columns={columns}
pageSize={5}
rowsPerPageOptions={[5]}
// checkboxSelection
/>
</div>
</>
)
}
export default IntermediaryTable