-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathApp.js
71 lines (58 loc) · 2.83 KB
/
App.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
70
71
import React, { Component, Fragment } from 'react';
import { BrowserRouter as Router, Route } from "react-router-dom";
import { NotificationContainer } from 'react-notifications';
import ErrorHandler from './Components/ErrorHandler';
import NavBar from './Components/Navbar';
import Challenge from './Components/Challenge';
import Homepage from './Components/Homepage';
import Faq from './Components/Faq';
import './App.css';
import '../node_modules/react-notifications/dist/react-notifications.css';
import UpdateableOwnable from './build/contracts/UpdateableOwnable';
import Contract from './build/contracts/Contract';
class App extends Component {
constructor(props) {
super(props);
this.state = {
account: null,
nickname: null
}
}
challenges = [
{
title: 'Multi-Owner Contract',
difficulty: 'EASY',
description: 'My friend wanted to create a new type of ownable contract where multiple people can be owners. However, when he deployed it for his token sale, someone managed to add themself and many other owners and they minted tons of their own tokens! Luckily the sale hasn\'t started yet, help him find the bug so he can deploy a new contract and save his ICO.',
artifact: UpdateableOwnable
},
{
title: 'Lorem ipsum',
difficulty: 'Medium',
description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam finibus massa pretium consectetur maximus. Proin condimentum interdum scelerisque. Phasellus in diam ligula. Nunc ac convallis nisi, at porta enim. Nunc felis nisi, euismod cursus suscipit sodales, elementum id eros. Etiam mauris ante, bibendum ut arcu id, rhoncus volutpat tortor. Praesent sed pellentesque enim, vel viverra nisi. Morbi cursus vehicula libero.',
artifact: Contract
}
];
setAccount = (account, nickname) => {
this.setState({account, nickname})
}
render() {
return (
<Fragment>
<Router>
<NavBar challenges={ this.challenges } account={ this.state.account } nickname={ this.state.nickname }/>
<NotificationContainer/>
<Route path="/" exact render={ (props) => <Homepage {...props} challenges={ this.challenges } /> }/>
<Route path="/challenge/:id" render={ props => {
return (
<ErrorHandler>
<Challenge {...props} setAccount={ this.setAccount } challenges={ this.challenges }></Challenge>
</ErrorHandler>
);
}}/>
<Route path="/faq" component={ Faq }/>
</Router>
</Fragment>
);
}
}
export default App;