Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
BryceMindLab committed Feb 17, 2019
1 parent 783bcac commit 05e540d
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 15 deletions.
4 changes: 0 additions & 4 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
<link rel="stylesheet" href="/assets/css/flipclock.css">

<!--
Notice the use of %PUBLIC_URL% in the tag above.
Expand All @@ -19,7 +18,6 @@
</head>
<body>
<div id="root"></div>
<div class="your-clock"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
Expand All @@ -31,7 +29,5 @@
To create a production bundle, use `npm run build`.
-->
<script src="/assets/js/libs/jquery.js"></script>
<script src="/assets/js/flipclock/flipclock.min.js"></script>
</body>
</html>
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ ReactDOM.render((
<Route exact path="/" component={Splash} />
<Route path="/leaderboard" component={Leaderboard} />
<Route path="/minigame" component={MiniGame} />
<Route path="/minigame/:tagId" component={MiniGame} />" component={MiniGame} />
</div>
</Router>
</AppContainer>
Expand Down
6 changes: 4 additions & 2 deletions src/layouts/MiniGame/GameInProgress.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ import { scanTag } from '../../provider/geohunterContract'
import QRScanner from './QRScanner.jsx'
import MiniGameLevel from './MiniGameLevel.jsx'



class GameInProgess extends Component {

handleScanId(id){
let { userData } = this.props;
scanTag(
userData._userDid,
userData._userDid,
userData._userName,
id
)
Expand All @@ -19,7 +21,7 @@ class GameInProgess extends Component {
return (
<div>
<QRScanner scannedObject={(id) => this.handleScanId(id)}/>

<MiniGameLevel />
</div>
);
}
Expand Down
44 changes: 36 additions & 8 deletions src/layouts/MiniGame/MiniGameLevel.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import React, { Component } from 'react'
import styled from 'styled-components'
import { connect } from 'react-redux';
import { connect } from 'react-redux'
import QRScanner from './QRScanner.jsx'
import { scanTag } from '../../provider/geohunterContract'


const mapStateToProps = (state) => {
return {
user: state.user,
user: state.user.data,
progress: state.user.data._progress,
}
}
Expand All @@ -15,16 +17,42 @@ const mapDispatchToProps = (dispatch) => {
}

class MiniGameLevel extends Component {
state = {}
state = {
hideQr: false
}

componentDidMount() {
const { match: { params } } = this.props;

console.log(`MiniGameLevel: ${params.tagId}`)


}

async scannedId(id) {
let { user } = this.props;
await scanTag(user._userDid, user._username, id)

this.setState({
hideQr: true
})


}

render() {
let { progress } = this.props
let { progress, user } = this.props
let { hideQr } = this.state

return (
<QRScanner
hide={false}
/>
<h1>Next Level: {progress + 1 }!</h1>
<div>
<h1>Next Level: {progress + 1 }!</h1>

<QRScanner
hide={hideQr}
scannedObject={(id) => this.scannedId(id)}
/>
</div>
)
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/layouts/MiniGame/QRScanner.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class QRScanner extends Component {

let urlSplit = data.split('/')
if(urlSplit.length) {
tagId = urlSplit(urlSplit.length - 1)
tagId = urlSplit([urlSplit.length - 1])
scannedObject(tagId)
} else {
// TODO invalid data
Expand Down

0 comments on commit 05e540d

Please sign in to comment.