Skip to content
Permalink
Browse files

scaffolding for 3 screens

  • Loading branch information...
tadasant committed Nov 3, 2018
1 parent d00303b commit 61895b747338c12e7fb39b837bb29792d497b460
@@ -14,6 +14,7 @@
"react": "^16.6.0",
"react-apollo": "^2.2.4",
"react-dom": "^16.6.0",
"react-router-dom": "^4.3.1",
"react-scripts": "2.1.1"
},
"scripts": {
@@ -1,8 +1,18 @@
import * as React from 'react';
import {Fragment} from 'react';
import {BrowserRouter, Route} from 'react-router-dom';
import GameScreen from './game/GameScreen';
import LoginScreen from './login/LoginScreen';
import ResultScreen from './result/ResultScreen';

const Routing = () => (
<GameScreen/>
<BrowserRouter>
<Fragment>
<Route path='/' exact component={LoginScreen}/>
<Route path='/game' exact component={GameScreen}/>
<Route path='/results' exact component={ResultScreen}/>
</Fragment>
</BrowserRouter>
);

export default Routing;
@@ -0,0 +1,21 @@
import * as React from 'react';
import {graphql} from 'react-apollo';
import gql from 'graphql-tag';

const PLAYER_QUERY = gql`
query {
Player {
id
}
}
`;

const LoginScreen = props => (
<div>
ID: {props.data.Player && props.data.Player.length > 0 && props.data.Player[0].id}
</div>
);

const withResults = graphql(PLAYER_QUERY);

export default withResults(LoginScreen);
@@ -0,0 +1,21 @@
import * as React from 'react';
import {graphql} from 'react-apollo';
import gql from 'graphql-tag';

const RESULT_QUERY = gql`
query {
Result {
id
}
}
`;

const ResultScreen = props => (
<div>
ID: {props.data.Result && props.data.Result.length > 0 && props.data.Result[0].id}
</div>
);

const withResults = graphql(RESULT_QUERY);

export default withResults(ResultScreen);

0 comments on commit 61895b7

Please sign in to comment.
You can’t perform that action at this time.