Skip to content

Commit 76bf042

Browse files
committed
chore: cleanup
1 parent c2a355a commit 76bf042

1 file changed

Lines changed: 5 additions & 13 deletions

File tree

src/components/UI/GamePage.tsx

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,8 @@ export default function GamePage() {
4141
const [progress, setProgress] = useState("0.00");
4242
const [uninstalling, setUninstalling] = useState(false);
4343
const [installPath, setInstallPath] = useState("default");
44-
const [isInstalling, setIsInstalling] = useState(Boolean(
45-
installing.filter((game) => game === appName).length
46-
))
44+
45+
const isInstalling = Boolean(installing.filter((game) => game === appName).length)
4746

4847
const isPlaying = Boolean(playing.filter((game) => game === appName).length);
4948

@@ -59,11 +58,11 @@ export default function GamePage() {
5958
const progressInterval = setInterval(() => {
6059
if (isInstalling) {
6160
ipcRenderer.send("requestGameProgress", appName);
62-
ipcRenderer.on("requestedOutput", (event: any, progress: string) =>
63-
setProgress(progress)
61+
ipcRenderer.on("requestedOutput", (event: any, out: string) =>
62+
setProgress(out)
6463
);
6564
}
66-
}, 2000);
65+
}, 1000);
6766
return () => clearInterval(progressInterval);
6867
}, [isInstalling, appName]);
6968

@@ -235,7 +234,6 @@ export default function GamePage() {
235234
return async () => {
236235
if (isInstalling) {
237236
handleInstalling(appName);
238-
setIsInstalling(false)
239237
return sendKill(appName);
240238
}
241239

@@ -249,9 +247,7 @@ export default function GamePage() {
249247
if (installPath === "default") {
250248
const path = "default";
251249
handleInstalling(appName);
252-
setIsInstalling(true)
253250
await install({ appName, path });
254-
setIsInstalling(false)
255251
return handleInstalling(appName);
256252
}
257253

@@ -265,9 +261,7 @@ export default function GamePage() {
265261
if (filePaths[0]) {
266262
const path = filePaths[0];
267263
handleInstalling(appName);
268-
setIsInstalling(true)
269264
await importGame({ appName, path });
270-
setIsInstalling(false)
271265
return handleInstalling(appName);
272266
}
273267
}
@@ -282,9 +276,7 @@ export default function GamePage() {
282276
if (filePaths[0]) {
283277
const path = filePaths[0];
284278
handleInstalling(appName);
285-
setIsInstalling(true)
286279
await install({ appName, path });
287-
setIsInstalling(false)
288280
handleInstalling(appName);
289281
}
290282
}

0 commit comments

Comments
 (0)