Skip to content

Commit

Permalink
Starting to operate with a bit of functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Hands committed Oct 24, 2019
1 parent 0e0dd8f commit 6cb7097
Show file tree
Hide file tree
Showing 24 changed files with 17,319 additions and 17,436 deletions.
2 changes: 1 addition & 1 deletion .firebaserc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"projects": {
"default": "duzza-cards"
"default": "perudo-3e05b"
}
}
1 change: 1 addition & 0 deletions firebase.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"hosting": {
"site": "perudo-sl",
"public": "build",
"ignore": [
"firebase.json",
Expand Down
137 changes: 84 additions & 53 deletions functions/index.js

Large diffs are not rendered by default.

34,344 changes: 17,172 additions & 17,172 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "duzza-games",
"name": "perudo",
"version": "0.1.0",
"private": true,
"dependencies": {
Expand Down
Binary file removed public/cwood-colors-striped.png
Binary file not shown.
Binary file added public/dice.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed public/favicon.ico
Binary file not shown.
19 changes: 11 additions & 8 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>

<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="theme-color" content="#000000">
Expand All @@ -9,7 +10,7 @@
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
<link rel="shortcut icon" href="%PUBLIC_URL%/cwood-colors-striped.png">
<link rel="shortcut icon" href="%PUBLIC_URL%/dice.png">
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Expand All @@ -23,11 +24,12 @@
<!-- Compiled and minified CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0-beta/css/materialize.min.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" />
<title>Duzza Games</title>
</head>
<body>
<title>Perudo</title>
</head>

<body>
<noscript>
You need to enable JavaScript to run this app.
You need to enable JavaScript to run this app.
</noscript>
<div id="root"></div>
<!--
Expand All @@ -41,5 +43,6 @@
To create a production bundle, use `npm run build` or `yarn build`.
-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0-beta/js/materialize.min.js"></script>
</body>
</html>
</body>

</html>
Binary file removed public/logo192.png
Binary file not shown.
Binary file removed public/logo512.png
Binary file not shown.
26 changes: 13 additions & 13 deletions public/manifest.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"short_name": "Duzza Games",
"name": "Duzza Games",
"icons": [
{
"src": "cwood-colors-striped.png",
"sizes": "192x192 64x64 32x32 24x24 16x16",
"type": "image/png"
}
],
"start_url": "./index.html",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
"short_name": "Perudo",
"name": "Perudo",
"icons": [
{
"src": "dice.png",
"sizes": "192x192 64x64 32x32 24x24 16x16",
"type": "image/png"
}
],
"start_url": "./index.html",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
12 changes: 0 additions & 12 deletions src/App.js

This file was deleted.

3 changes: 0 additions & 3 deletions src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import defaultStyles from './App.module.scss';
import NewNavbar from './navbar/NewNavbar';
import CreateGame from './games/creategame/CreateGame';
import JoinGame from './games/joingame/JoinGame';
import Cards from './games/Cards';
import Perudo from './games/perudo/PerudoContainer';

const App = props => (
Expand All @@ -37,8 +36,6 @@ const App = props => (
<AuthenticatedRoute exact path="/profile" component={Profile} />
<AuthenticatedRoute exact path="/join-game" component={JoinGame} />
<AuthenticatedRoute exact path="/create-game" component={CreateGame} />
<AuthenticatedRoute exact path="/cards" component={Cards} />
<AuthenticatedRoute exact path="/perudo" component={Perudo} />
<AuthenticatedRoute exact path="/game/:gameId" component={Perudo} />
<UnauthenticatedRoute path="/sign-in" component={SignIn} redirect="/dashboard" />
<UnauthenticatedRoute path="/sign-up" component={SignUp} redirect="/dashboard" />
Expand Down
2 changes: 1 addition & 1 deletion src/configureStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ const store = createStore(rootReducer, composeEnhancers(applyMiddleware(sagaMidd

sagaMiddleware.run(rootSaga);

export default store;
export default store;
94 changes: 0 additions & 94 deletions src/games/Cards.jsx

This file was deleted.

34 changes: 0 additions & 34 deletions src/games/Cards.module.scss

This file was deleted.

4 changes: 2 additions & 2 deletions src/games/joingame/JoinGame.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ JoinGame.propTypes = {
};

const mapStateToProps = state => {
const games = state.firestore.data.available_games;
const {games} = state.firestore.data;
return {
games
};
Expand All @@ -184,6 +184,6 @@ const mapDispatchToProps = {
export default compose(
connect(mapStateToProps, mapDispatchToProps),
firestoreConnect([{
collection: 'available_games'
collection: 'games'
}])
)(JoinGame);
5 changes: 2 additions & 3 deletions src/games/perudo/Perudo.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,10 @@ const Perudo = props => {
const color = useMemo(() => colors.find(x => x.id === props.playerNum), [props.playerNum]);

useEffect(() => {
if (props.diceFetched) {
if (props.diceFetched && props.rolled) {
diceRef.current.rollAll(props.diceArray);
}
}, [props.rolled, props.diceArray]);
console.log(props);
}, [props.rolled, props.diceFetched, props.diceArray]);

return (
<div className={styles.gameContainer}>
Expand Down
33 changes: 27 additions & 6 deletions src/games/perudo/PerudoContainer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const PerudoContainer = ({
},
[props.startGame, props.gameId]);

const activePlayer = fp.get('name')(Object.values(props.players).find(x => x.playerNumber === props.game.activePlayerNum));
const activePlayer = fp.get('name')(Object.values(props.players).find(x => fp.get('playerNumber')(x) === props.game.activePlayerNum));

const playerNum = fp.get('playerNumber')(Object.values(props.players).find(x => x.id === props.auth.uid));
const rolled = fp.get('rolled')(Object.values(props.players).find(x => x.id === props.auth.uid));
Expand Down Expand Up @@ -212,8 +212,29 @@ PerudoContainer.defaultProps = {
shakerUp: false,
rolling: false,
toggleShaker: fp.noop,
game: {},
players: {},
game: {
creator: {
id: '',
name: ''
},
game_started: false,
name: '',
activePlayerNum: 1,
currentBid: {
quantity: 0,
value: 0
},
round: 1
},
players: {
'': {
id: '',
name: '',
numOfDice: 5,
readyToPlay: false,
rolled: false
}
},
diceRolled: {},
gameId: '',
readyToPlay: fp.noop,
Expand Down Expand Up @@ -253,19 +274,19 @@ export default compose(
connect(mapStateToProps, mapDispatchToProps),
firestoreConnect(props => [
{
collection: 'available_games',
collection: 'games',
doc: getGameId(props),
subcollections: [
{ collection: 'players' }
],
storeAs: 'players'
},
{
collection: 'available_games',
collection: 'games',
doc: getGameId(props)
},
{
collection: 'available_games',
collection: 'games',
doc: getGameId(props),
subcollections: [
{ collection: 'diceRolled' }
Expand Down
2 changes: 1 addition & 1 deletion src/games/perudo/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const getGameId = props => fp.flow(
export const getGame = (state, props) => fp.flow(
fp.get('firestore'),
fp.get('data'),
fp.get('available_games'),
fp.get('games'),
fp.get(getGameId(props))
)(state);

Expand Down
17 changes: 0 additions & 17 deletions src/index.js

This file was deleted.

Loading

0 comments on commit 6cb7097

Please sign in to comment.