CircleCI Commit

This commit is contained in:
Wiktor Smaga 2023-12-14 14:42:23 +01:00 committed by Wenszel
parent b8e5c564dd
commit 4e404c8320
4 changed files with 45 additions and 8 deletions

34
.circleci/config.yml Normal file
View 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

View File

@ -47,7 +47,7 @@ const Gameboard = () => {
setTime(data.nextMoveTime);
setStarted(data.started);
});
}, [socket]);
}, [socket, context.playerId, context.roomId, setRolledNumber]);
return (
<>

View File

@ -1,4 +1,4 @@
import React, { useState, useContext, useEffect, useCallback } from 'react';
import React, { useState, useContext, useEffect } from 'react';
import { SocketContext } from '../../../App';
import useInput from '../../../hooks/useInput';
import useKeyPress from '../../../hooks/useKeyPress';

View File

@ -1,10 +1,13 @@
import { useEffect } from 'react';
import { useEffect, useCallback } from 'react';
export default function useKeyPress(targetKey, callback) {
const keyPressHandler = ({ key }) => {
const keyPressHandler = useCallback(
({ key }) => {
if (key === targetKey) {
callback();
}
};
},
[targetKey, callback]
);
useEffect(() => {
window.addEventListener('keydown', keyPressHandler);