54 lines
1.6 KiB
JavaScript
Raw Normal View History

2018-08-07 15:09:55 +01:00
import PropTypes from "prop-types";
2018-08-02 13:52:10 -04:00
import React from 'react';
2018-10-25 08:23:09 +01:00
import {Row, Col, Card, CardHeader, CardBody} from "reactstrap";
2018-10-24 16:03:46 -04:00
import {Link} from 'react-router-dom';
import {formatContractForDisplay} from '../utils/presentation';
import CardTitleIdenticon from './CardTitleIdenticon';
2018-08-02 13:52:10 -04:00
const Contracts = ({contracts, title = "Contracts"}) => (
2018-10-15 11:08:57 +01:00
<Row>
2018-10-24 16:03:46 -04:00
<Col>
2018-10-16 22:28:36 -04:00
<Card>
2018-10-24 16:03:46 -04:00
<CardHeader>
<h2>{title}</h2>
</CardHeader>
2018-10-16 22:28:36 -04:00
<CardBody>
2018-10-24 16:03:46 -04:00
{
contracts.map(contract => {
const contractDisplay = formatContractForDisplay(contract);
return (
<div className="explorer-row border-top" key={contract.address}>
<CardTitleIdenticon id={contract.className}>
<Link to={`/embark/explorer/contracts/${contract.className}`}>{contract.className}</Link>
</CardTitleIdenticon>
<Row>
<Col>
<strong>Address</strong>
<div>{contract.address}</div>
</Col>
<Col>
<strong>State</strong>
<div className={contractDisplay.stateColor}>
{formatContractForDisplay(contract).state}
</div>
</Col>
</Row>
</div>
)
})
}
2018-10-16 22:28:36 -04:00
</CardBody>
</Card>
2018-10-15 11:08:57 +01:00
</Col>
</Row>
2018-08-02 13:52:10 -04:00
);
2018-08-07 15:09:55 +01:00
Contracts.propTypes = {
contracts: PropTypes.array,
title: PropTypes.string
2018-08-07 15:09:55 +01:00
};
2018-08-02 13:52:10 -04:00
export default Contracts;