From 9f1bb42c5fd9d8d1d96c011765dff94823ea3fa6 Mon Sep 17 00:00:00 2001 From: Anton Mushnin Date: Tue, 2 Apr 2024 10:35:48 +0300 Subject: [PATCH 1/7] notifications util --- web/src/utils/notifications.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 web/src/utils/notifications.ts diff --git a/web/src/utils/notifications.ts b/web/src/utils/notifications.ts new file mode 100644 index 00000000..2440a5e6 --- /dev/null +++ b/web/src/utils/notifications.ts @@ -0,0 +1,16 @@ +export function showNotification(title: string, body: string) { + if (!("Notification" in window)) { + console.log("This browser does not support system notifications"); + return; + } + + if (Notification.permission === "granted") { + new Notification(title, { body }); + } else if (Notification.permission !== "denied") { + Notification.requestPermission().then((permission) => { + if (permission === "granted") { + new Notification(title, { body }); + } + }); + } +} From 83653b10b38218cd088ece5c34cfd0e3a1590eb1 Mon Sep 17 00:00:00 2001 From: Anton Mushnin Date: Tue, 2 Apr 2024 10:36:34 +0300 Subject: [PATCH 2/7] https dev server --- web/package-lock.json | 33 +++++++++++++++++---------------- web/package.json | 3 ++- web/server.js | 28 ++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 17 deletions(-) create mode 100644 web/server.js diff --git a/web/package-lock.json b/web/package-lock.json index 0187f1b4..d8c0b1c8 100644 --- a/web/package-lock.json +++ b/web/package-lock.json @@ -18,6 +18,7 @@ "@types/react-dom": "18.0.10", "axios": "^1.3.0", "eslint-config-next": "13.1.1", + "express": "^4.19.2", "framer-motion": "^6.5.1", "next": "13.1.1", "react": "18.2.0", @@ -3549,12 +3550,12 @@ "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" }, "node_modules/body-parser": { - "version": "1.20.1", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz", - "integrity": "sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==", + "version": "1.20.2", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", + "integrity": "sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==", "dependencies": { "bytes": "3.1.2", - "content-type": "~1.0.4", + "content-type": "~1.0.5", "debug": "2.6.9", "depd": "2.0.0", "destroy": "1.2.0", @@ -3562,7 +3563,7 @@ "iconv-lite": "0.4.24", "on-finished": "2.4.1", "qs": "6.11.0", - "raw-body": "2.5.1", + "raw-body": "2.5.2", "type-is": "~1.6.18", "unpipe": "1.0.0" }, @@ -4013,9 +4014,9 @@ "integrity": "sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==" }, "node_modules/cookie": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", - "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==", + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz", + "integrity": "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==", "engines": { "node": ">= 0.6" } @@ -5321,16 +5322,16 @@ } }, "node_modules/express": { - "version": "4.18.2", - "resolved": "https://registry.npmjs.org/express/-/express-4.18.2.tgz", - "integrity": "sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ==", + "version": "4.19.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.19.2.tgz", + "integrity": "sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q==", "dependencies": { "accepts": "~1.3.8", "array-flatten": "1.1.1", - "body-parser": "1.20.1", + "body-parser": "1.20.2", "content-disposition": "0.5.4", "content-type": "~1.0.4", - "cookie": "0.5.0", + "cookie": "0.6.0", "cookie-signature": "1.0.6", "debug": "2.6.9", "depd": "2.0.0", @@ -8730,9 +8731,9 @@ } }, "node_modules/raw-body": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz", - "integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==", + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz", + "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==", "dependencies": { "bytes": "3.1.2", "http-errors": "2.0.0", diff --git a/web/package.json b/web/package.json index b33860a7..a20ebc12 100644 --- a/web/package.json +++ b/web/package.json @@ -3,7 +3,7 @@ "version": "0.1.0", "private": true, "scripts": { - "dev": "next dev", + "dev": "node server.js", "build": "next build && next export -o build", "start": "next start", "lint": "next lint", @@ -20,6 +20,7 @@ "@types/react-dom": "18.0.10", "axios": "^1.3.0", "eslint-config-next": "13.1.1", + "express": "^4.19.2", "framer-motion": "^6.5.1", "next": "13.1.1", "react": "18.2.0", diff --git a/web/server.js b/web/server.js new file mode 100644 index 00000000..07860bf1 --- /dev/null +++ b/web/server.js @@ -0,0 +1,28 @@ +const { createServer } = require("https"); +const { parse } = require("url"); +const next = require("next"); +const fs = require("fs"); +const express = require("express"); + +const dev = process.env.NODE_ENV !== "production"; +const app = next({ dev }); +const handle = app.getRequestHandler(); + +app.prepare().then(() => { + const server = express(); + + server.get("*", (req, res) => { + const parsedUrl = parse(req.url, true); + handle(req, res, parsedUrl); + }); + + const options = { + key: fs.readFileSync("./localhost-key.pem"), + cert: fs.readFileSync("./localhost.pem"), + }; + + createServer(options, server).listen(3000, (err) => { + if (err) throw err; + console.log("> Ready on https://localhost:3000"); + }); +}); From de1832bed1ba42cec47d867183f2542520f3ce0a Mon Sep 17 00:00:00 2001 From: Anton Mushnin Date: Tue, 2 Apr 2024 11:31:17 +0300 Subject: [PATCH 3/7] https dev server script --- web/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/web/package.json b/web/package.json index a20ebc12..f72f3b9e 100644 --- a/web/package.json +++ b/web/package.json @@ -3,7 +3,8 @@ "version": "0.1.0", "private": true, "scripts": { - "dev": "node server.js", + "dev": "next dev", + "devHttps": "node server.js", "build": "next build && next export -o build", "start": "next start", "lint": "next lint", From ef763d8267aa489a6e3f8ffaf96fdfbab05f4717 Mon Sep 17 00:00:00 2001 From: Anton Mushnin Date: Tue, 2 Apr 2024 11:33:21 +0300 Subject: [PATCH 4/7] show notification --- web/src/components/Playing.tsx | 35 ++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/web/src/components/Playing.tsx b/web/src/components/Playing.tsx index 082ae7be..fa259c72 100644 --- a/web/src/components/Playing.tsx +++ b/web/src/components/Playing.tsx @@ -5,7 +5,7 @@ import SessionsView from "./sessions/SessionsView"; import PlayView from "./playing/PlayView"; import styles from "./Playing.module.css"; import { useQuery } from "react-query"; -import { OwnedToken } from "../types"; +import { AtBat, OwnedToken } from "../types"; import { fetchOwnedBLBTokens } from "../tokenInterfaces/BLBTokenAPI"; import { fetchFullcountPlayerTokens } from "../tokenInterfaces/FullcountPlayerAPI"; import queryCacheProps from "../hooks/hookCommon"; @@ -15,8 +15,9 @@ import PlayingLayout from "./layout/PlayingLayout"; import ChooseToken from "./tokens/ChooseToken"; import HomePage from "./HomePage/HomePage"; import { getAtBats } from "../services/fullcounts"; -import React, { useEffect } from "react"; +import React, { useEffect, useState } from "react"; import { FULLCOUNT_ASSETS_PATH } from "../constants"; +import { showNotification } from "../utils/notifications"; const Playing = () => { const { @@ -30,6 +31,7 @@ const Playing = () => { tokensCache, } = useGameContext(); const { user } = useUser(); + const [ownedAtBatsSnapshot, setOwnedAtBatsSnapshot] = useState(undefined); const ownedTokens = useQuery( ["owned_tokens", user], @@ -56,6 +58,35 @@ const Playing = () => { refetchInterval: 5000, onSuccess: (data: any) => { console.log(data); + const ownedAtBats: AtBat[] = data.atBats.filter( + (a: AtBat) => + a.progress !== 6 && + ownedTokens.data?.some( + (t) => + (t.address === a.pitcher?.address && t.id === a.pitcher.id) || + (t.address === a.batter?.address && t.id === a.batter.id), + ), + ); + if (ownedAtBatsSnapshot) { + console.log( + ownedAtBatsSnapshot.filter((atBat) => atBat.progress === 2), + ownedAtBats.filter((atBat) => atBat.progress === 3), + ); + ownedAtBatsSnapshot + .filter((atBat) => atBat.progress === 2) + .forEach((atBat) => { + console.log(atBat); + if ( + ownedAtBats.some( + (ownedAtBat) => ownedAtBat.id === atBat.id && ownedAtBat.progress === 3, + ) + ) { + console.log("joined"); + showNotification("Your at-bat is joined", ""); + } + }); + } + setOwnedAtBatsSnapshot(ownedAtBats); if (data.tokens.length !== tokensCache.length) { updateContext({ tokensCache: [...data.tokens] }); } From d5e453df520d8a3eec6146485a4948a55e7b66d0 Mon Sep 17 00:00:00 2001 From: Anton Mushnin Date: Wed, 3 Apr 2024 19:30:08 +0300 Subject: [PATCH 5/7] joinedNotification --- web/src/components/Playing.tsx | 9 ++++++--- web/src/components/layout/Navbar.tsx | 12 ++++++++++++ web/src/components/layout/PlayingLayout.tsx | 10 +++++++++- web/src/contexts/GameContext.tsx | 2 ++ web/src/utils/notifications.ts | 8 ++++++++ 5 files changed, 37 insertions(+), 4 deletions(-) diff --git a/web/src/components/Playing.tsx b/web/src/components/Playing.tsx index fa259c72..f08eed1f 100644 --- a/web/src/components/Playing.tsx +++ b/web/src/components/Playing.tsx @@ -17,7 +17,7 @@ import HomePage from "./HomePage/HomePage"; import { getAtBats } from "../services/fullcounts"; import React, { useEffect, useState } from "react"; import { FULLCOUNT_ASSETS_PATH } from "../constants"; -import { showNotification } from "../utils/notifications"; +import { playSound, showNotification } from "../utils/notifications"; const Playing = () => { const { @@ -29,6 +29,7 @@ const Playing = () => { invitedTo, isCreateCharacter, tokensCache, + joinedNotification, } = useGameContext(); const { user } = useUser(); const [ownedAtBatsSnapshot, setOwnedAtBatsSnapshot] = useState(undefined); @@ -81,8 +82,10 @@ const Playing = () => { (ownedAtBat) => ownedAtBat.id === atBat.id && ownedAtBat.progress === 3, ) ) { - console.log("joined"); - showNotification("Your at-bat is joined", ""); + if (joinedNotification) { + playSound("clapping"); + showNotification("Your at-bat is joined", ""); + } } }); } diff --git a/web/src/components/layout/Navbar.tsx b/web/src/components/layout/Navbar.tsx index 424becdd..0100bd76 100644 --- a/web/src/components/layout/Navbar.tsx +++ b/web/src/components/layout/Navbar.tsx @@ -8,6 +8,8 @@ import VolumeOn from "../icons/VolumeOn"; import MoreHorizontal from "../icons/MoreHorizontal"; import useLogout from "../../hooks/useLogout"; import { FEEDBACK_FORM_URL, FULLCOUNT_ASSETS_PATH } from "../../constants"; +import { setLocalStorageItem } from "../../utils/localStorage"; +import { useGameContext } from "../../contexts/GameContext"; const Navbar = () => { const [isSmallScreen, isMediumScreen] = useMediaQuery([ @@ -26,6 +28,12 @@ const Navbar = () => { } }; + const { joinedNotification, updateContext } = useGameContext(); + const handleNotificationClick = () => { + setLocalStorageItem("joinedNotification", !joinedNotification); + updateContext({ joinedNotification: !joinedNotification }); + }; + useEffect(() => { if (isMenuOpen) { document.addEventListener("click", handleClickOutside, true); @@ -63,6 +71,10 @@ const Navbar = () => { {/*
About
*/} {/*
Achievements
*/} {/*
Leaderboards
*/} +
{`Notifications - ${joinedNotification ? "on" : "off"}`}
{ diff --git a/web/src/components/layout/PlayingLayout.tsx b/web/src/components/layout/PlayingLayout.tsx index 227d5ce8..fc4c6d00 100644 --- a/web/src/components/layout/PlayingLayout.tsx +++ b/web/src/components/layout/PlayingLayout.tsx @@ -1,8 +1,10 @@ -import React, { ReactNode } from "react"; +import React, { ReactNode, useEffect } from "react"; import { Flex } from "@chakra-ui/react"; import Navbar from "./Navbar"; import { FULLCOUNT_ASSETS_PATH } from "../../constants"; +import { useGameContext } from "../../contexts/GameContext"; +import { getLocalStorageItem } from "../../utils/localStorage"; const sounds = { whoosh: `${FULLCOUNT_ASSETS_PATH}/sounds/whoosh.wav`, @@ -16,6 +18,12 @@ const sounds = { }; const PlayingLayout = ({ children }: { children: ReactNode }) => { + const { updateContext } = useGameContext(); + useEffect(() => { + const joinedNotification = getLocalStorageItem("joinedNotification"); + updateContext({ joinedNotification: !!joinedNotification }); + }, []); + return ( = ({ children }) => { atBatsForPractice: undefined, selectedMode: 1, selectedTokenIdx: 0, + joinedNotification: false, }); useEffect(() => { diff --git a/web/src/utils/notifications.ts b/web/src/utils/notifications.ts index 2440a5e6..5c319a60 100644 --- a/web/src/utils/notifications.ts +++ b/web/src/utils/notifications.ts @@ -14,3 +14,11 @@ export function showNotification(title: string, body: string) { }); } } + +export const playSound = (sound: string) => { + const soundElement = document.getElementById(sound) as HTMLAudioElement; + if (!soundElement) { + return; + } + soundElement.play(); +}; From 0c93aa1300b8a62976ccbb6e230f725a1cb3caf7 Mon Sep 17 00:00:00 2001 From: Anton Mushnin Date: Thu, 4 Apr 2024 18:28:30 +0300 Subject: [PATCH 6/7] joining notification --- web/src/components/Playing.tsx | 104 ++++++++++++++++--------- web/src/components/atbat/AtBatView.tsx | 29 ++++++- web/src/components/layout/layout.tsx | 8 +- 3 files changed, 103 insertions(+), 38 deletions(-) diff --git a/web/src/components/Playing.tsx b/web/src/components/Playing.tsx index f08eed1f..76d4664c 100644 --- a/web/src/components/Playing.tsx +++ b/web/src/components/Playing.tsx @@ -6,7 +6,6 @@ import PlayView from "./playing/PlayView"; import styles from "./Playing.module.css"; import { useQuery } from "react-query"; import { AtBat, OwnedToken } from "../types"; -import { fetchOwnedBLBTokens } from "../tokenInterfaces/BLBTokenAPI"; import { fetchFullcountPlayerTokens } from "../tokenInterfaces/FullcountPlayerAPI"; import queryCacheProps from "../hooks/hookCommon"; import useUser from "../contexts/UserContext"; @@ -17,7 +16,13 @@ import HomePage from "./HomePage/HomePage"; import { getAtBats } from "../services/fullcounts"; import React, { useEffect, useState } from "react"; import { FULLCOUNT_ASSETS_PATH } from "../constants"; -import { playSound, showNotification } from "../utils/notifications"; +import { playSound } from "../utils/notifications"; +import { getContracts } from "../utils/getWeb3Contracts"; +import { getMulticallResults } from "../utils/multicall"; + +import { AbiItem } from "web3-utils"; +import FullcountABIImported from "../web3/abi/FullcountABI.json"; +const FullcountABI = FullcountABIImported as unknown as AbiItem[]; const Playing = () => { const { @@ -32,13 +37,13 @@ const Playing = () => { joinedNotification, } = useGameContext(); const { user } = useUser(); - const [ownedAtBatsSnapshot, setOwnedAtBatsSnapshot] = useState(undefined); const ownedTokens = useQuery( ["owned_tokens", user], async () => { console.log("FETCHING TOKENS"); const ownedTokens = user ? await fetchFullcountPlayerTokens() : []; + // const waitingTokens = ownedTokens.map((t) => t.tokenProgress === 2); if (ownedTokens.length > 0 && !selectedToken && ownedTokens[selectedTokenIdx]) { updateContext({ selectedToken: { ...ownedTokens[selectedTokenIdx] } }); } @@ -50,6 +55,63 @@ const Playing = () => { }, ); + const tokenStatuses = useQuery( + ["token_statuses", ownedTokens.data, joinedNotification], + async () => { + if (!ownedTokens.data || ownedTokens.data.length < 1 || !joinedNotification) { + return; + } + const { gameContract } = getContracts(); + const queries: { target: string; callData: string }[] = []; + ownedTokens.data.forEach((ownedToken) => { + queries.push({ + target: gameContract.options.address, + callData: gameContract.methods + .StakedSession(ownedToken.address, ownedToken.id) + .encodeABI(), + }); + let stakedSession; + if (tokenStatuses.data) { + stakedSession = tokenStatuses.data.find( + (t) => t.address === ownedToken.address && t.id === ownedToken.id, + )?.stakedSessionID; + } + queries.push({ + target: gameContract.options.address, + callData: gameContract.methods.sessionProgress(stakedSession ?? 0).encodeABI(), + }); + }); + + const [stakedSessions, progresses] = await getMulticallResults( + FullcountABI, + ["StakedSession", "sessionProgress"], + queries, + ); + const result = ownedTokens.data.map((t, idx) => ({ + ...t, + stakedSession: stakedSessions[idx], + progress: progresses[idx], + })); + if ( + tokenStatuses.data && + tokenStatuses.data.some( + (ts) => + ts.progress === "2" && + result.some((t) => t.address === ts.address && t.id === ts.id && t.progress === "3"), + ) + ) { + playSound("clapping"); + } + + return result; + }, + { + enabled: !!ownedTokens.data && joinedNotification, + refetchIntervalInBackground: true, + refetchInterval: 10000, + }, + ); + const atBats = useQuery( ["atBats"], async () => { @@ -58,38 +120,6 @@ const Playing = () => { { refetchInterval: 5000, onSuccess: (data: any) => { - console.log(data); - const ownedAtBats: AtBat[] = data.atBats.filter( - (a: AtBat) => - a.progress !== 6 && - ownedTokens.data?.some( - (t) => - (t.address === a.pitcher?.address && t.id === a.pitcher.id) || - (t.address === a.batter?.address && t.id === a.batter.id), - ), - ); - if (ownedAtBatsSnapshot) { - console.log( - ownedAtBatsSnapshot.filter((atBat) => atBat.progress === 2), - ownedAtBats.filter((atBat) => atBat.progress === 3), - ); - ownedAtBatsSnapshot - .filter((atBat) => atBat.progress === 2) - .forEach((atBat) => { - console.log(atBat); - if ( - ownedAtBats.some( - (ownedAtBat) => ownedAtBat.id === atBat.id && ownedAtBat.progress === 3, - ) - ) { - if (joinedNotification) { - playSound("clapping"); - showNotification("Your at-bat is joined", ""); - } - } - }); - } - setOwnedAtBatsSnapshot(ownedAtBats); if (data.tokens.length !== tokensCache.length) { updateContext({ tokensCache: [...data.tokens] }); } @@ -154,7 +184,9 @@ const Playing = () => { updateContext({ isCreateCharacter: false })} /> )} - {ownedTokens.data && ownedTokens.data.length < 1 && } + {ownedTokens.data && ownedTokens.data.length < 1 && !ownedTokens.error && ( + + )} {!selectedSession && ownedTokens.data && diff --git a/web/src/components/atbat/AtBatView.tsx b/web/src/components/atbat/AtBatView.tsx index 2ad84b58..43e5831b 100644 --- a/web/src/components/atbat/AtBatView.tsx +++ b/web/src/components/atbat/AtBatView.tsx @@ -17,6 +17,7 @@ import ExitIcon from "../icons/ExitIcon"; import TokenCard from "./TokenCard"; import ScoreForDesktop from "./ScoreForDesktop"; import { sendReport } from "../../utils/humbug"; +import { playSound } from "../../utils/notifications"; const outcomes = [ "In Progress", @@ -57,7 +58,7 @@ const AtBatView: React.FC = () => { const router = useRouter(); const [atBatId, setAtBatId] = useState(null); const [sessionId, setSessionId] = useState(null); - const { tokensCache, updateContext, selectedToken } = useGameContext(); + const { tokensCache, updateContext, selectedToken, joinedNotification } = useGameContext(); const [showPitchOutcome, setShowPitchOutcome] = useState(false); const [currentSessionId, setCurrentSessionId] = useState(0); const [currentSessionIdx, setCurrentSessionIdx] = useState(0); @@ -128,6 +129,32 @@ const AtBatView: React.FC = () => { }, ); + const currentSessionProgress = useQuery( + ["currentSessionProgress", currentSessionId, joinedNotification], + async () => { + if ( + !currentSessionId || + !joinedNotification || + !atBatState.data || + atBatState.data?.atBat.pitches.length > 1 + ) { + return; + } + const { gameContract } = getContracts(); + const progress = await gameContract.methods.sessionProgress(currentSessionId).call(); + console.log(currentSessionProgress.data, progress); + if (Number(currentSessionProgress.data) === 2 && Number(progress) === 3) { + playSound("joinedNotification"); + } + return progress; + }, + { + refetchIntervalInBackground: true, + refetchInterval: 10000, + enabled: !!currentSessionId && joinedNotification, + }, + ); + useEffect(() => { console.log(selectedToken, atBatState.data?.atBat.batter); }, [atBatState.data?.atBat.batter, selectedToken]); diff --git a/web/src/components/layout/layout.tsx b/web/src/components/layout/layout.tsx index 76641516..8b0319c0 100644 --- a/web/src/components/layout/layout.tsx +++ b/web/src/components/layout/layout.tsx @@ -2,7 +2,8 @@ import Head from "next/head"; import { Flex } from "@chakra-ui/react"; -import { FULLCOUNT_ASSETS } from "../../constants"; +import { FULLCOUNT_ASSETS, FULLCOUNT_ASSETS_PATH } from "../../constants"; +import React from "react"; export const siteTitle = "Fullcount - baseball game"; @@ -36,6 +37,11 @@ export default function Layout({ fontFamily="Pangolin, cursive" direction={"column"} > +
From 8a1c302d30a1a1acca858ef8bd6c0443d64d9f86 Mon Sep 17 00:00:00 2001 From: Anton Mushnin Date: Thu, 4 Apr 2024 20:42:44 +0300 Subject: [PATCH 7/7] lint --- web/src/components/Playing.tsx | 1 - web/src/components/atbat/AtBatView.tsx | 5 ----- 2 files changed, 6 deletions(-) diff --git a/web/src/components/Playing.tsx b/web/src/components/Playing.tsx index 76d4664c..74b26387 100644 --- a/web/src/components/Playing.tsx +++ b/web/src/components/Playing.tsx @@ -43,7 +43,6 @@ const Playing = () => { async () => { console.log("FETCHING TOKENS"); const ownedTokens = user ? await fetchFullcountPlayerTokens() : []; - // const waitingTokens = ownedTokens.map((t) => t.tokenProgress === 2); if (ownedTokens.length > 0 && !selectedToken && ownedTokens[selectedTokenIdx]) { updateContext({ selectedToken: { ...ownedTokens[selectedTokenIdx] } }); } diff --git a/web/src/components/atbat/AtBatView.tsx b/web/src/components/atbat/AtBatView.tsx index 43e5831b..0ec00e32 100644 --- a/web/src/components/atbat/AtBatView.tsx +++ b/web/src/components/atbat/AtBatView.tsx @@ -142,7 +142,6 @@ const AtBatView: React.FC = () => { } const { gameContract } = getContracts(); const progress = await gameContract.methods.sessionProgress(currentSessionId).call(); - console.log(currentSessionProgress.data, progress); if (Number(currentSessionProgress.data) === 2 && Number(progress) === 3) { playSound("joinedNotification"); } @@ -155,10 +154,6 @@ const AtBatView: React.FC = () => { }, ); - useEffect(() => { - console.log(selectedToken, atBatState.data?.atBat.batter); - }, [atBatState.data?.atBat.batter, selectedToken]); - const isSameToken = (a: Token | undefined, b: Token | undefined) => { if (!a || !b) return false; return a.id === b.id && a.address === b.address;