From 61e95b26347d959e2c413af0ad15347f81b7530a Mon Sep 17 00:00:00 2001 From: megascatterbomb Date: Thu, 21 Mar 2024 15:29:12 +1300 Subject: [PATCH 1/4] "waiting for backend" modal disappears on reconnect --- src/App/App.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/App/App.tsx b/src/App/App.tsx index e9d558c..c586afc 100644 --- a/src/App/App.tsx +++ b/src/App/App.tsx @@ -126,7 +126,7 @@ function App() { try { const configured = await isBackendConfigured(); if (!configured) throw new Error('Backend not configured'); - if (modalContent) closeModal(); + closeModal(); return true; } catch (e) { console.error('Error verifying backend configuration', e); @@ -142,7 +142,7 @@ function App() { do { connected = await isBackendConnected(); if (!connected) { - await new Promise((resolve) => setTimeout(resolve, 5000)); // Wait 5 seconds before retrying + await new Promise((resolve) => setTimeout(resolve, 1000)); // Wait 1 second before retrying } } while (!connected); verifyConfigured(); @@ -162,7 +162,7 @@ function App() { if (useFakedata) return; verificationRoutine(); - const intervalId = setInterval(verificationRoutine, 5000); + const intervalId = setInterval(verificationRoutine, 1000); return () => { clearInterval(intervalId); From cf086a560ec3bf7953b4ba8420183b3b857bfe19 Mon Sep 17 00:00:00 2001 From: megascatterbomb Date: Thu, 21 Mar 2024 16:44:14 +1300 Subject: [PATCH 2/4] lint --- src/App/App.tsx | 1 + src/components/TF2/Player/playerutils.tsx | 24 +++++++++++------------ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/App/App.tsx b/src/App/App.tsx index c586afc..d050568 100644 --- a/src/App/App.tsx +++ b/src/App/App.tsx @@ -93,6 +93,7 @@ function App() { const { isMinimode } = useMinimode(); const [currentPage, setCurrentPage] = React.useState(PAGES.PLAYER_LIST); + // eslint-disable-next-line @typescript-eslint/no-unused-vars const { closeModal, openModal, modalContent } = useModal(); const renderPage = () => { diff --git a/src/components/TF2/Player/playerutils.tsx b/src/components/TF2/Player/playerutils.tsx index 50da4ec..1e116c3 100644 --- a/src/components/TF2/Player/playerutils.tsx +++ b/src/components/TF2/Player/playerutils.tsx @@ -105,8 +105,8 @@ function getCheaterFriendsInLobby( player: PlayerInfo, cheatersInLobby: PlayerInfo[], ): PlayerInfo[] { - return cheatersInLobby.filter( - (c) => player.friends?.some((f) => f.steamID64 === c.steamID64), + return cheatersInLobby.filter((c) => + player.friends?.some((f) => f.steamID64 === c.steamID64), ); } @@ -114,8 +114,8 @@ function hasCheaterFriendsInLobby( player: PlayerInfo, cheatersInLobby: PlayerInfo[], ): boolean { - return cheatersInLobby.some( - (c) => player.friends?.some((f) => f.steamID64 === c.steamID64), + return cheatersInLobby.some((c) => + player.friends?.some((f) => f.steamID64 === c.steamID64), ); } @@ -158,14 +158,14 @@ function buildIconList( player.gameInfo.state === 'Disconnected' ? './kiwi_gray.webp' : player.gameInfo.team === 0 - ? './kiwi_unassigned.webp' - : player.gameInfo.team === 1 - ? './kiwi_spectator.webp' - : player.gameInfo.team === 2 - ? './kiwi_red.webp' - : player.gameInfo.team === 3 - ? './kiwi_blue.webp' - : './kiwi_white.webp'; + ? './kiwi_unassigned.webp' + : player.gameInfo.team === 1 + ? './kiwi_spectator.webp' + : player.gameInfo.team === 2 + ? './kiwi_red.webp' + : player.gameInfo.team === 3 + ? './kiwi_blue.webp' + : './kiwi_white.webp'; return [ hasAlias && ( From c03968c955f52cf9e05c2b14044d9a89c8f0d1e1 Mon Sep 17 00:00:00 2001 From: megascatterbomb Date: Thu, 21 Mar 2024 16:46:21 +1300 Subject: [PATCH 3/4] lint 2 --- src/components/TF2/Player/playerutils.tsx | 24 +++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/components/TF2/Player/playerutils.tsx b/src/components/TF2/Player/playerutils.tsx index 1e116c3..50da4ec 100644 --- a/src/components/TF2/Player/playerutils.tsx +++ b/src/components/TF2/Player/playerutils.tsx @@ -105,8 +105,8 @@ function getCheaterFriendsInLobby( player: PlayerInfo, cheatersInLobby: PlayerInfo[], ): PlayerInfo[] { - return cheatersInLobby.filter((c) => - player.friends?.some((f) => f.steamID64 === c.steamID64), + return cheatersInLobby.filter( + (c) => player.friends?.some((f) => f.steamID64 === c.steamID64), ); } @@ -114,8 +114,8 @@ function hasCheaterFriendsInLobby( player: PlayerInfo, cheatersInLobby: PlayerInfo[], ): boolean { - return cheatersInLobby.some((c) => - player.friends?.some((f) => f.steamID64 === c.steamID64), + return cheatersInLobby.some( + (c) => player.friends?.some((f) => f.steamID64 === c.steamID64), ); } @@ -158,14 +158,14 @@ function buildIconList( player.gameInfo.state === 'Disconnected' ? './kiwi_gray.webp' : player.gameInfo.team === 0 - ? './kiwi_unassigned.webp' - : player.gameInfo.team === 1 - ? './kiwi_spectator.webp' - : player.gameInfo.team === 2 - ? './kiwi_red.webp' - : player.gameInfo.team === 3 - ? './kiwi_blue.webp' - : './kiwi_white.webp'; + ? './kiwi_unassigned.webp' + : player.gameInfo.team === 1 + ? './kiwi_spectator.webp' + : player.gameInfo.team === 2 + ? './kiwi_red.webp' + : player.gameInfo.team === 3 + ? './kiwi_blue.webp' + : './kiwi_white.webp'; return [ hasAlias && ( From b44b7a1839967beb2af8bb774182f8947222f65d Mon Sep 17 00:00:00 2001 From: megascatterbomb Date: Thu, 21 Mar 2024 16:47:29 +1300 Subject: [PATCH 4/4] updated lint scripts to match github actions --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 9cc6de6..537fc8e 100644 --- a/package.json +++ b/package.json @@ -12,8 +12,8 @@ }, "scripts": { "start": "webpack serve", - "lint": "pnpm exec eslint . && pnpm exec prettier -c \"src/**/*\"", - "lint:fix": "pnpm exec eslint --fix . && pnpm exec prettier --write \"src/**/*\"", + "lint": "pnpm exec eslint .", + "lint:fix": "pnpm exec eslint --fix .", "build": "pnpm run lint && tailwind -i ./src/index.css -o ./src/tailwind.css && webpack --mode production", "dev": "concurrently -k \"webpack serve --mode development\" \"tailwindcss -i ./src/index.css -o ./src/tailwind.css --watch\" \"tsc -w\"", "prod": "concurrently -k \"webpack serve --mode production\" \"tailwindcss -i ./src/index.css -o ./src/tailwind.css --watch\" \"tsc -w\""