From 2c74c2aa30b30093273645cdbc1c1c7ccf149133 Mon Sep 17 00:00:00 2001 From: Anthony Laibe Date: Thu, 18 Oct 2018 14:46:01 +0100 Subject: [PATCH] Add identicon --- embark-ui/package-lock.json | 8 +++ embark-ui/package.json | 1 + embark-ui/src/components/Account.js | 19 ++++-- embark-ui/src/components/Accounts.js | 56 +++++++++-------- embark-ui/src/components/Block.js | 49 ++++++++------- embark-ui/src/components/Blocks.js | 60 ++++++++++-------- .../src/components/CardTitleIdenticon.js | 9 +++ embark-ui/src/components/Description.js | 4 +- embark-ui/src/components/Transaction.js | 31 +++++---- embark-ui/src/components/Transactions.js | 63 +++++++++++-------- embark-ui/src/index.css | 4 -- 11 files changed, 181 insertions(+), 123 deletions(-) create mode 100644 embark-ui/src/components/CardTitleIdenticon.js diff --git a/embark-ui/package-lock.json b/embark-ui/package-lock.json index 2acd79381..a1a53b974 100644 --- a/embark-ui/package-lock.json +++ b/embark-ui/package-lock.json @@ -10143,6 +10143,14 @@ "pure-color": "^1.2.0" } }, + "react-blockies": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/react-blockies/-/react-blockies-1.4.0.tgz", + "integrity": "sha512-AQe8oLnb5TabDrIJJ4XzoH2djapuLtEockB+Fcx/5hLAFzFmbsRsv8tJL3p+LOb3gK0hLJlJfd1JMtjSAJpcNA==", + "requires": { + "prop-types": "^15.5.10" + } + }, "react-bootstrap-typeahead": { "version": "3.2.4", "resolved": "https://registry.npmjs.org/react-bootstrap-typeahead/-/react-bootstrap-typeahead-3.2.4.tgz", diff --git a/embark-ui/package.json b/embark-ui/package.json index cd3f73937..cd6330d7b 100644 --- a/embark-ui/package.json +++ b/embark-ui/package.json @@ -51,6 +51,7 @@ "qs": "^6.5.2", "raf": "3.4.0", "react": "^16.4.2", + "react-blockies": "^1.4.0", "react-bootstrap-typeahead": "^3.2.4", "react-copy-to-clipboard": "^5.0.1", "react-dev-utils": "^5.0.1", diff --git a/embark-ui/src/components/Account.js b/embark-ui/src/components/Account.js index a8f6353b0..14496459f 100644 --- a/embark-ui/src/components/Account.js +++ b/embark-ui/src/components/Account.js @@ -1,17 +1,24 @@ import React from 'react'; -import {Row, Col} from 'reactstrap'; +import {Row, Col, Card, CardHeader, CardBody, CardTitle} from 'reactstrap'; import PropTypes from 'prop-types'; import Description from './Description'; +import CardTitleIdenticon from './CardTitleIdenticon'; const Account = ({account}) => ( -

Account {account.address}

