Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 25: Game Integration #43

Merged
merged 86 commits into from
Jul 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
121bee7
Add MatchManager in socket
Hyunse Jul 14, 2020
d0a6651
localstorage -> sessionstorage
Hyunse Jul 14, 2020
632d41b
added button types so forms can be submitted with Enter key
darrenMabbayad Jul 14, 2020
089db5f
seesionStorage -> localStorage
Hyunse Jul 14, 2020
6a59c4f
add server socket listner
Hyunse Jul 14, 2020
cb4b0d3
added gameplay context provider
darrenMabbayad Jul 14, 2020
6db514e
Merge branch 'feature-game-integration' of https://github.com/hatchwa…
darrenMabbayad Jul 14, 2020
71e06a5
changed to local storage
darrenMabbayad Jul 14, 2020
5f75b68
boradcast -> in(gameId)
Hyunse Jul 15, 2020
356d1b7
useEffect to determine who is guessing
darrenMabbayad Jul 15, 2020
85f3e43
Merge branch 'feature-game-integration' of https://github.com/hatchwa…
darrenMabbayad Jul 15, 2020
7adb714
added clue/answer events, disable btns on clue submit
darrenMabbayad Jul 15, 2020
4095635
fixed clientError when sending answer
darrenMabbayad Jul 15, 2020
492e316
prevented rerenders, fixed clientError in backend
darrenMabbayad Jul 15, 2020
77323e5
socket FE-reset-game -> game-started, check answer toLowerCase(), Add…
Hyunse Jul 15, 2020
8891728
added next round screen with socket events
darrenMabbayad Jul 15, 2020
01569d3
Merge branch 'feature-game-integration' of https://github.com/hatchwa…
darrenMabbayad Jul 15, 2020
735a0ce
pulled from origin, moved gameState into NextRoundScreen
darrenMabbayad Jul 15, 2020
3b354ca
added close score screen, enable inputs
darrenMabbayad Jul 15, 2020
5b8d6c6
enable-submit event -> moved to function
darrenMabbayad Jul 16, 2020
76aef90
close screen event => moved to function
darrenMabbayad Jul 16, 2020
6c642af
moved timer to context
darrenMabbayad Jul 16, 2020
5215d4d
Revert "moved timer to context"
darrenMabbayad Jul 16, 2020
8b7dcc0
implemented next round and guesser logic
darrenMabbayad Jul 16, 2020
5532716
added end game screen, redirect to create-game
darrenMabbayad Jul 16, 2020
372bb97
Add BE-leave-game, BE-end-game
Hyunse Jul 16, 2020
ba15ca4
display points/name on PlayerPanel
darrenMabbayad Jul 16, 2020
4e06d52
added typing notification and round timer component
darrenMabbayad Jul 17, 2020
8f7a1e5
Add new round end game
Hyunse Jul 17, 2020
a78f59a
Add Timer
Hyunse Jul 17, 2020
40571e9
update Words
Hyunse Jul 17, 2020
496c0b7
implemented save game, end game, play again
darrenMabbayad Jul 18, 2020
05749bb
Merge branch 'feature-game-integration' of https://github.com/hatchwa…
darrenMabbayad Jul 18, 2020
2df8fc6
Remove BE-restart-game
Hyunse Jul 18, 2020
9b3c907
Removed joinGame, playersCurrentlyReady & Add wating player array in …
Hyunse Jul 20, 2020
a25ad54
added play again redirect
darrenMabbayad Jul 20, 2020
ef02e67
Merge branch 'feature-game-integration' of https://github.com/hatchwa…
darrenMabbayad Jul 20, 2020
5c8a48e
added joinGame to useEffect dependancy
darrenMabbayad Jul 20, 2020
48741c1
added client game phase timers
darrenMabbayad Jul 20, 2020
1a39556
BE-leave-game
Hyunse Jul 21, 2020
85451d7
Merge branch 'feature-game-integration' of https://github.com/hatchwa…
Hyunse Jul 21, 2020
71c9dd5
Move JoinGame, JoinNewGame to GamePlayContext, Add check duplicated p…
Hyunse Jul 21, 2020
dcdc403
ui changes, fixed playAgain, implemented server timer
darrenMabbayad Jul 21, 2020
cf8a835
added ui for joining without entering game ID
darrenMabbayad Jul 21, 2020
2ca40a5
npm -i cookie, added socket security
darrenMabbayad Jul 21, 2020
3e96812
clear clues array every round
darrenMabbayad Jul 21, 2020
ce71535
clue bugfixes
darrenMabbayad Jul 21, 2020
caf1737
some changes to socket security
darrenMabbayad Jul 21, 2020
1bf315b
merged dev, resolved conflicts
InsafKhamzin Jul 21, 2020
4a30439
merged commit, resolved conflicts
InsafKhamzin Jul 21, 2020
9f82d54
Deleted unused staticImg
Hyunse Jul 21, 2020
256e35c
error handled when starting without 4 players, check auth in Gameplay…
darrenMabbayad Jul 21, 2020
53d2d93
Merge branch 'feature-game-integration' of https://github.com/hatchwa…
darrenMabbayad Jul 21, 2020
f0b8b71
Fixed wating list
Hyunse Jul 22, 2020
7731599
Merge branch 'feature-game-integration' of https://github.com/hatchwa…
Hyunse Jul 22, 2020
de85aad
add socket.disconnect() if there is no token
Hyunse Jul 22, 2020
bec70cd
fixed useEffect complaints in GameContext
darrenMabbayad Jul 22, 2020
c3f4701
added removeLocalStorage function on 401 error
darrenMabbayad Jul 22, 2020
fb8b53c
display individual clues on game screen
darrenMabbayad Jul 22, 2020
5cf21fd
display notification when typing
darrenMabbayad Jul 22, 2020
b586ca6
display error if clue submitted is empty string
darrenMabbayad Jul 22, 2020
3c5aa36
prep for merge with fetch-intercept, handle socket auth errors
darrenMabbayad Jul 22, 2020
84fc50f
Moved submittedClues to engine
Hyunse Jul 22, 2020
e513d13
Merge branch 'feature-game-integration' of https://github.com/hatchwa…
Hyunse Jul 22, 2020
7c179d2
fixed initTypingStatus -> initTypingStatusAndMsg
Hyunse Jul 22, 2020
ed5983e
removed resetClues
Hyunse Jul 22, 2020
6180691
fixed display clues on PlayerPanel, organized GameplayContext/sockets.js
darrenMabbayad Jul 22, 2020
93e3990
Merge branch 'feature-game-integration' of https://github.com/hatchwa…
darrenMabbayad Jul 22, 2020
89d6177
add try catch
Hyunse Jul 22, 2020
cc78caf
removed console.log
Hyunse Jul 22, 2020
7fb61d2
display guesser, fixed bug when joining a match
darrenMabbayad Jul 22, 2020
bfa3e6b
Merge branch 'feature-game-integration' of https://github.com/hatchwa…
darrenMabbayad Jul 22, 2020
58ad222
pull from origin, resolve conflicts
darrenMabbayad Jul 22, 2020
b9277fa
properly displays invalid clue in guess phase
darrenMabbayad Jul 22, 2020
3bc2851
Add Leave Game Btn in Lobby & leaveGame Route, Query, Add severity in…
Hyunse Jul 23, 2020
b3a8faa
Merge branch 'feature-game-integration' of https://github.com/hatchwa…
Hyunse Jul 23, 2020
c8ecbf6
add 2 audio sounds with howlerjs
darrenMabbayad Jul 23, 2020
fa0155f
Merge branch 'feature-game-integration' of https://github.com/hatchwa…
darrenMabbayad Jul 23, 2020
9fd39a8
fixed invalid clue display, added game sounds
darrenMabbayad Jul 23, 2020
8ecad13
ui edits, add hints for clue giver
darrenMabbayad Jul 23, 2020
7b81f02
removed unused variable
Hyunse Jul 23, 2020
9106396
Merge branch 'feature-game-integration' of https://github.com/hatchwa…
Hyunse Jul 23, 2020
d5eb1c6
Merge branch 'dev' into feature-game-integration
darrenMabbayad Jul 23, 2020
96b7dec
Merge branch 'feature-game-integration' of https://github.com/hatchwa…
darrenMabbayad Jul 23, 2020
50d934f
fix height game session, fix currentUser = null, delete unused files
darrenMabbayad Jul 23, 2020
299a752
added window dimension util, /create-game and /lobby are fully respon…
darrenMabbayad Jul 23, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ yarn-error.log*

