Skip to content

Commit

Permalink
Public history of DApps
Browse files Browse the repository at this point in the history
  • Loading branch information
iamonuwa committed Oct 18, 2018
1 parent 00f64b1 commit a252225
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
19 changes: 17 additions & 2 deletions client/src/App.js
Expand Up @@ -23,6 +23,9 @@ import sampleABI from "./ethereum/sampleABI2";
// Components
import web3 from "./ethereum/web3";

// MomentJS
import moment from 'moment';

// Using axios to fetch existing JSON contract data
const axios = require("axios");

Expand Down Expand Up @@ -135,6 +138,7 @@ class App extends Component {
.then(response => {
this.setState({ recentContracts: response.data.recentContracts })
})
.then( res => {})
.catch(err => console.log(err))
};

Expand Down Expand Up @@ -237,7 +241,18 @@ class App extends Component {
{this.renderCalls()}
</Grid.Column>
<Grid.Column>
{ recentContracts.toString() }
<Header>Recently created contracts</Header>
{(recentContracts.length > 0) ? (
recentContracts.map((contract, index) => (
<Segment textAlign="left" key={index}>
<Header textAlign="center">
{contract.contractName}
<Header.Subheader>{contract.network.toUpperCase()} Network </Header.Subheader>
<Header.Subheader>Created {moment(contract.createdAt).startOf('hour').fromNow()} </Header.Subheader>
</Header>
</Segment>
))
) : <p>No contract found.</p> }
</Grid.Column>
</Grid>
</div>
Expand Down Expand Up @@ -465,7 +480,7 @@ class App extends Component {
<header className="App-header">
<h1 className="App-title">One Click DApp</h1>
</header>
<p1>Curently in alpha. Help make this open-source app awesome: </p1>
<p>Curently in alpha. Help make this open-source app awesome: </p>
<a href="https://github.com/blockchainbuddha/one-click-DApps">Github</a>
{this.renderDappForm()}
{this.renderInterface()}
Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -16,6 +16,7 @@
"fs": "0.0.2",
"lodash": "^4.17.10",
"mngen": "^1.1.0",
"moment": "^2.22.2",
"mongodb": "^2.2.36",
"mongoose": "^5.2.4"
},
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Expand Up @@ -490,7 +490,7 @@ mngen@^1.1.0:
dependencies:
meow "^3.3.0"

moment@^2.11.2:
moment@^2.11.2, moment@^2.22.2:
version "2.22.2"
resolved "https://registry.yarnpkg.com/moment/-/moment-2.22.2.tgz#3c257f9839fc0e93ff53149632239eb90783ff66"
integrity sha1-PCV/mDn8DpP/UxSWMiOeuQeD/2Y=
Expand Down

0 comments on commit a252225

Please sign in to comment.