From 6377a5084228c61a8bded181259acd3d3e6ce44d Mon Sep 17 00:00:00 2001
From: Jeremie Pardou-Piquemal <571533+jrmi@users.noreply.github.com>
Date: Sun, 7 Jun 2020 20:05:09 +0200
Subject: [PATCH] Clean before publish
---
README.md | 76 ++++++----------------------
public/games/tiktok.svg | 78 +++++++++++++++++++++++++++++
src/atoms/ItemListState.js | 8 ---
src/components/Board.js | 3 +-
src/components/Cursors.js | 3 --
src/components/Item.js | 10 +++-
src/components/PanZoomRotate.js | 6 +--
src/components/Rect.js | 21 --------
src/components/User.js | 23 ---------
src/context/userCtx.js | 7 ---
src/{utils => games}/tiktok.js | 4 +-
src/hooks/useRoom.js | 88 ---------------------------------
src/server.js | 38 --------------
src/socket-client.js | 35 -------------
src/views/BoardView.js | 7 +--
15 files changed, 110 insertions(+), 297 deletions(-)
create mode 100644 public/games/tiktok.svg
delete mode 100644 src/atoms/ItemListState.js
delete mode 100644 src/components/Rect.js
delete mode 100644 src/components/User.js
delete mode 100644 src/context/userCtx.js
rename src/{utils => games}/tiktok.js (96%)
delete mode 100644 src/hooks/useRoom.js
delete mode 100644 src/socket-client.js
diff --git a/README.md b/README.md
index 54ef094..b1312b7 100644
--- a/README.md
+++ b/README.md
@@ -1,68 +1,24 @@
-This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
+# Air board game
-## Available Scripts
+Play any board game with your friends thanks to this tabletop simulator.
-In the project directory, you can run:
+## Installation
-### `npm start`
+You need a recent node version. You can use nvm to initialize your environment.
+Then, execute
-Runs the app in the development mode.
-Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
+```sh
+npm ci # To install dependencies
+```
-The page will reload if you make edits.
-You will also see any lint errors in the console.
+First you need to start the server:
-### `npm test`
+```sh
+npm run server
+```
-Launches the test runner in the interactive watch mode.
-See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
+Then you can run the client:
-### `npm run build`
-
-Builds the app for production to the `build` folder.
-It correctly bundles React in production mode and optimizes the build for the best performance.
-
-The build is minified and the filenames include the hashes.
-Your app is ready to be deployed!
-
-See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
-
-### `npm run eject`
-
-**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
-
-If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
-
-Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
-
-You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
-
-## Learn More
-
-You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
-
-To learn React, check out the [React documentation](https://reactjs.org/).
-
-### Code Splitting
-
-This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting
-
-### Analyzing the Bundle Size
-
-This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size
-
-### Making a Progressive Web App
-
-This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app
-
-### Advanced Configuration
-
-This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration
-
-### Deployment
-
-This section has moved here: https://facebook.github.io/create-react-app/docs/deployment
-
-### `npm run build` fails to minify
-
-This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify
+```sh
+npm start
+```
diff --git a/public/games/tiktok.svg b/public/games/tiktok.svg
new file mode 100644
index 0000000..30ec72c
--- /dev/null
+++ b/public/games/tiktok.svg
@@ -0,0 +1,78 @@
+
+
+
+
diff --git a/src/atoms/ItemListState.js b/src/atoms/ItemListState.js
deleted file mode 100644
index e7b7809..0000000
--- a/src/atoms/ItemListState.js
+++ /dev/null
@@ -1,8 +0,0 @@
-import { atom } from 'recoil';
-
-export const ItemListState = atom({
- key: 'itemList',
- default: [],
-});
-
-export default ItemListState;
diff --git a/src/components/Board.js b/src/components/Board.js
index 66fbdc8..bf7b046 100644
--- a/src/components/Board.js
+++ b/src/components/Board.js
@@ -7,7 +7,6 @@ import { useRecoilValue } from 'recoil';
export const Board = ({ user, users, items, config }) => {
const [c2c, joined, isMaster] = useC2C();
- const [background, setBackground] = React.useState('');
const panZoomRotate = useRecoilValue(PanZoomRotateState);
const onMouseMove = (e) => {
@@ -40,7 +39,7 @@ export const Board = ({ user, users, items, config }) => {
className='content'
style={{
background:
- 'repeating-linear-gradient(45deg, #606dbcA0, #606dbcA0 10px, #46529880 10px, #46529880 20px)',
+ 'repeating-linear-gradient(45deg, #606dbc60, #606dbc60 10px, #46529860 10px, #46529860 20px)',
/*backgroundImage: `url(${background})`,
backgroundSize: '50%',
backgroundPosition: '50% 50%',
diff --git a/src/components/Cursors.js b/src/components/Cursors.js
index a74033e..46c6044 100644
--- a/src/components/Cursors.js
+++ b/src/components/Cursors.js
@@ -1,13 +1,10 @@
import React from 'react';
import { useC2C } from '../hooks/useC2C';
import Cursor from './Cursor';
-import { PanZoomRotateState } from '../components/PanZoomRotate';
-import { useRecoilValue } from 'recoil';
export const Cursors = ({ users }) => {
const [c2c, joined] = useC2C();
const [cursors, setCursors] = React.useState({});
- const panZoomRotate = useRecoilValue(PanZoomRotateState);
const colors = React.useMemo(() => {
return users.reduce((acc, user) => {
diff --git a/src/components/Item.js b/src/components/Item.js
index 05a3377..883ad8d 100644
--- a/src/components/Item.js
+++ b/src/components/Item.js
@@ -45,8 +45,16 @@ const Round = ({ radius, color }) => {
};
// See https://stackoverflow.com/questions/3680429/click-through-div-to-underlying-elements
+// https://developer.mozilla.org/fr/docs/Web/CSS/pointer-events
const Image = ({ width, height, content }) => {
- return ;
+ const size = {};
+ if (width) {
+ size.width = width;
+ }
+ if (height) {
+ size.height = height;
+ }
+ return ;
};
const getComponent = (type) => {
diff --git a/src/components/PanZoomRotate.js b/src/components/PanZoomRotate.js
index ee1d2d6..b53687e 100644
--- a/src/components/PanZoomRotate.js
+++ b/src/components/PanZoomRotate.js
@@ -4,9 +4,9 @@ import { atom, useRecoilState } from 'recoil';
export const PanZoomRotateState = atom({
key: 'PanZoomRotate',
default: {
- translateX: 50,
- translateY: 50,
- scale: 1.2,
+ translateX: 0,
+ translateY: 0,
+ scale: 1,
rotate: 0,
},
});
diff --git a/src/components/Rect.js b/src/components/Rect.js
deleted file mode 100644
index c27275e..0000000
--- a/src/components/Rect.js
+++ /dev/null
@@ -1,21 +0,0 @@
-import React from 'react';
-
-export const Rect = ({
- color = '#DD0022',
- width = 10,
- height = 10,
- style,
- ...props
-}) => (
-