CircleCI Commit
This commit is contained in:
parent
b8e5c564dd
commit
4e404c8320
34
.circleci/config.yml
Normal file
34
.circleci/config.yml
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
version: 2.1
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build_and_test:
|
||||||
|
docker:
|
||||||
|
- image: circleci/node:14
|
||||||
|
|
||||||
|
working_directory: ~/app
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- run:
|
||||||
|
name: Install Frontend Dependencies
|
||||||
|
command: |
|
||||||
|
npm install
|
||||||
|
- run:
|
||||||
|
name: Install Backend Dependencies
|
||||||
|
command: |
|
||||||
|
cd backend
|
||||||
|
npm install
|
||||||
|
- run:
|
||||||
|
name: Build Frontend
|
||||||
|
command: |
|
||||||
|
npm run build
|
||||||
|
- run:
|
||||||
|
name: Test Frontend
|
||||||
|
command: |
|
||||||
|
npm test
|
||||||
|
|
||||||
|
workflows:
|
||||||
|
version: 2
|
||||||
|
build:
|
||||||
|
jobs:
|
||||||
|
- build_and_test
|
||||||
@ -47,7 +47,7 @@ const Gameboard = () => {
|
|||||||
setTime(data.nextMoveTime);
|
setTime(data.nextMoveTime);
|
||||||
setStarted(data.started);
|
setStarted(data.started);
|
||||||
});
|
});
|
||||||
}, [socket]);
|
}, [socket, context.playerId, context.roomId, setRolledNumber]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import React, { useState, useContext, useEffect, useCallback } from 'react';
|
import React, { useState, useContext, useEffect } from 'react';
|
||||||
import { SocketContext } from '../../../App';
|
import { SocketContext } from '../../../App';
|
||||||
import useInput from '../../../hooks/useInput';
|
import useInput from '../../../hooks/useInput';
|
||||||
import useKeyPress from '../../../hooks/useKeyPress';
|
import useKeyPress from '../../../hooks/useKeyPress';
|
||||||
|
|||||||
@ -1,10 +1,13 @@
|
|||||||
import { useEffect } from 'react';
|
import { useEffect, useCallback } from 'react';
|
||||||
export default function useKeyPress(targetKey, callback) {
|
export default function useKeyPress(targetKey, callback) {
|
||||||
const keyPressHandler = ({ key }) => {
|
const keyPressHandler = useCallback(
|
||||||
if (key === targetKey) {
|
({ key }) => {
|
||||||
callback();
|
if (key === targetKey) {
|
||||||
}
|
callback();
|
||||||
};
|
}
|
||||||
|
},
|
||||||
|
[targetKey, callback]
|
||||||
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
window.addEventListener('keydown', keyPressHandler);
|
window.addEventListener('keydown', keyPressHandler);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user