Skip to content

Commit

Permalink
Merge branch 'release/0.6.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
mazhutoanton committed Sep 25, 2023
2 parents d8ea0b9 + b258e00 commit 3d2c28f
Show file tree
Hide file tree
Showing 118 changed files with 1,070 additions and 21 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

-

### v0.6.6

- Added current score to leaderboard

### v0.6.5

- Fix some layout issues
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "0.6.5"
"version": "0.6.6"
}
18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/eslint-config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cere/eslint-config-games-sdk",
"version": "0.6.5",
"version": "0.6.6",
"main": "index.js",
"private": true,
"dependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cere/games-sdk",
"version": "0.6.5",
"version": "0.6.6",
"description": "Cere Games SDK to integrate games with CERE infrastructure",
"sideEffects": false,
"main": "dist/bundle.umd.js",
Expand All @@ -26,7 +26,7 @@
},
"dependencies": {
"@cere/embed-wallet": "0.12.0",
"@cere/games-sdk-ui": "0.6.5",
"@cere/games-sdk-ui": "0.6.6",
"react-gtm-module": "^2.0.11"
},
"devDependencies": {
Expand Down
12 changes: 11 additions & 1 deletion packages/sdk/src/GameSdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ type ShowLeaderboardOptions = {
onBeforeLoad?: () => AsyncResult;
withTopWidget?: boolean;
onShowSignUp?: () => void;
currentScore?: number;
} & ConnectWalletOptions;

type ShowPreloaderOptions = {
Expand Down Expand Up @@ -330,7 +331,14 @@ export class GamesSDK {
};
}

showLeaderboard({ onPlayAgain, onBeforeLoad, withTopWidget, onComplete, onConnect }: ShowLeaderboardOptions = {}) {
showLeaderboard({
onPlayAgain,
onBeforeLoad,
withTopWidget,
onComplete,
onConnect,
currentScore,
}: ShowLeaderboardOptions = {}) {
const { open, ...modal } = UI.createFullscreenModal(
async () => {
const leaderboard = document.createElement('cere-leaderboard');
Expand Down Expand Up @@ -369,6 +377,7 @@ export class GamesSDK {
modal.close();
},
serviceUrl: GAME_SERVICE_URL[this.env],
currentScore: currentScore,
});

return leaderboard;
Expand Down Expand Up @@ -435,6 +444,7 @@ export class GamesSDK {
this.showLeaderboard({
onConnect: save,
onComplete: resolve,
currentScore: score,
}),
);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cere/games-sdk-ui",
"version": "0.6.5",
"version": "0.6.6",
"description": "Cere Games SDK UI Elements",
"sideEffects": false,
"main": "dist/bundle.umd.js",
Expand Down
11 changes: 10 additions & 1 deletion packages/ui/src/widgets/Leaderboard/Leaderboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export type LeaderboardProps = Pick<TableProps, 'data'> & {
serviceUrl: string;
withTopWidget?: boolean;
onShowSignUp?: () => void;
currentScore?: number;
};

const LeaderboardTitle = styled(Typography)({
Expand Down Expand Up @@ -85,7 +86,14 @@ const Alerts = styled.div({
gridRowGap: '5px',
});

export const Leaderboard = ({ data, activeTournament, onPlayAgain, onTweet, withTopWidget }: LeaderboardProps) => {
export const Leaderboard = ({
data,
activeTournament,
onPlayAgain,
onTweet,
withTopWidget,
currentScore,
}: LeaderboardProps) => {
const { sessionPrice, sdkUrl: cdnUrl } = useConfigContext();
const { address, balance = 0 } = useWalletContext();
const playerData = useMemo(() => data.find((row) => row.address === address), [data, address]);
Expand Down Expand Up @@ -123,6 +131,7 @@ Be top-3 player and share a prize"
onTweet={onTweet}
disabled={balance < sessionPrice}
score={playerData?.score}
currentScore={currentScore}
rank={playerData?.rank}
/>
)}
Expand Down
7 changes: 7 additions & 0 deletions packages/ui/src/widgets/Leaderboard/TopWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ type TopWidgetProps = {
onTweet?: (score: number) => Promise<{ tweetBody: string }>;
score?: number;
rank?: number;
currentScore?: number;
};

const WidgetWrapper = styled(ModalWrapper)(({ tournament }: { tournament?: boolean }) => ({
Expand Down Expand Up @@ -207,6 +208,7 @@ export const TopWidget = ({
onTweet,
score,
rank,
currentScore,
}: TopWidgetProps): JSX.Element => {
const { sdkUrl: cdnUrl, gamePortalUrl } = useConfigContext();
const { address, isReady } = useWalletContext();
Expand Down Expand Up @@ -246,6 +248,11 @@ export const TopWidget = ({
<img src={`${cdnUrl}/assets/third-place-reward.svg`} alt="Third place reward" />
</RewardColumn>
</RewardsRow>
{!address && currentScore && (
<Typography align="center">
Your score <Rank>{currentScore}</Rank>
</Typography>
)}
{address && (
<Typography align="center">
Your rank <Rank>{rank}</Rank>
Expand Down
4 changes: 2 additions & 2 deletions playground/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "@cere-games-sdk/playground",
"version": "0.6.5",
"version": "0.6.6",
"private": true,
"scripts": {
"start": "craco start"
},
"dependencies": {
"@cere/games-sdk": "0.6.5",
"@cere/games-sdk": "0.6.6",
"@emotion/react": "^11.10.5",
"@emotion/styled": "^11.10.5",
"@mui/lab": "^5.0.0-alpha.119",
Expand Down
1 change: 1 addition & 0 deletions playground/src/Playground.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export const Playground = () => {

const modal = sdk.showLeaderboard({
onPlayAgain: () => modal.close(),
currentScore: 25,
});
}, [sdk]);

Expand Down
2 changes: 1 addition & 1 deletion tests/wdio/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cere-games-sdk/wdio",
"version": "0.6.5",
"version": "0.6.6",
"private": true,
"scripts": {
"start": "wdio run ./wdio.conf.ts",
Expand Down
Binary file added web/examples/candy-jam/branding/invisible.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web/examples/candy-jam/branding/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web/examples/candy-jam/branding/splash1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions web/examples/candy-jam/game.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 3d2c28f

Please sign in to comment.