diff --git a/packages/embark-ui/package.json b/packages/embark-ui/package.json index 35e5f6b36..90b796788 100644 --- a/packages/embark-ui/package.json +++ b/packages/embark-ui/package.json @@ -63,6 +63,7 @@ "classnames": "2.2.6", "connected-react-router": "4.5.0", "css-loader": "1.0.0", + "date-fns": "1.30.1", "dotenv": "6.0.0", "dotenv-expand": "4.2.0", "embark-api-client": "^4.0.0", diff --git a/packages/embark-ui/src/components/Blocks.js b/packages/embark-ui/src/components/Blocks.js index d50c0ed9f..6fb44d9d8 100644 --- a/packages/embark-ui/src/components/Blocks.js +++ b/packages/embark-ui/src/components/Blocks.js @@ -24,7 +24,7 @@ const Blocks = ({blocks, changePage, currentPage, numberOfPages}) => ( - Mined On + Mined on:
{new Date(block.timestamp * 1000).toLocaleString()}
diff --git a/packages/embark-ui/src/components/Transactions.js b/packages/embark-ui/src/components/Transactions.js index 1ac1a3304..d25460c2d 100644 --- a/packages/embark-ui/src/components/Transactions.js +++ b/packages/embark-ui/src/components/Transactions.js @@ -2,11 +2,14 @@ import React from 'react'; import {Link} from "react-router-dom"; import {Row, Col, Card, CardHeader, CardBody} from 'reactstrap'; import PropTypes from 'prop-types'; +import isToday from 'date-fns/is_today'; +import distanceInWordsToNow from 'date-fns/distance_in_words_to_now'; import DebugButton from './DebugButton'; import CardTitleIdenticon from './CardTitleIdenticon'; import Pagination from "./Pagination"; + const Transactions = ({transactions, contracts, changePage, currentPage, numberOfPages}) => ( @@ -45,6 +48,15 @@ const Transactions = ({transactions, contracts, changePage, currentPage, numberO Type
{transaction.to ? "Contract Call" : "Contract Creation"}
+ + Mined on: +
+ {isToday(new Date(transaction.timestamp * 1000)) ? + distanceInWordsToNow(new Date(transaction.timestamp * 1000), {addSuffix: true}) : + new Date(transaction.timestamp * 1000).toLocaleString() + } +
+
))} diff --git a/packages/embark-ui/src/containers/TransactionsContainer.js b/packages/embark-ui/src/containers/TransactionsContainer.js index 6bcc3403a..995ba872a 100644 --- a/packages/embark-ui/src/containers/TransactionsContainer.js +++ b/packages/embark-ui/src/containers/TransactionsContainer.js @@ -74,6 +74,7 @@ class TransactionsContainer extends Component { const txsLength = txs.length; block.transactions.forEach((tx, idx) => { txs[txsLength + idx + offset] = tx; + txs[txsLength + idx + offset].timestamp = block.timestamp; }); return txs; }, []); diff --git a/yarn.lock b/yarn.lock index 520171fa6..0fe5c86ac 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6862,6 +6862,11 @@ date-and-time@0.6.2: resolved "https://registry.yarnpkg.com/date-and-time/-/date-and-time-0.6.2.tgz#ffca5b488bafa32f7ed0aa505e7983519d413f92" integrity sha512-hwObpAj7BtK8ElQCvOV7V3yEfcD+15QNjV44IeGqkmYyOCoU7/eIgOHvPlwBhlOKGbzosEn/DCrwUr1/NnLoiA== +date-fns@1.30.1: + version "1.30.1" + resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-1.30.1.tgz#2e71bf0b119153dbb4cc4e88d9ea5acfb50dc05c" + integrity sha512-hBSVCvSmWC+QypYObzwGOd9wqdDpOt+0wl0KbU+R+uuZBS1jN8VsD1ss3irQDknRj5NvxiTF6oj/nDRnN/UQNw== + date-now@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/date-now/-/date-now-0.1.4.tgz#eaf439fd4d4848ad74e5cc7dbef200672b9e345b"