-
- - -
+ + + Account {account.address} + + +
+ + +
+
+
); diff --git a/embark-ui/src/components/Accounts.js b/embark-ui/src/components/Accounts.js index b02b1aa85..e7c0cfa1c 100644 --- a/embark-ui/src/components/Accounts.js +++ b/embark-ui/src/components/Accounts.js @@ -1,36 +1,42 @@ import React from 'react'; -import {Row, Col, Table} from 'reactstrap'; +import {Row, Col, Card, CardHeader, CardTitle, CardBody} from 'reactstrap'; import {Link} from 'react-router-dom'; import PropTypes from 'prop-types'; +import CardTitleIdenticon from './CardTitleIdenticon'; + const Accounts = ({accounts}) => (

Accounts

- - - - - - - - - - - { - accounts.map((account) => { - return ( - - - - - - - ); - }) - } - -
AddressBalanceTX countIndex
{account.address}{account.balance}{account.transactionCount}{account.index}
+ {accounts.map(account => ( + + + + Account {account.address} + + + + + + Balance +
+ {account.balance} Wei + + + Tx Count +
+ {account.transactionCount} + + + Index +
+ {account.index} + +
+
+
+ ))}
); diff --git a/embark-ui/src/components/Block.js b/embark-ui/src/components/Block.js index 0ab326395..0f03ce4f8 100644 --- a/embark-ui/src/components/Block.js +++ b/embark-ui/src/components/Block.js @@ -1,32 +1,39 @@ import React from 'react'; -import {Row, Col} from 'reactstrap'; +import {Row, Col, Card, CardHeader, CardBody, CardTitle} from 'reactstrap'; import PropTypes from 'prop-types'; import Description from './Description'; +import CardTitleIdenticon from './CardTitleIdenticon'; const Block = ({block}) => ( -

Block {block.number}

-
- - - - - - - - - - - - - - - - - -
+ + + Block {block.number} + + +
+ + + + + + + + + + + + + + + + + +
+
+
); diff --git a/embark-ui/src/components/Blocks.js b/embark-ui/src/components/Blocks.js index 72f850772..74d252486 100644 --- a/embark-ui/src/components/Blocks.js +++ b/embark-ui/src/components/Blocks.js @@ -1,37 +1,45 @@ import React from 'react'; import {Link} from "react-router-dom"; -import {Row, Col, Table} from 'reactstrap'; - +import {Row, Col, Card, CardHeader, CardTitle, CardBody} from 'reactstrap'; import PropTypes from 'prop-types'; +import CardTitleIdenticon from './CardTitleIdenticon'; + const Blocks = ({blocks}) => (

Blocks

- - - - - - - - - - - { - blocks.map((block) => { - return ( - - - - - - - ); - }) - } - -
NumberMined OnGas UsedTX Count
{block.number}{new Date(block.timestamp * 1000).toLocaleString()}{block.gasUsed}{block.transactions.length}
+ {blocks.map(block => ( + + + Block {block.number} + + + + + Number +
+ {block.number} + + + Mined On +
+ {new Date(block.timestamp * 1000).toLocaleString()} + + + Gas Used +
+ {block.gasUsed} + + + TX Count +
+ {block.transactions.length} + +
+
+
+ ))}
); diff --git a/embark-ui/src/components/CardTitleIdenticon.js b/embark-ui/src/components/CardTitleIdenticon.js new file mode 100644 index 000000000..8d3bb850a --- /dev/null +++ b/embark-ui/src/components/CardTitleIdenticon.js @@ -0,0 +1,9 @@ +import React from 'react'; +import {CardTitle} from 'reactstrap'; +import Blockies from 'react-blockies'; + +const CardTitleIdenticon = ({id, children}) => ( + {children} +) + +export default CardTitleIdenticon \ No newline at end of file diff --git a/embark-ui/src/components/Description.js b/embark-ui/src/components/Description.js index 9ba8cec4b..36953f2dc 100644 --- a/embark-ui/src/components/Description.js +++ b/embark-ui/src/components/Description.js @@ -2,8 +2,8 @@ import React from 'react'; const Description = ({label, value}) => ( -
{label}
-
{value}
+
{label}
+
{value}
); diff --git a/embark-ui/src/components/Transaction.js b/embark-ui/src/components/Transaction.js index 3a2e776ec..f4909d2ba 100644 --- a/embark-ui/src/components/Transaction.js +++ b/embark-ui/src/components/Transaction.js @@ -1,24 +1,31 @@ import React from 'react'; import {Link} from 'react-router-dom'; -import {Row, Col} from 'reactstrap'; +import {Row, Col, Card, CardHeader, CardBody, CardTitle} from 'reactstrap'; import PropTypes from 'prop-types'; import Description from './Description'; +import CardTitleIdenticon from './CardTitleIdenticon'; const Transaction = ({transaction}) => ( -

Transaction {transaction.hash}

-
- {transaction.blockNumber}} /> - - - - - - - -
+ + + Transaction {transaction.hash} + + +
+ {transaction.blockNumber}} /> + + + + + + + +
+
+
); diff --git a/embark-ui/src/components/Transactions.js b/embark-ui/src/components/Transactions.js index 6c40440e7..d80d86bd8 100644 --- a/embark-ui/src/components/Transactions.js +++ b/embark-ui/src/components/Transactions.js @@ -1,38 +1,47 @@ import React from 'react'; import {Link} from "react-router-dom"; -import {Row, Col, Table} from 'reactstrap'; +import {Row, Col, Card, CardHeader, CardTitle, CardBody} from 'reactstrap'; import PropTypes from 'prop-types'; +import CardTitleIdenticon from './CardTitleIdenticon'; + const Transactions = ({transactions}) => (

Transactions

- - - - - - - - - - - - { - transactions.map((transaction) => { - return ( - - - - - - - - ); - }) - } - -
HashBlock NumberFromToType
{transaction.hash}{transaction.blockNumber}{transaction.from}{transaction.to}{transaction.to ? "Contract Call" : "Contract Creation"}
+ {transactions.map(transaction => ( + + + + Transaction {transaction.hash} + + + + + + Block number +
+ {transaction.blockNumber} + + + From +
+ {transaction.from} + + + To +
+ {transaction.to} + + + Type +
+ {transaction.to ? "Contract Call" : "Contract Creation"} + +
+
+
+ ))}
); diff --git a/embark-ui/src/index.css b/embark-ui/src/index.css index 85d826733..df15d2d81 100644 --- a/embark-ui/src/index.css +++ b/embark-ui/src/index.css @@ -16,8 +16,4 @@ .text-wrap { word-wrap: break-word; -} - -.table { - background: #ffffff; } \ No newline at end of file