#TODO add .env to your gitignore
server/.env

.vscode
11 changes: 8 additions & 3 deletions client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"@material-ui/core": "^4.1.3",
"@material-ui/icons": "^4.9.1",
"@material-ui/lab": "^4.0.0-alpha.56",
"howler": "^2.2.0",
"fetch-intercept": "^2.3.1",
"react": "^16.8.6",
"react-dom": "^16.8.6",
Expand Down
39 changes: 23 additions & 16 deletions client/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import "./App.css";

import { theme } from "./themes/theme";
import { AuthContext } from "./context/AuthContext";
import { GameplayContextProvider } from "./context/GameplayContext";
import { RTCContextProvider } from "./context/RTCContext";
import { GameContextProvider } from "./context/GameContext";

import LoginOrSignUp from "./pages/LoginOrSignUp";
import CreateOrJoinGame from "./pages/CreateOrJoinGame";
Expand Down Expand Up @@ -64,26 +66,31 @@ function App() {
{auth ? <Redirect to={redirectPath} /> : <LoginOrSignUp />}
</Route>

<ProtectedRoute
exact
path="/create-game"
component={CreateOrJoinGame}
auth={auth}
/>
<ProtectedRoute
exact
path="/lobby/:gameId"
component={PreGameLobby}
auth={auth}
/>
<RTCContextProvider>
<GameContextProvider>
<ProtectedRoute
exact
path="/session/:gameId"
component={GameSession}
path="/create-game"
component={CreateOrJoinGame}
auth={auth}
/>
</RTCContextProvider>
<GameplayContextProvider>
<ProtectedRoute
exact
path="/lobby/:gameId"
component={PreGameLobby}
auth={auth}
/>
<RTCContextProvider>
<ProtectedRoute
exact
path="/session/:gameId"
component={GameSession}
auth={auth}
/>
</RTCContextProvider>
</GameplayContextProvider>
</GameContextProvider>

<Route component={PageNotFound} />
</Switch>
</BrowserRouter>
Expand Down
6 changes: 5 additions & 1 deletion client/src/components/FormInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ function FormInput({
hasAdornment,
adornmentText,
onClick,
isDisabled,
handleOnKeyUp,
...props
}) {
const classes = useStyles();
Expand All @@ -32,10 +34,12 @@ function FormInput({
type={label}
onChange={handleChange}
fullWidth
disabled={isDisabled}
onKeyUp={handleOnKeyUp}
endAdornment={
hasAdornment && (
<InputAdornment position="end">
<GenericButton handleClick={onClick} isAdornment>
<GenericButton handleClick={onClick} isSubmit isAdornment>
{adornmentText}
</GenericButton>
</InputAdornment>
Expand Down
12 changes: 10 additions & 2 deletions client/src/components/GenericButton.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
import React from "react";
import { Button, makeStyles } from "@material-ui/core";

function GenericButton({ children, handleClick, isAdornment }) {
function GenericButton({
children,
handleClick,
isSubmit,
isDisabled,
isAdornment,
}) {
const classes = useStyles();
return (
<Button
style={{
padding: isAdornment ? "0.5em 1em" : "1em 3em",
padding: isAdornment ? "0.5em 1em" : "0.75em 2.75em",
letterSpacing: isAdornment ? "1px" : "2.5px",
borderRadius: isAdornment ? "2px" : "8px",
}}
className={classes.button}
variant="contained"
onClick={handleClick}
type={isSubmit ? "submit" : "button"}
disabled={isDisabled}
>
{children}
</Button>
Expand Down
43 changes: 21 additions & 22 deletions client/src/components/Notification.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,34 @@
//popping notification

import React from 'react'
import Snackbar from '@material-ui/core/Snackbar';
import MuiAlert from '@material-ui/lab/Alert'
import { makeStyles } from '@material-ui/core/styles';
import React from "react";
import Snackbar from "@material-ui/core/Snackbar";
import MuiAlert from "@material-ui/lab/Alert";
import { makeStyles } from "@material-ui/core/styles";

function Alert(props) {
return <MuiAlert elevation={6} variant="filled" {...props} />;
return <MuiAlert elevation={6} variant="filled" {...props} />;
}

function Notification({open, msg, handleClose}) {
const classes = useStyles();
return (
<div className={classes.root}>
<Snackbar open={open} autoHideDuration={4000} onClose={handleClose}>
<Alert onClose={handleClose} severity="success">
{msg}
</Alert>
</Snackbar>
</div>
)
function Notification({ open, msg, handleClose, severity = "success" }) {
const classes = useStyles();
return (
<div className={classes.root}>
<Snackbar open={open} autoHideDuration={4000} onClose={handleClose}>
<Alert onClose={handleClose} severity={severity}>
{msg}
</Alert>
</Snackbar>
</div>
);
}

const useStyles = makeStyles((theme) => ({
root: {
width: '100%',
'& > * + *': {
marginTop: theme.spacing(2),
},
root: {
width: "100%",
"& > * + *": {
marginTop: theme.spacing(2),
},
},
}));

export default Notification;

28 changes: 14 additions & 14 deletions client/src/components/Settings.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import React, { useState, useContext } from "react";
import SettingsIcon from "@material-ui/icons/Settings";
import VideocamIcon from '@material-ui/icons/Videocam';
import Mic from '@material-ui/icons/Mic';
import VideocamIcon from "@material-ui/icons/Videocam";
import Mic from "@material-ui/icons/Mic";
import { makeStyles, IconButton, Menu, MenuItem } from "@material-ui/core";
import Switch from '@material-ui/core/Switch';
import {RTCContext} from '../context/RTCContext';
import Switch from "@material-ui/core/Switch";
import { RTCContext } from "../context/RTCContext";

function Settings() {
const classes = useStyles();
const [anchorEl, setAnchorEl] = useState(null);
const {playerAudioOn, playerVideoOn, switchVideo, switchAudio} = useContext(RTCContext);
const { playerAudioOn, playerVideoOn, switchVideo, switchAudio } = useContext(
RTCContext
);

const handleClick = (event) => {
setAnchorEl(event.currentTarget);
Expand All @@ -20,7 +22,7 @@ function Settings() {
};

return (
<div>
<>
<IconButton onClick={handleClick}>
<SettingsIcon className={classes.icon} />
</IconButton>
Expand All @@ -30,31 +32,30 @@ function Settings() {
keepMounted
open={Boolean(anchorEl)}
onClose={handleClose}
disableScrollLock
>
<MenuItem
disableTouchRipple={true}>
<MenuItem disableTouchRipple={true}>
<VideocamIcon />
<Switch
checked={playerVideoOn}
onChange={switchVideo}
size="small"
name="checkedA"
inputProps={{ 'aria-label': 'secondary checkbox' }}
inputProps={{ "aria-label": "secondary checkbox" }}
/>
</MenuItem>
<MenuItem
disableTouchRipple={true}>
<MenuItem disableTouchRipple={true}>
<Mic />
<Switch
checked={playerAudioOn}
onChange={switchAudio}
size="small"
name="checkedB"
inputProps={{ 'aria-label': 'secondary checkbox' }}
inputProps={{ "aria-label": "secondary checkbox" }}
/>
</MenuItem>
</Menu>
</div>
</>
);
}

Expand All @@ -66,5 +67,4 @@ const useStyles = makeStyles((theme) => ({
},
}));


export default Settings;
Loading