Skip to content

Commit

Permalink
Merge branch 'dev' into renovate/major-jest-monorepo
Browse files Browse the repository at this point in the history
  • Loading branch information
piggydoughnut authored Oct 21, 2020
2 parents f80dba6 + 2d1add7 commit 150a6f3
Show file tree
Hide file tree
Showing 48 changed files with 1,925 additions and 1,739 deletions.
27 changes: 10 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,25 @@ Currently, to play, you will need to run your own back-end nodes. We are working

## Development

- Run `npm install` and `npm start` in the root folder This will fire up a web server and you can try the app via http://localhost:1234
Server runs at port 1234 - http://localhost:1234

- Run `npm run electron-dev` to start the Electron app in development.
- `npm install && npm run dev` - start with `NODE_ENV=development`

Run `npm electron-pack` to package the app with electron-builder for MacOS, Windows and Linux.
- `npm run electron-dev` to start the Electron app in development.

### Pre-push GitHook
- `npm electron-pack` to package the app with electron-builder for MacOS, Windows and Linux.

In order not to fail Gitub CI all the time, set up a local git hook to check lint and run tests before a push to the repo.
### Debugging

[Pre push Github docs](https://www.git-scm.com/docs/githooks#_pre_push)
browser plugin [React Context Dev Tools](https://github.com/deeppatel234/react-context-devtool)

### Sockets

`nano ./.git/hooks/pre-push`
When the player enters the game he opens two socket connections:

```
set -e
node_modules/eslint/bin/eslint.js './src/' --ext .js,.ts,.tsx
npm run test
```
- for writing `playerWrite`

`sudo chmod +x ./.git/hooks/pre-push`
- for reading `playerRead`

### State Management

Expand All @@ -42,10 +39,6 @@ https://blog.logrocket.com/use-hooks-and-context-not-react-and-redux/
Good video explaining redux vs context state management approach
https://www.youtube.com/watch?time_continue=134&v=eBYJ7O482Dc&feature=emb_title

### Developer Mode

You can activate developer mode and skip the startup modal by adjusting the `src/config/local.json`.

### Environment variables in scripts

REDUCER - adds extra logging from reducer to the console output.
Expand Down
2,197 changes: 1,118 additions & 1,079 deletions package-lock.json

Large diffs are not rendered by default.

63 changes: 32 additions & 31 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"main": "src/electron.js",
"husky": {
"hooks": {
"pre-commit": "npm test && node_modules/eslint/bin/eslint.js './src/' --ext .js,.ts,.tsx --fix"
"pre-commit": "node_modules/eslint/bin/eslint.js './src/' --ext .js,.ts,.tsx --fix",
"pre-push": "npm run test"
}
},
"scripts": {
Expand Down Expand Up @@ -56,36 +57,36 @@
},
"homepage": "https://github.com/norbertdragan/pangea-poker-gui#readme",
"dependencies": {
"@emotion/core": "^10.0.27",
"@emotion/core": "10.0.35",
"@emotion/styled": "^10.0.27",
"@sentry/browser": "^5.10.2",
"@types/react-modal": "^3.10.4",
"@sentry/browser": "5.26.0",
"@types/react-modal": "3.10.6",
"axios": "^0.20.0",
"babel-jest": "^26.0.0",
"concurrently": "^5.1.0",
"concurrently": "5.3.0",
"cssnano": "^4.1.10",
"deep-diff": "^1.0.2",
"electron-is-dev": "^1.1.0",
"electron-is-dev": "1.2.0",
"emotion": "^10.0.27",
"howler": "^2.1.3",
"howler": "2.2.0",
"normalize.css": "^8.0.1",
"rc-slider": "^9.0.0",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-hook-form": "^5.0.3",
"react-modal": "^3.11.1",
"react-tabs": "^3.1.0",
"react-tooltip": "^4.0.3",
"react-use-websocket": "^1.0.0",
"wait-on": "^4.0.0"
"rc-slider": "9.5.3",
"react": "16.14.0",
"react-dom": "16.14.0",
"react-hook-form": "5.7.2",
"react-modal": "3.11.2",
"react-tabs": "3.1.1",
"react-tooltip": "4.2.10",
"react-use-websocket": "^2.0.0",
"wait-on": "4.0.2"
},
"devDependencies": {
"@babel/core": "7.11.6",
"@babel/plugin-proposal-object-rest-spread": "7.11.0",
"@babel/plugin-transform-typescript": "7.11.0",
"@babel/preset-env": "7.11.5",
"@babel/preset-react": "7.10.4",
"@babel/preset-typescript": "7.10.4",
"@babel/core": "7.12.3",
"@babel/plugin-proposal-object-rest-spread": "7.12.1",
"@babel/plugin-transform-typescript": "7.12.1",
"@babel/preset-env": "7.12.1",
"@babel/preset-react": "7.12.1",
"@babel/preset-typescript": "7.12.1",
"@emotion/babel-preset-css-prop": "10.0.27",
"@types/babel__core": "7.1.10",
"@types/cssnano": "4.0.0",
Expand All @@ -94,13 +95,13 @@
"@types/enzyme-adapter-react-16": "1.0.6",
"@types/eslint": "6.8.1",
"@types/eslint-plugin-prettier": "3.1.0",
"@types/jest": "25.2.3",
"@types/jest": "26.0.15",
"@types/jsdom": "16.2.4",
"@types/jsdom-global": "3.0.2",
"@types/parcel-bundler": "1.12.1",
"@types/prettier": "1.19.0",
"@types/rc-slider": "8.6.6",
"@types/react": "16.9.51",
"@types/react": "16.9.53",
"@types/react-dom": "16.9.8",
"@types/react-tabs": "2.3.2",
"@types/react-test-renderer": "16.9.3",
Expand All @@ -111,19 +112,19 @@
"babel-plugin-emotion": "10.0.33",
"babel-plugin-jsx-pragmatic": "1.0.2",
"babel-plugin-transform-inline-environment-variables": "0.4.3",
"electron": "8.5.2",
"electron-builder": "22.8.1",
"electron": "10.1.4",
"electron-builder": "22.9.1",
"enzyme": "3.11.0",
"enzyme-adapter-react-16": "1.15.5",
"eslint": "6.8.0",
"eslint-config-airbnb": "18.2.0",
"eslint-config-prettier": "6.12.0",
"eslint-config-wesbos": "0.0.23",
"eslint-config-prettier": "6.13.0",
"eslint-config-wesbos": "1.0.1",
"eslint-plugin-html": "6.1.0",
"eslint-plugin-import": "2.22.1",
"eslint-plugin-jsx-a11y": "6.3.1",
"eslint-plugin-prettier": "3.1.4",
"eslint-plugin-react": "7.21.3",
"eslint-plugin-react": "7.21.5",
"eslint-plugin-react-hooks": "3.0.0",
"husky": "4.3.0",
"jest": "26.5.3",
Expand All @@ -132,8 +133,8 @@
"parcel-bundler": "1.12.4",
"prettier": "1.19.1",
"react-context-devtool": "2.0.0",
"react-test-renderer": "16.13.1",
"ts-jest": "25.5.1",
"react-test-renderer": "16.14.0",
"ts-jest": "26.4.1",
"tslint": "6.1.3",
"tslint-eslint-rules": "5.4.0",
"typescript": "3.9.7"
Expand Down
17 changes: 2 additions & 15 deletions src/components/Cashier/Cashier.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@ import Modal from "../Modal";
import Deposit from "./Deposit";
import Withdraw from "./Withdraw";
import { Button } from "../Controls";
import { sendMessage } from "../../store/actions";
import { updateStateValue } from "../../store/actions";
import { IState } from "../../store/initialState";
import { IState } from "../../store/types";
import { CashierButton } from "./assets/style";

// This modal opens up when the player clicks the Cashier button and allows the player to
// move funds to and away from the account

Expand All @@ -26,20 +24,8 @@ const Cashier: React.FunctionComponent<IProps> = ({ dispatch, state }) => {
updateStateValue("isCashierOpen", false, dispatch);
};

const sendWithdrawRequest = (): void => {
sendMessage(
{
method: "withdrawRequest"
},
state.userSeat,
state,
dispatch
);
};

const handleCashierButtonClick = () => (): void => {
openCashierModal();
sendWithdrawRequest();
};

return (
Expand All @@ -48,6 +34,7 @@ const Cashier: React.FunctionComponent<IProps> = ({ dispatch, state }) => {
<CashierButton>
<Button
label="Cashier"
disabled={!state.backendStatus}
onClick={handleCashierButtonClick()}
small
testId="cashier-button"
Expand Down
4 changes: 2 additions & 2 deletions src/components/Cashier/Deposit.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useState, useEffect } from "react";
import { css } from "@emotion/core";
import ReactTooltip from "react-tooltip";
import { IState } from "../../store/initialState";
import { IState } from "../../store/types";
import balanceWithDecimals from "../../lib/balanceWithDecimals";
import isValidAddress from "../../lib/isValidAddress";
import { ModalButtonsWrapper } from "../Modal/assets/style";
Expand Down Expand Up @@ -50,7 +50,7 @@ const Deposit: React.FunctionComponent<IProps> = ({
return (
<section>
<Balance data-test="balance-cashier-deposit">
Available CHIPS: {balanceWithDecimals(balance)}
Available: {balanceWithDecimals(balance) + " CHIPS"}
</Balance>
<AddressLabel>Your CHIPS deposit address:</AddressLabel>
<DepositAddressContainer
Expand Down
Loading

0 comments on commit 150a6f3

Please sign in to comment.