Skip to content

Commit

Permalink
Layout fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mazhutoanton committed Sep 15, 2023
1 parent 4a80f49 commit 57c92c0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
4 changes: 1 addition & 3 deletions packages/sdk/src/GameSdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,6 @@ export class GamesSDK {
modal.close();
this.showLeaderboard({
onPlayAgain: async (close?: () => void) => {
await onStart?.();
close?.();
},
});
Expand Down Expand Up @@ -266,7 +265,7 @@ export class GamesSDK {
address: this.ui.wallet.address,
name: this.ui.gameInfo.name,
};
localStorage.setItem('game-info', JSON.stringify(gameInfo));
localStorage.setItem(`game-info-${this.ui.gameInfo.name}`, JSON.stringify(gameInfo));
}

await onConnect?.(accounts, isNewUser);
Expand Down Expand Up @@ -334,7 +333,6 @@ export class GamesSDK {
if (balance && balance > this.ui.config.sessionPrice) {
const { email } = await this.wallet.getUserInfo();
this.analytics.trackEvent(ANALYTICS_EVENTS.clickPlayAgain, { userEmail: email });
localStorage.setItem('firstTime', 'true');
await this.payForSession();
await onPlayAgain?.(modal.close);
} else {
Expand Down
3 changes: 2 additions & 1 deletion packages/ui/src/widgets/Leaderboard/TopWidget.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import styled from '@emotion/styled';
import { useCallback } from 'react';

import { ModalWrapper, RadialGradientBackGround, Content, Typography, Button, Stack } from '../../components';
import { ModalWrapper, RadialGradientBackGround, Content, Typography, Button } from '../../components';
import { useConfigContext, useGameInfo, useWalletContext } from '../../hooks';
import { RepeatIcon, TwitterIcon } from '../../icons';

Expand Down Expand Up @@ -91,6 +91,7 @@ const PlayAgain = styled(Button)(({ tournament }: { tournament?: boolean }) => (
padding: 0,
background: 'rgba(243, 39, 88, 1)',
...(tournament && {
whiteSpace: 'nowrap',
'@media (max-width: 600px)': {
marginTop: '14px!important',
},
Expand Down
12 changes: 3 additions & 9 deletions packages/ui/src/widgets/Preloader/Preloader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,15 @@ export const Preloader = ({ ready = false, onStartClick, navigateLeaderBoardWidg
const { sdkUrl: cdnUrl } = useConfigContext();
const { address } = useWalletContext();
const lsInfo = useMemo(() => {
const info = localStorage.getItem('game-info');
const info = localStorage.getItem(`game-info-${name}`);
if (info) {
return JSON.parse(info);
}
return;
}, []);
}, [name]);

if (address || (lsInfo && lsInfo.address && lsInfo.name === name)) {
if (localStorage.getItem('firstTime') === 'true') {
debugger;
localStorage.removeItem('firstTime');
} else {
debugger;
navigateLeaderBoardWidget?.();
}
navigateLeaderBoardWidget?.();
}

return (
Expand Down

0 comments on commit 57c92c0

Please sign in to comment.