fix small stuff

This commit is contained in:
Viktor Rådberg
2023-08-02 16:11:39 +02:00
parent dc8985e88c
commit c43a2dfe98
5 changed files with 652 additions and 588 deletions

View File

@@ -7,10 +7,6 @@
"@emotion/react": "^11.11.1", "@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0", "@emotion/styled": "^11.11.0",
"@mui/material": "^5.13.6", "@mui/material": "^5.13.6",
"@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^13.0.0",
"@testing-library/user-event": "^13.2.1",
"@types/jest": "^27.0.1",
"@types/node": "^16.7.13", "@types/node": "^16.7.13",
"@types/react": "^18.0.0", "@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0", "@types/react-dom": "^18.0.0",
@@ -20,7 +16,6 @@
"react-dom": "^18.2.0", "react-dom": "^18.2.0",
"react-screen-wake-lock": "^3.0.1", "react-screen-wake-lock": "^3.0.1",
"react-scripts": "5.0.1", "react-scripts": "5.0.1",
"react-swipeable": "^7.0.1",
"styled-components": "^6.0.1", "styled-components": "^6.0.1",
"typescript": "^4.4.2", "typescript": "^4.4.2",
"web-vitals": "^2.1.0" "web-vitals": "^2.1.0"

View File

@@ -77,7 +77,19 @@ const App = () => {
setPlayers([...players]); // ensure to trigger a re-render setPlayers([...players]); // ensure to trigger a re-render
}; };
const newGame = () => {
localStorage.removeItem('players');
localStorage.removeItem('initialGameSettings');
window.location.reload();
};
if (players.length > 0 && initialGameSettings) { if (players.length > 0 && initialGameSettings) {
// If the user has a key, we need to restart since key is deprecated
// FIXME: Remove this after a few months
if (players[0].key) {
newGame();
}
return ( return (
<ThemeProvider theme={theme}> <ThemeProvider theme={theme}>
<GlobalStyles /> <GlobalStyles />

View File

@@ -1,5 +1,6 @@
export type Player = { export type Player = {
lifeTotal: number; lifeTotal: number;
key?: number; // Deprecated, use index instead
index: number; index: number;
color: string; color: string;
settings: PlayerSettings; settings: PlayerSettings;

View File

@@ -1,5 +0,0 @@
// jest-dom adds custom jest matchers for asserting on DOM nodes.
// allows you to do things like:
// expect(element).toHaveTextContent(/react/i)
// learn more: https://github.com/testing-library/jest-dom
import '@testing-library/jest-dom';

1217
yarn.lock

File diff suppressed because it is too large Load Diff