-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
336162a
commit b9c0c16
Showing
24 changed files
with
220 additions
and
661 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
10 changes: 0 additions & 10 deletions
10
app/components/Input/__tests__/__snapshots__/index.test.js.snap
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import styled from 'styled-components'; | ||
|
||
export const Container = styled.div` | ||
margin: 5px 15px; | ||
margin-top: 20px; | ||
padding: 15px 20px; | ||
border: 1px solid #4d4d4d; | ||
display: flex; | ||
flex-direction: column; | ||
position: relative; | ||
`; | ||
|
||
export const Header = styled.div` | ||
position: absolute; | ||
top: -12px; | ||
left: 10px; | ||
color: #8d8d8d; | ||
background: black; | ||
padding: 0 10px; | ||
font-weight: 700; | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import React, { PureComponent } from 'react'; | ||
import styled from 'styled-components'; | ||
import { Container, Header } from '@/components/Mux'; | ||
import LotteryContract from '@/services/Lottery'; | ||
import LotteryItem from './LotteryItem'; | ||
|
||
const StretchedContainer = styled(Container)` | ||
flex: 1 1 auto; | ||
`; | ||
|
||
const Body = styled.div` | ||
overflow: auto; | ||
position: absolute; | ||
height: calc(100% - 30px); | ||
width: calc(100% - 40px); | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: flex-end; | ||
`; | ||
|
||
// eslint-disable-next-line react/prefer-stateless-function | ||
class Console extends PureComponent { | ||
state = { | ||
list: [], | ||
}; | ||
|
||
componentDidMount() { | ||
this.updateList(); | ||
setInterval(this.updateList, 10000); | ||
} | ||
|
||
updateList = () => { | ||
LotteryContract.getPastEvents('NumberRevealed', { | ||
fromBlock: 0, | ||
toBlock: 'latest', | ||
}) | ||
.then(events => this.setState({ list: events })); | ||
} | ||
|
||
render() { | ||
const { list } = this.state; | ||
|
||
return ( | ||
<StretchedContainer> | ||
<Header> | ||
Lottery History | ||
</Header> | ||
|
||
<Body> | ||
{list.map(event => ( | ||
<LotteryItem | ||
key={event.transactionHash} | ||
hash={event.transactionHash} | ||
timestamp={event.returnValues[0]} | ||
number={`00${event.returnValues[1]}`.slice(-3)} | ||
rawValue={event.returnValues[2]} | ||
/> | ||
))} | ||
</Body> | ||
</StretchedContainer> | ||
); | ||
} | ||
} | ||
|
||
export default Console; |
Oops, something went wrong.