diff --git a/packages/nextjs/pages/index.tsx b/packages/nextjs/pages/index.tsx
index 359b22b..f678422 100644
--- a/packages/nextjs/pages/index.tsx
+++ b/packages/nextjs/pages/index.tsx
@@ -4,6 +4,7 @@ import type { NextPage } from "next";
import { MetaHeader } from "~~/components/MetaHeader";
import GameCreationForm from "~~/components/dicedemo/GameCreateForm";
import GameJoinForm from "~~/components/dicedemo/GameJoinForm";
+import WelcomeRoll from "~~/components/dicedemo/WelcomeRoll";
const Home: NextPage = () => {
const router = useRouter();
@@ -11,58 +12,62 @@ const Home: NextPage = () => {
const { invite } = router.query;
const [gameState, setGameState] = useState<"createGame" | "joinGame">("joinGame");
const [inviteCode, setInviteCode] = useState("");
+ const [showWelcomeRoll, setShowWelcomRoll] = useState(true);
useEffect(() => {
if (invite) {
setGameState("joinGame");
setInviteCode(invite as string);
+ setShowWelcomRoll(false);
}
}, [invite]);
- const quote =
- "Every key is a boundless whisper from the unknown and each guess a brushstroke on the infinite canvas of possibility, our journey weaves through the lattice of chance and destiny, illuminating paths in the cosmic dance of uncharted realms, where the thrill of discovery echoes in the heartbeats of the bold, crafting a universe with every daring leap into the silence of the never-before-seen.";
+ // const quote = "Every key is a boundless whisper from the unknown and each guess a brushstroke on the infinite canvas of possibility, our journey weaves through the lattice of chance and destiny, illuminating paths in the cosmic dance of uncharted realms, where the thrill of discovery echoes in the heartbeats of the bold, crafting a universe with every daring leap into the silence of the never-before-seen."
return (
<>
-
-
+
+ {/*
-
*/}
+
+
+
+ {showWelcomeRoll &&
}
+
-
-
- {gameState == "createGame" &&
}
- {gameState == "joinGame" &&
}
+
+ {gameState == "createGame" && }
+ {gameState == "joinGame" && }
+
diff --git a/packages/nextjs/tailwind.config.js b/packages/nextjs/tailwind.config.js
index b3a3b61..f0aecae 100644
--- a/packages/nextjs/tailwind.config.js
+++ b/packages/nextjs/tailwind.config.js
@@ -8,17 +8,17 @@ module.exports = {
themes: [
{
scaffoldEth: {
- primary: "#d6fcf8",
+ primary: "#93BBFB",
"primary-content": "#212638",
- secondary: "#dceeee",
+ secondary: "#DAE8FF",
"secondary-content": "#212638",
- accent: "#90fbfb",
+ accent: "#93BBFB",
"accent-content": "#212638",
neutral: "#212638",
"neutral-content": "#ffffff",
"base-100": "#ffffff",
- "base-200": "#f3fafa",
- "base-300": "#dcfefe",
+ "base-200": "#f4f8ff",
+ "base-300": "#DAE8FF",
"base-content": "#212638",
info: "#93BBFB",
success: "#34EEB6",
@@ -45,7 +45,7 @@ module.exports = {
"base-100": "#385183",
"base-200": "#2A3655",
"base-300": "#212638",
- "base-content": "#048e8e",
+ "base-content": "#F9FBFF",
info: "#385183",
success: "#34EEB6",
warning: "#FFCF72",
@@ -90,6 +90,14 @@ module.exports = {
theme: {
// Extend Tailwind classes (e.g. font-bai-jamjuree, animate-grow)
extend: {
+ colors: {
+ new_primary: "#293853",
+ new_secondary: "#3f5174",
+ new_tertiary: "#93bbfb",
+ },
+ backgroundColor: {
+ gradient: "linear-gradient(225deg, #293853 0%, #521f93 100%)",
+ },
fontFamily: {
"bai-jamjuree": ["Bai Jamjuree", "sans-serif"],
},
diff --git a/packages/nextjs/utils/diceDemo/gameUtils.ts b/packages/nextjs/utils/diceDemo/gameUtils.ts
new file mode 100644
index 0000000..7e15d46
--- /dev/null
+++ b/packages/nextjs/utils/diceDemo/gameUtils.ts
@@ -0,0 +1,15 @@
+export const calculateLength = (count: number) => {
+ const maxLength = 150;
+ const calculatedLength = Math.max(maxLength - (count - 1) * 3, 10);
+ return calculatedLength;
+};
+
+export const generateRandomHex = () => {
+ const hexDigits = "0123456789ABCDEF";
+ const randomIndex = Math.floor(Math.random() * hexDigits.length);
+ return hexDigits[randomIndex];
+};
+
+export const compareResult = (rolledResult: string[], pkChars: Record
) => {
+ return rolledResult.every((value, index) => value.toLowerCase() === Object.values(pkChars)[index].toLowerCase());
+};
From eec2a7b46ba241a21bad11c78fe2f55a46f1b486 Mon Sep 17 00:00:00 2001
From: Avelous Ujiri <86206128+Avelous@users.noreply.github.com>
Date: Thu, 18 Apr 2024 13:49:46 +0100
Subject: [PATCH 04/10] Added admin feature to increase and decrease hidden
characters (#38)
* Added admin feature to increase and decrease hidden characters
---
packages/backend/controllers/Admin.ts | 27 +++++++++
packages/backend/models/Game.ts | 2 +-
packages/backend/routes/admin.ts | 3 +-
packages/nextjs/pages/game/[id].tsx | 65 +++++++++++++++++++---
packages/nextjs/server.config.ts | 2 +-
packages/nextjs/utils/diceDemo/apiUtils.ts | 41 ++++++++++++++
6 files changed, 129 insertions(+), 11 deletions(-)
diff --git a/packages/backend/controllers/Admin.ts b/packages/backend/controllers/Admin.ts
index 7516113..221bd27 100644
--- a/packages/backend/controllers/Admin.ts
+++ b/packages/backend/controllers/Admin.ts
@@ -243,3 +243,30 @@ export const kickPlayer = async (req: Request, res: Response) => {
res.status(500).json({ error: (err as Error).message });
}
};
+
+export const varyHiddenPrivatekey = async (req: Request, res: Response) => {
+ try {
+ const { id } = req.params;
+ const { hiddenChars, hiddenPrivateKey, diceCount } = req.body;
+ const game = await Game.findById(id);
+
+ if (!game) {
+ return res.status(404).json({ error: "Game not found." });
+ }
+
+ if (diceCount < 1 || diceCount > 64) {
+ return res.status(400).json({ error: "Invalid dice count." });
+ }
+
+ game.hiddenChars = hiddenChars;
+ game.hiddenPrivateKey = hiddenPrivateKey;
+ game.diceCount = diceCount;
+ const updatedGame = await game.save();
+ const channel = ably.channels.get(`gameUpdate`);
+ channel.publish(`gameUpdate`, updatedGame);
+
+ res.status(200).json(updatedGame);
+ } catch (err) {
+ res.status(500).json({ error: (err as Error).message });
+ }
+};
diff --git a/packages/backend/models/Game.ts b/packages/backend/models/Game.ts
index c012dd0..7d47211 100644
--- a/packages/backend/models/Game.ts
+++ b/packages/backend/models/Game.ts
@@ -32,7 +32,7 @@ const gameSchema = new mongoose.Schema(
},
hiddenPrivateKey: {
type: String,
- required: false,
+ required: true,
},
hiddenChars: {
type: Object,
diff --git a/packages/backend/routes/admin.ts b/packages/backend/routes/admin.ts
index bb0279d..1a23a17 100644
--- a/packages/backend/routes/admin.ts
+++ b/packages/backend/routes/admin.ts
@@ -1,5 +1,5 @@
import express from "express";
-import { createGame, changeGameMode, pauseGame, resumeGame, kickPlayer, restartWithNewPk } from "../controllers/Admin";
+import { createGame, changeGameMode, pauseGame, resumeGame, kickPlayer, restartWithNewPk, varyHiddenPrivatekey } from "../controllers/Admin";
import { verifyToken } from "../middleware/auth";
const router = express.Router();
@@ -10,5 +10,6 @@ router.patch("/pause/:id", verifyToken, pauseGame);
router.patch("/resume/:id", verifyToken, resumeGame);
router.patch("/kickplayer/:id", verifyToken, kickPlayer);
router.patch("/restartwithnewpk/:id", verifyToken, restartWithNewPk);
+router.patch("/varyhiddenprivatekey/:id", verifyToken, varyHiddenPrivatekey);
export default router;
diff --git a/packages/nextjs/pages/game/[id].tsx b/packages/nextjs/pages/game/[id].tsx
index 998cc07..813dcd2 100644
--- a/packages/nextjs/pages/game/[id].tsx
+++ b/packages/nextjs/pages/game/[id].tsx
@@ -5,7 +5,12 @@ import Ably from "ably";
import QRCode from "qrcode.react";
import CopyToClipboard from "react-copy-to-clipboard";
import { useAccount, useBalance } from "wagmi";
-import { CheckCircleIcon, DocumentDuplicateIcon } from "@heroicons/react/24/outline";
+import {
+ CheckCircleIcon,
+ ChevronDoubleDownIcon,
+ ChevronDoubleUpIcon,
+ DocumentDuplicateIcon,
+} from "@heroicons/react/24/outline";
import HostAnnouncement from "~~/components/dicedemo/HostAnnouncement";
import PlayerAnnouncement from "~~/components/dicedemo/PlayerAnnoucement";
import RestartWithNewPk from "~~/components/dicedemo/RestartWithNewPk";
@@ -14,7 +19,7 @@ import { Price } from "~~/components/scaffold-eth/Price";
import useGameData from "~~/hooks/useGameData";
import useSweepWallet from "~~/hooks/useSweepWallet";
import { Game } from "~~/types/game/game";
-import { kickPlayer, pauseResumeGame, toggleMode } from "~~/utils/diceDemo/apiUtils";
+import { kickPlayer, pauseResumeGame, toggleMode, varyHiddenPrivatekey } from "~~/utils/diceDemo/apiUtils";
import { calculateLength, compareResult, generateRandomHex } from "~~/utils/diceDemo/gameUtils";
function GamePage() {
@@ -357,9 +362,31 @@ function GamePage() {
PRIVATE KEY
-
- {Object.values(game?.hiddenPrivateKey)}
-
+
+
+ {Object.values(game?.hiddenPrivateKey)}
+
+
+
+
+
+
)}
@@ -387,9 +414,31 @@ function GamePage() {
PRIVATE KEY
-
- {Object.values(game?.hiddenPrivateKey)}
-
+
+
+ {Object.values(game?.hiddenPrivateKey)}
+
+
+
+
+
+
)}
diff --git a/packages/nextjs/server.config.ts b/packages/nextjs/server.config.ts
index 9121921..1ff75de 100644
--- a/packages/nextjs/server.config.ts
+++ b/packages/nextjs/server.config.ts
@@ -1,5 +1,5 @@
const serverConfig = {
- isLocal: false,
+ isLocal: true,
localUrl: "http://localhost:6001",
liveUrl: "https://rich-ruby-cygnet-tie.cyclic.app/",
};
diff --git a/packages/nextjs/utils/diceDemo/apiUtils.ts b/packages/nextjs/utils/diceDemo/apiUtils.ts
index 1cd33e6..9fffe0a 100644
--- a/packages/nextjs/utils/diceDemo/apiUtils.ts
+++ b/packages/nextjs/utils/diceDemo/apiUtils.ts
@@ -59,8 +59,49 @@ export const kickPlayer = async (game: Game, token: string, playerAddress: strin
});
const responseData = await response.json();
+ notification.success("Kicked " + playerAddress);
if (responseData.error) {
notification.error(responseData.error);
return;
}
};
+
+export const varyHiddenPrivatekey = async (game: Game, token: string, vary: "increase" | "decrease") => {
+ let hiddenPrivateKey = game?.hiddenPrivateKey;
+ const hiddenChars = game?.hiddenChars;
+ const privateKey = game?.privateKey;
+ let diceCount = game?.diceCount;
+
+ const hiddCharsCopy = { ...hiddenChars };
+
+ if (vary === "increase") {
+ hiddenPrivateKey = "*".repeat(diceCount + 1) + privateKey.slice(diceCount + 1);
+ hiddCharsCopy[diceCount] = privateKey[diceCount];
+ diceCount++;
+ } else {
+ hiddenPrivateKey = "*".repeat(diceCount - 1) + privateKey.slice(diceCount - 1);
+ delete hiddCharsCopy[diceCount - 1];
+ diceCount--;
+ }
+
+ if (diceCount < 1 || diceCount > 64) {
+ notification.error("Invalid dice count.");
+ return;
+ }
+
+ try {
+ await fetch(`${serverUrl}/admin/varyhiddenprivatekey/${game?._id}`, {
+ method: "PATCH",
+ headers: {
+ Authorization: `Bearer ${token}`,
+ "Content-Type": "application/json",
+ },
+ body: JSON.stringify({ hiddenChars: hiddCharsCopy, hiddenPrivateKey: hiddenPrivateKey, diceCount: diceCount }),
+ });
+
+ notification.success("Updated hidden characters");
+ } catch (error) {
+ notification.error((error as Error).message);
+ return;
+ }
+};
From 61b7c769696db5af60092472b698fe2c361b180c Mon Sep 17 00:00:00 2001
From: Avelous Ujiri <86206128+Avelous@users.noreply.github.com>
Date: Thu, 18 Apr 2024 19:16:02 +0100
Subject: [PATCH 05/10] set server to live (#40)
---
packages/nextjs/server.config.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/packages/nextjs/server.config.ts b/packages/nextjs/server.config.ts
index 1ff75de..9121921 100644
--- a/packages/nextjs/server.config.ts
+++ b/packages/nextjs/server.config.ts
@@ -1,5 +1,5 @@
const serverConfig = {
- isLocal: true,
+ isLocal: false,
localUrl: "http://localhost:6001",
liveUrl: "https://rich-ruby-cygnet-tie.cyclic.app/",
};
From 80311fd6d7f562c6d0fc14827a6495b5e32ead0f Mon Sep 17 00:00:00 2001
From: Avelous Ujiri <86206128+Avelous@users.noreply.github.com>
Date: Mon, 3 Jun 2024 18:34:34 +0100
Subject: [PATCH 06/10] Changed backend to heroku's deployment (#42)
* vercel backend config
* vercel backend config
* vercel backend config
* vercel backend config
* vercel backend config
* vercel backend config
* backend with heroku
---
packages/backend/index.ts | 12 +---
packages/backend/package.json | 4 --
packages/backend/vercel.json | 16 ++++-
packages/nextjs/server.config.ts | 2 +-
yarn.lock | 108 +++----------------------------
5 files changed, 24 insertions(+), 118 deletions(-)
diff --git a/packages/backend/index.ts b/packages/backend/index.ts
index 6fe5fa3..03fa96c 100644
--- a/packages/backend/index.ts
+++ b/packages/backend/index.ts
@@ -1,10 +1,7 @@
import express, { Request, Response, NextFunction } from "express";
-import bodyParser from "body-parser";
import mongoose from "mongoose";
import cors from "cors";
import * as dotenv from "dotenv";
-import helmet from "helmet";
-import morgan from "morgan";
import adminRoutes from "./routes/admin";
import playerRoutes from "./routes/player";
import gameRoutes from "./routes/game";
@@ -27,14 +24,7 @@ dotenv.config({ path: envPath });
export const app = express();
app.use(express.json());
-app.use(helmet());
-app.use(helmet.crossOriginResourcePolicy({ policy: "cross-origin" }));
-app.use(morgan("common"));
-app.use(bodyParser.json({ limit: "30mb" }));
-app.use(bodyParser.urlencoded({ limit: "30mb", extended: true }));
-app.use(
- cors(),
-);
+app.use(cors());
/**Ably Setup */
diff --git a/packages/backend/package.json b/packages/backend/package.json
index d18d256..2b95d15 100644
--- a/packages/backend/package.json
+++ b/packages/backend/package.json
@@ -8,15 +8,12 @@
"dependencies": {
"ably": "^1.2.45",
"bcrypt": "^5.1.0",
- "body-parser": "^1.20.1",
"cors": "^2.8.5",
"dotenv": "^16.0.3",
"express": "^4.18.2",
"gridfs-stream": "^1.1.1",
- "helmet": "^6.0.0",
"jsonwebtoken": "^8.5.1",
"mongoose": "^7.6.0",
- "morgan": "^1.10.0",
"ts-node": "^10.9.1"
},
"devDependencies": {
@@ -24,7 +21,6 @@
"@types/cors": "^2.8.14",
"@types/express": "^4.17.18",
"@types/jsonwebtoken": "^9.0.3",
- "@types/morgan": "^1.9.6",
"@types/node": "^20.4.2",
"types": "^0.1.1",
"typescript": "^5.1.6"
diff --git a/packages/backend/vercel.json b/packages/backend/vercel.json
index 5e02a5b..9693673 100644
--- a/packages/backend/vercel.json
+++ b/packages/backend/vercel.json
@@ -1,6 +1,16 @@
{
"version": 2,
- "name": "dice-demonstration-backend",
- "builds": [{ "src": "index.ts", "use": "@vercel/node" }],
- "routes": [{ "src": "/(.*)", "dest": "/index.ts" }]
+ "name": "dice-demo-backend",
+ "builds": [
+ {
+ "src": "index.ts",
+ "use": "@vercel/node"
+ }
+ ],
+ "routes": [
+ {
+ "src": "/(.*)",
+ "dest": "/index.ts"
+ }
+ ]
}
diff --git a/packages/nextjs/server.config.ts b/packages/nextjs/server.config.ts
index 9121921..6e49dce 100644
--- a/packages/nextjs/server.config.ts
+++ b/packages/nextjs/server.config.ts
@@ -1,7 +1,7 @@
const serverConfig = {
isLocal: false,
localUrl: "http://localhost:6001",
- liveUrl: "https://rich-ruby-cygnet-tie.cyclic.app/",
+ liveUrl: "https://dicedemo-db57fbe0aac5.herokuapp.com",
};
export default serverConfig;
diff --git a/yarn.lock b/yarn.lock
index 5802446..9daecce 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1839,19 +1839,15 @@ __metadata:
"@types/cors": ^2.8.14
"@types/express": ^4.17.18
"@types/jsonwebtoken": ^9.0.3
- "@types/morgan": ^1.9.6
"@types/node": ^20.4.2
ably: ^1.2.45
bcrypt: ^5.1.0
- body-parser: ^1.20.1
cors: ^2.8.5
dotenv: ^16.0.3
express: ^4.18.2
gridfs-stream: ^1.1.1
- helmet: ^6.0.0
jsonwebtoken: ^8.5.1
mongoose: ^7.6.0
- morgan: ^1.10.0
ts-node: ^10.9.1
types: ^0.1.1
typescript: ^5.1.6
@@ -2670,15 +2666,6 @@ __metadata:
languageName: node
linkType: hard
-"@types/morgan@npm:^1.9.6":
- version: 1.9.6
- resolution: "@types/morgan@npm:1.9.6"
- dependencies:
- "@types/node": "*"
- checksum: 6525248325a74342f929c958be69c0840c8f3a288e003a8904319cae92e531f17a8aa2700701e66775adcca7f9506dd630fec2f95dc04a3e73add04fde42aab8
- languageName: node
- linkType: hard
-
"@types/ms@npm:*":
version: 0.7.31
resolution: "@types/ms@npm:0.7.31"
@@ -4765,15 +4752,6 @@ __metadata:
languageName: node
linkType: hard
-"basic-auth@npm:~2.0.1":
- version: 2.0.1
- resolution: "basic-auth@npm:2.0.1"
- dependencies:
- safe-buffer: 5.1.2
- checksum: 3419b805d5dfc518f3a05dcf42aa53aa9ce820e50b6df5097f9e186322e1bc733c36722b624802cd37e791035aa73b828ed814d8362333d42d7f5cd04d7a5e48
- languageName: node
- linkType: hard
-
"bcrypt-pbkdf@npm:^1.0.0, bcrypt-pbkdf@npm:^1.0.2":
version: 1.0.2
resolution: "bcrypt-pbkdf@npm:1.0.2"
@@ -4939,26 +4917,6 @@ __metadata:
languageName: node
linkType: hard
-"body-parser@npm:^1.20.1":
- version: 1.20.2
- resolution: "body-parser@npm:1.20.2"
- dependencies:
- bytes: 3.1.2
- content-type: ~1.0.5
- debug: 2.6.9
- depd: 2.0.0
- destroy: 1.2.0
- http-errors: 2.0.0
- iconv-lite: 0.4.24
- on-finished: 2.4.1
- qs: 6.11.0
- raw-body: 2.5.2
- type-is: ~1.6.18
- unpipe: 1.0.0
- checksum: 14d37ec638ab5c93f6099ecaed7f28f890d222c650c69306872e00b9efa081ff6c596cd9afb9930656aae4d6c4e1c17537bea12bb73c87a217cb3cfea8896737
- languageName: node
- linkType: hard
-
"bops@npm:^1.0.1":
version: 1.0.1
resolution: "bops@npm:1.0.1"
@@ -5750,7 +5708,7 @@ __metadata:
languageName: node
linkType: hard
-"content-type@npm:~1.0.4, content-type@npm:~1.0.5":
+"content-type@npm:~1.0.4":
version: 1.0.5
resolution: "content-type@npm:1.0.5"
checksum: 566271e0a251642254cde0f845f9dd4f9856e52d988f4eb0d0dcffbb7a1f8ec98de7a5215fc628f3bce30fe2fb6fd2bc064b562d721658c59b544e2d34ea2766
@@ -6165,7 +6123,7 @@ __metadata:
languageName: node
linkType: hard
-"depd@npm:2.0.0, depd@npm:~2.0.0":
+"depd@npm:2.0.0":
version: 2.0.0
resolution: "depd@npm:2.0.0"
checksum: abbe19c768c97ee2eed6282d8ce3031126662252c58d711f646921c9623f9052e3e1906443066beec1095832f534e57c523b7333f8e7e0d93051ab6baef5ab3a
@@ -8843,13 +8801,6 @@ __metadata:
languageName: node
linkType: hard
-"helmet@npm:^6.0.0":
- version: 6.2.0
- resolution: "helmet@npm:6.2.0"
- checksum: cf01e024244205bd10d70fd2f3874244b72ba37a10a4604e4383bbd63fe1438ee24bae7672c4ee5c5e16e6cd88ac58003274034fab0ba199761471555a322b37
- languageName: node
- linkType: hard
-
"hey-listen@npm:^1.0.8":
version: 1.0.8
resolution: "hey-listen@npm:1.0.8"
@@ -10771,19 +10722,6 @@ __metadata:
languageName: node
linkType: hard
-"morgan@npm:^1.10.0":
- version: 1.10.0
- resolution: "morgan@npm:1.10.0"
- dependencies:
- basic-auth: ~2.0.1
- debug: 2.6.9
- depd: ~2.0.0
- on-finished: ~2.3.0
- on-headers: ~1.0.2
- checksum: fb41e226ab5a1abf7e8909e486b387076534716d60207e361acfb5df78b84d703a7b7ea58f3046a9fd0b83d3c94bfabde32323341a1f1b26ce50680abd2ea5dd
- languageName: node
- linkType: hard
-
"motion@npm:10.16.2":
version: 10.16.2
resolution: "motion@npm:10.16.2"
@@ -11376,22 +11314,6 @@ __metadata:
languageName: node
linkType: hard
-"on-finished@npm:~2.3.0":
- version: 2.3.0
- resolution: "on-finished@npm:2.3.0"
- dependencies:
- ee-first: 1.1.1
- checksum: 1db595bd963b0124d6fa261d18320422407b8f01dc65863840f3ddaaf7bcad5b28ff6847286703ca53f4ec19595bd67a2f1253db79fc4094911ec6aa8df1671b
- languageName: node
- linkType: hard
-
-"on-headers@npm:~1.0.2":
- version: 1.0.2
- resolution: "on-headers@npm:1.0.2"
- checksum: 2bf13467215d1e540a62a75021e8b318a6cfc5d4fc53af8e8f84ad98dbcea02d506c6d24180cd62e1d769c44721ba542f3154effc1f7579a8288c9f7873ed8e5
- languageName: node
- linkType: hard
-
"once@npm:1.x, once@npm:^1.3.0, once@npm:^1.3.1, once@npm:^1.4.0":
version: 1.4.0
resolution: "once@npm:1.4.0"
@@ -12288,18 +12210,6 @@ __metadata:
languageName: node
linkType: hard
-"raw-body@npm:2.5.2":
- version: 2.5.2
- resolution: "raw-body@npm:2.5.2"
- dependencies:
- bytes: 3.1.2
- http-errors: 2.0.0
- iconv-lite: 0.4.24
- unpipe: 1.0.0
- checksum: ba1583c8d8a48e8fbb7a873fdbb2df66ea4ff83775421bfe21ee120140949ab048200668c47d9ae3880012f6e217052690628cf679ddfbd82c9fc9358d574676
- languageName: node
- linkType: hard
-
"react-copy-to-clipboard@npm:^5.1.0":
version: 5.1.0
resolution: "react-copy-to-clipboard@npm:5.1.0"
@@ -12949,13 +12859,6 @@ __metadata:
languageName: node
linkType: hard
-"safe-buffer@npm:5.1.2, safe-buffer@npm:~5.1.0, safe-buffer@npm:~5.1.1":
- version: 5.1.2
- resolution: "safe-buffer@npm:5.1.2"
- checksum: f2f1f7943ca44a594893a852894055cf619c1fbcb611237fc39e461ae751187e7baf4dc391a72125e0ac4fb2d8c5c0b3c71529622e6a58f46b960211e704903c
- languageName: node
- linkType: hard
-
"safe-buffer@npm:5.2.1, safe-buffer@npm:^5.0.1, safe-buffer@npm:^5.1.0, safe-buffer@npm:^5.1.1, safe-buffer@npm:^5.1.2, safe-buffer@npm:^5.2.0, safe-buffer@npm:~5.2.0":
version: 5.2.1
resolution: "safe-buffer@npm:5.2.1"
@@ -12963,6 +12866,13 @@ __metadata:
languageName: node
linkType: hard
+"safe-buffer@npm:~5.1.0, safe-buffer@npm:~5.1.1":
+ version: 5.1.2
+ resolution: "safe-buffer@npm:5.1.2"
+ checksum: f2f1f7943ca44a594893a852894055cf619c1fbcb611237fc39e461ae751187e7baf4dc391a72125e0ac4fb2d8c5c0b3c71529622e6a58f46b960211e704903c
+ languageName: node
+ linkType: hard
+
"safe-json-utils@npm:^1.1.1":
version: 1.1.1
resolution: "safe-json-utils@npm:1.1.1"
From 57e01cee439cd91cee8f071045536169217244ac Mon Sep 17 00:00:00 2001
From: Avelous Ujiri <86206128+Avelous@users.noreply.github.com>
Date: Sun, 9 Jun 2024 21:40:13 +0100
Subject: [PATCH 07/10] backend deployed to fly.io (#44)
* deployed backend to fly.io
---
packages/nextjs/server.config.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/packages/nextjs/server.config.ts b/packages/nextjs/server.config.ts
index 6e49dce..de04575 100644
--- a/packages/nextjs/server.config.ts
+++ b/packages/nextjs/server.config.ts
@@ -1,7 +1,7 @@
const serverConfig = {
isLocal: false,
localUrl: "http://localhost:6001",
- liveUrl: "https://dicedemo-db57fbe0aac5.herokuapp.com",
+ liveUrl: "https://dicedemo-backend.fly.dev",
};
export default serverConfig;
From 4551ff970f32548627283972578bfe2bcd4166f1 Mon Sep 17 00:00:00 2001
From: Avelous Ujiri <86206128+Avelous@users.noreply.github.com>
Date: Wed, 24 Jul 2024 15:19:31 +0100
Subject: [PATCH 08/10] removed welcome roll condition (#46)
---
packages/nextjs/components/dicedemo/GameJoinForm.tsx | 4 ++--
packages/nextjs/pages/index.tsx | 4 +---
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/packages/nextjs/components/dicedemo/GameJoinForm.tsx b/packages/nextjs/components/dicedemo/GameJoinForm.tsx
index ac5d2b9..c2265f0 100644
--- a/packages/nextjs/components/dicedemo/GameJoinForm.tsx
+++ b/packages/nextjs/components/dicedemo/GameJoinForm.tsx
@@ -73,7 +73,7 @@ const GameJoinForm = ({
// };
useEffect(() => {
- if (invite) {
+ if (invite && playerAddress) {
handleJoinGame(invite as string);
}
if (Object.keys(router.query).length > 0) {
@@ -83,7 +83,7 @@ const GameJoinForm = ({
});
}
// eslint-disable-next-line react-hooks/exhaustive-deps
- }, [invite]);
+ }, [invite, playerAddress]);
return (
diff --git a/packages/nextjs/pages/index.tsx b/packages/nextjs/pages/index.tsx
index f678422..55ccad4 100644
--- a/packages/nextjs/pages/index.tsx
+++ b/packages/nextjs/pages/index.tsx
@@ -12,13 +12,11 @@ const Home: NextPage = () => {
const { invite } = router.query;
const [gameState, setGameState] = useState<"createGame" | "joinGame">("joinGame");
const [inviteCode, setInviteCode] = useState("");
- const [showWelcomeRoll, setShowWelcomRoll] = useState(true);
useEffect(() => {
if (invite) {
setGameState("joinGame");
setInviteCode(invite as string);
- setShowWelcomRoll(false);
}
}, [invite]);
@@ -36,7 +34,7 @@ const Home: NextPage = () => {
- {showWelcomeRoll &&
}
+
- setGameState("joinGame")}>
From 7dfbe254ec89fab0d0b33ab570e287db0aa3cb68 Mon Sep 17 00:00:00 2001
From: Avelous Ujiri <86206128+Avelous@users.noreply.github.com>
Date: Wed, 24 Jul 2024 16:06:20 +0100
Subject: [PATCH 09/10] Welcome roll new Ui background (#48)
* removed welcome roll condition
* welcome roll ui background
---
packages/nextjs/components/dicedemo/WelcomeRoll.tsx | 8 ++++----
packages/nextjs/pages/index.tsx | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/packages/nextjs/components/dicedemo/WelcomeRoll.tsx b/packages/nextjs/components/dicedemo/WelcomeRoll.tsx
index 770f76a..a321ea7 100644
--- a/packages/nextjs/components/dicedemo/WelcomeRoll.tsx
+++ b/packages/nextjs/components/dicedemo/WelcomeRoll.tsx
@@ -75,7 +75,7 @@ const WelcomeRoll = () => {
}, [rolledResult]);
return (
-
+
) : (
@@ -118,8 +118,8 @@ const WelcomeRoll = () => {
className="scale-150"
src={`/rolls-jpg/${rolls[index]}.jpg`}
alt="rolled"
- width={400}
- height={400}
+ width={350}
+ height={350}
/>
diff --git a/packages/nextjs/pages/index.tsx b/packages/nextjs/pages/index.tsx
index 55ccad4..d2c5fa3 100644
--- a/packages/nextjs/pages/index.tsx
+++ b/packages/nextjs/pages/index.tsx
@@ -33,7 +33,7 @@ const Home: NextPage = () => {
*/}
-
+
From c64acce3b39beb77a7699c45a6c016d2c52c679e Mon Sep 17 00:00:00 2001
From: Avelous Ujiri <86206128+Avelous@users.noreply.github.com>
Date: Wed, 24 Jul 2024 17:05:40 +0100
Subject: [PATCH 10/10] ui updates (#50)
* removed welcome roll condition
* welcome roll ui background
* ui update
---
packages/nextjs/pages/_app.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/packages/nextjs/pages/_app.tsx b/packages/nextjs/pages/_app.tsx
index 0b22f76..e7f9d3b 100644
--- a/packages/nextjs/pages/_app.tsx
+++ b/packages/nextjs/pages/_app.tsx
@@ -42,7 +42,7 @@ const ScaffoldEthApp = ({ Component, pageProps }: AppProps) => {
>
-
+