Skip to content

Commit

Permalink
Add Refresh button to app (#195)
Browse files Browse the repository at this point in the history
* Add reload function to app

* Changed stats reload button name to refresh
  • Loading branch information
JohannesMerkt authored Mar 17, 2022
1 parent ff279d3 commit 2d1a550
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 36 deletions.
6 changes: 6 additions & 0 deletions packages/app/src/main/gameWatcher/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ export class GameWatcher {
}
});

ipcMain.on("reloadStats", () => {
this.lastGameId = "";
this.isFirstScan = true; // do not notify
this.intervalHandler();
});

// listen to settings changes
this.unsubscriber = this.applicationStore.runtimeStore.subscribe(this.runtimeStoreSubscriber);
}
Expand Down
3 changes: 3 additions & 0 deletions packages/app/src/renderer/windows/main/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ const App = (): JSX.Element => {

const menuItems = (
<>
<WindowTitlebarItem onClick={() => window.electron.ipcRenderer.reloadStats()}>
Refresh
</WindowTitlebarItem>
<WindowTitlebarItem onClick={() => window.electron.ipcRenderer.showWindow("settings")}>
Settings
</WindowTitlebarItem>
Expand Down
3 changes: 3 additions & 0 deletions packages/app/src/renderer/windows/preload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,8 @@ contextBridge.exposeInMainWorld("electron", {
scanForLogFile() {
ipcRenderer.send("scanForLogFile");
},
reloadStats() {
ipcRenderer.send("reloadStats");
},
},
});
1 change: 1 addition & 0 deletions packages/app/src/renderer/windows/preloadDeclaration.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ declare global {
openInBrowser(link: string): void;
locateLogFile(): void;
scanForLogFile(): void;
reloadStats(): void;
};
store: EnhancedStore;
};
Expand Down
37 changes: 1 addition & 36 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3646,15 +3646,6 @@
lodash "^4.17.15"
redent "^3.0.0"

"@testing-library/react@^12.0.0":
version "12.1.4"
resolved "https://registry.yarnpkg.com/@testing-library/react/-/react-12.1.4.tgz#09674b117e550af713db3f4ec4c0942aa8bbf2c0"
integrity sha512-jiPKOm7vyUw311Hn/HlNQ9P8/lHNtArAx0PisXyFixDDvfl8DbD6EUdbshK5eqauvBSvzZd19itqQ9j3nferJA==
dependencies:
"@babel/runtime" "^7.12.5"
"@testing-library/dom" "^8.0.0"
"@types/react-dom" "*"

"@testing-library/react@^12.1.2":
version "12.1.2"
resolved "https://registry.yarnpkg.com/@testing-library/react/-/react-12.1.2.tgz#f1bc9a45943461fa2a598bb4597df1ae044cfc76"
Expand All @@ -3663,7 +3654,7 @@
"@babel/runtime" "^7.12.5"
"@testing-library/dom" "^8.0.0"

"@testing-library/user-event@^13.2.1", "@testing-library/user-event@^13.5.0":
"@testing-library/user-event@^13.5.0":
version "13.5.0"
resolved "https://registry.yarnpkg.com/@testing-library/user-event/-/user-event-13.5.0.tgz#69d77007f1e124d55314a2b73fd204b333b13295"
integrity sha512-5Kwtbo3Y/NowpkbRuSepbyMFkZmHgD+vPzYB/RJ4oxt5Gj/avFFBYjhw27cqSVPVw/3a67NK1PbiIr9k4Gwmdg==
Expand Down Expand Up @@ -3957,11 +3948,6 @@
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.18.5.tgz#0dd636fe7b2c6055cbed0d4ca3b7fb540f130a96"
integrity sha512-LMy+vDDcQR48EZdEx5wRX1q/sEl6NdGuHXPnfeL8ixkwCOSZ2qnIyIZmcCbdX0MeRqHhAcHmX+haCbrS8Run+A==

"@types/node@^16.7.13":
version "16.11.26"
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.11.26.tgz#63d204d136c9916fb4dcd1b50f9740fe86884e47"
integrity sha512-GZ7bu5A6+4DtG7q9GsoHXy3ALcgeIHP4NnL0Vv2wu0uUB/yQex26v0tf6/na1mm0+bS9Uw+0DFex7aaKr2qawQ==

"@types/parse-json@^4.0.0":
version "4.0.0"
resolved "https://registry.yarnpkg.com/@types/parse-json/-/parse-json-4.0.0.tgz#2f8bb441434d163b35fb8ffdccd7138927ffb8c0"
Expand Down Expand Up @@ -3992,13 +3978,6 @@
resolved "https://registry.yarnpkg.com/@types/range-parser/-/range-parser-1.2.4.tgz#cd667bcfdd025213aafb7ca5915a932590acdcdc"
integrity sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==

"@types/react-dom@*":
version "17.0.13"
resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-17.0.13.tgz#a3323b974ee4280070982b3112351bb1952a7809"
integrity sha512-wEP+B8hzvy6ORDv1QBhcQia4j6ea4SFIBttHYpXKPFZRviBvknq0FRh3VrIxeXUmsPkwuXVZrVGG7KUVONmXCQ==
dependencies:
"@types/react" "*"

"@types/react-dom@^17.0.11", "@types/react-dom@^17.0.9":
version "17.0.11"
resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-17.0.11.tgz#e1eadc3c5e86bdb5f7684e00274ae228e7bcc466"
Expand Down Expand Up @@ -4052,15 +4031,6 @@
"@types/scheduler" "*"
csstype "^3.0.2"

"@types/react@^17.0.20":
version "17.0.39"
resolved "https://registry.yarnpkg.com/@types/react/-/react-17.0.39.tgz#d0f4cde092502a6db00a1cded6e6bf2abb7633ce"
integrity sha512-UVavlfAxDd/AgAacMa60Azl7ygyQNRwC/DsHZmKgNvPmRR5p70AJ5Q9EAmL2NWOJmeV+vVUI4IAP7GZrN8h8Ug==
dependencies:
"@types/prop-types" "*"
"@types/scheduler" "*"
csstype "^3.0.2"

"@types/react@^17.0.38":
version "17.0.38"
resolved "https://registry.yarnpkg.com/@types/react/-/react-17.0.38.tgz#f24249fefd89357d5fa71f739a686b8d7c7202bd"
Expand Down Expand Up @@ -14744,11 +14714,6 @@ typescript@^4.3.5:
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.4.4.tgz#2cd01a1a1f160704d3101fd5a58ff0f9fcb8030c"
integrity sha512-DqGhF5IKoBl8WNf8C1gu8q0xZSInh9j1kJJMqT3a94w1JzVaBU4EXOSMrz9yDqMT0xt3selp83fuFMQ0uzv6qA==

typescript@^4.4.2:
version "4.6.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.6.2.tgz#fe12d2727b708f4eef40f51598b3398baa9611d4"
integrity sha512-HM/hFigTBHZhLXshn9sN37H085+hQGeJHJ/X7LpBWLID/fbc2acUMfU+lGD98X81sKP+pFa9f0DZmCwB9GnbAg==

typescript@~4.5.4:
version "4.5.4"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.5.4.tgz#a17d3a0263bf5c8723b9c52f43c5084edf13c2e8"
Expand Down

0 comments on commit 2d1a550

Please sign in to comment.