Skip to content

Commit 890646c

Browse files
committed
chore: small fixes
1 parent cb3df69 commit 890646c

3 files changed

Lines changed: 15 additions & 10 deletions

File tree

src/components/Library.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ export const Library = ({ library, user }: GameList) => {
2929
{
3030
library.map(({title, art_square, app_name, isInstalled}: Game) =>
3131
<GameCard
32-
key={app_name}
33-
cover={art_square}
34-
title={title}
35-
appName={app_name}
36-
isInstalled={isInstalled}
32+
key={app_name}
33+
cover={art_square}
34+
title={title}
35+
appName={app_name}
36+
isInstalled={isInstalled}
3737
/>
3838
)
3939
}

src/components/UI/GameConfig.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@ export default function GameConfig({ location }: Card) {
1010
const [gameInfo, setGameInfo] = React.useState({} as any);
1111
const [playing, setPlaying] = React.useState(false);
1212
const [installing, setInstalling] = React.useState(false);
13-
const { appName } = location.state;
13+
const { appName } = location.state || {};
1414

1515
React.useEffect(() => {
1616
const updateConfig = async () => {
1717
const newInfo = await getGameInfo(appName);
1818
setGameInfo(newInfo);
1919
};
2020
updateConfig();
21-
}, [appName, installing]);
21+
}, [location, appName]);
2222

2323

24-
if (!location) {
25-
return null;
24+
if (!appName) {
25+
return <div><Link to={"/"}>Back to Library</Link></div>;
2626
}
2727

2828
if (gameInfo) {

src/helper.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ export const legendary = async (args: string): Promise<string> => await ipcRende
55
.then((res: string) => console.log(`${res}`))
66
.catch((err: string) => console.error({err}))
77

8+
export const isLoggedIn = async() => await ipcRenderer.invoke('isLoggedIn')
9+
810
const readFile = async (file: string) => await ipcRenderer.invoke('readFile', file).then((res: string) => res)
911

1012
export interface Game {
@@ -37,8 +39,11 @@ export const getGameInfo = async(appName: string) => {
3739
return library.filter(game => game.app_name === appName)[0]
3840
}
3941

40-
export const createNewWindow = (url: string) => new BrowserWindow().loadURL(url)
42+
export const createNewWindow = (url: string) => new BrowserWindow()
43+
.loadURL(url)
44+
4145
const storeUrl = 'https://www.epicgames.com/store/en-US/product/'
4246
const specialCharactersRegex = /[^((0-9)|(a-z)|(A-Z)|\s)]/g
47+
4348
export const formatStoreUrl = (title: string) =>
4449
`${storeUrl}${title.replaceAll(specialCharactersRegex, '').replaceAll(' ', '-')}`.toLowerCase()

0 commit comments

Comments
 (0)