Skip to content

Commit

Permalink
Upgrade to React 17
Browse files Browse the repository at this point in the history
  • Loading branch information
lindlof committed Dec 6, 2020
1 parent f3f0942 commit b7489aa
Show file tree
Hide file tree
Showing 17 changed files with 15,300 additions and 15,454 deletions.
1 change: 1 addition & 0 deletions web/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ yarn-debug.log*
yarn-error.log*

src/react-app-env.d.ts
.eslintcache
30,535 changes: 15,251 additions & 15,284 deletions web/package-lock.json

Large diffs are not rendered by default.

28 changes: 14 additions & 14 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@material-ui/core": "^4.11.0",
"bip39": "^3.0.2",
"notistack": "^1.0.1",
"react": "^16.14.0",
"react-dom": "^16.14.0",
"react-scripts": "3.4.3",
"@material-ui/core": "^4.11.2",
"bip39": "^3.0.3",
"notistack": "^1.0.2",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-scripts": "4.0.1",
"secretjs": "0.10.3"
},
"scripts": {
Expand All @@ -33,14 +33,14 @@
]
},
"devDependencies": {
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.8",
"@types/jest": "^26.0.15",
"@types/node": "^14.14.0",
"@types/react": "^16.9.53",
"@types/react-dom": "^16.9.8",
"@testing-library/jest-dom": "^5.11.6",
"@testing-library/react": "^11.2.2",
"@testing-library/user-event": "^12.5.0",
"@types/jest": "^26.0.16",
"@types/node": "^14.14.10",
"@types/react": "^17.0.0",
"@types/react-dom": "^17.0.0",
"env-cmd": "^10.1.0",
"prettier": "^2.1.2"
"prettier": "^2.2.1"
}
}
3 changes: 2 additions & 1 deletion web/src/Banner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const useStyles = makeStyles((theme) => ({
},
}));

export default () => {
const Banner = () => {
const classes = useStyles();

return (
Expand All @@ -41,3 +41,4 @@ export default () => {
</div>
);
};
export default Banner;
4 changes: 3 additions & 1 deletion web/src/GamePlaying.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ enum DisplayContent {
Ending,
}

export default (props: Props) => {
const GamePlaying = (props: Props) => {
const classes = useStyles();
const { game, playHandsign, leaveGame, claimInactivity, enqueueSnackbar } = props;
const [pickedRound, setPickedRound] = useState<number>();
Expand Down Expand Up @@ -221,3 +221,5 @@ export default (props: Props) => {
</div>
);
};

export default GamePlaying;
4 changes: 3 additions & 1 deletion web/src/components/GameTicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ interface Props {
setGame: Function;
}

export default (props: React.PropsWithChildren<Props>) => {
const GameTicker = (props: React.PropsWithChildren<Props>) => {
const { children, client, game, setGame } = props;

useEffect(() => {
Expand All @@ -26,3 +26,5 @@ export default (props: React.PropsWithChildren<Props>) => {

return <div>{children}</div>;
};

export default GameTicker;
4 changes: 3 additions & 1 deletion web/src/components/HandsignImg.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ interface Props {
onClick?: Function;
}

export default (props: Props) => {
const HandsignImg = (props: Props) => {
const classes = useStyles();
let handsignImg = classes.handsignImg;
if (props.onClick) {
Expand Down Expand Up @@ -56,3 +56,5 @@ export default (props: Props) => {
</div>
);
};

export default HandsignImg;
4 changes: 3 additions & 1 deletion web/src/components/RoundEnd.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ interface Props {
rounds: Array<Round | undefined>;
}

export default (props: Props) => {
const RoundEnd = (props: Props) => {
const classes = useStyles();
const { round, rounds } = props;
const [currentRound, setCurrentRound] = useState<number>(round);
Expand Down Expand Up @@ -75,3 +75,5 @@ export default (props: Props) => {
</div>
);
};

export default RoundEnd;
4 changes: 3 additions & 1 deletion web/src/components/ScoreStar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ const useStyles = makeStyles((theme) => ({
},
}));

export default (props: Props) => {
const ScoreStar = (props: Props) => {
const classes = useStyles();
const { pos, score, className } = props;
const cls = clsx(className, classes.star);

return <img src={pos < score ? starGold : starBlank} alt={'star blank'} className={cls} />;
};

export default ScoreStar;
3 changes: 0 additions & 3 deletions web/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import * as serviceWorker from './serviceWorker';
import { SnackbarProvider } from 'notistack';

ReactDOM.render(
Expand All @@ -17,5 +16,3 @@ ReactDOM.render(
</React.StrictMode>,
document.getElementById('root'),
);

serviceWorker.unregister();
141 changes: 0 additions & 141 deletions web/src/serviceWorker.js

This file was deleted.

4 changes: 3 additions & 1 deletion web/src/wallet/ClientLoader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ interface Props {
cancel: Function;
}

export default (props: React.PropsWithChildren<Props>) => {
const ClientLoader = (props: React.PropsWithChildren<Props>) => {
const { walletType, config, setClient, cancel } = props;

useEffect(() => {
Expand Down Expand Up @@ -69,3 +69,5 @@ export default (props: React.PropsWithChildren<Props>) => {
</div>
);
};

export default ClientLoader;
4 changes: 3 additions & 1 deletion web/src/wallet/SelectWalletModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ interface Props {
setClient: (client: SecretJS.SigningCosmWasmClient) => void;
}

export default (props: Props) => {
const SelectWalletModal = (props: Props) => {
const classes = useStyles();
const { walletType, setWalletType, client, setClient } = props;

Expand Down Expand Up @@ -76,3 +76,5 @@ export default (props: Props) => {
</div>
);
};

export default SelectWalletModal;
4 changes: 3 additions & 1 deletion web/src/wallet/Wallet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ interface Props {
faucetUrl: string | undefined;
}

export default (props: Props) => {
const Wallet = (props: Props) => {
const classes = useStyles();
const { client, setClient, faucetUrl } = props;
const [walletType, setWalletType] = useLocalStorage<WalletType | undefined>(
Expand Down Expand Up @@ -118,3 +118,5 @@ const getScrtBalance = (account: SecretJS.Account | undefined): number => {
}
return 0;
};

export default Wallet;
4 changes: 3 additions & 1 deletion web/src/wallet/keplrWallet.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as SecretJS from 'secretjs';

export default async (
const keplrWallet = async (
chainId: string,
chainName: string,
suggestChain: boolean,
Expand Down Expand Up @@ -141,3 +141,5 @@ export default async (

setClient(secretJsClient);
};

export default keplrWallet;
4 changes: 3 additions & 1 deletion web/src/wallet/localWallet.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as SecretJS from 'secretjs';
import * as bip39 from 'bip39';

export default async (lcdUrl: string, setClient: Function) => {
const localWallet = async (lcdUrl: string, setClient: Function) => {
let mnemonic = localStorage.getItem('mnemonic');
if (!mnemonic) {
mnemonic = bip39.generateMnemonic();
Expand Down Expand Up @@ -41,3 +41,5 @@ export default async (lcdUrl: string, setClient: Function) => {
);
setClient(secretJsClient);
};

export default localWallet;
3 changes: 2 additions & 1 deletion web/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react"
"jsx": "react",
"noFallthroughCasesInSwitch": true
},
"include": [
"src"
Expand Down

0 comments on commit b7489aa

Please sign in to comment.