From d01f40eb55ccfe67a5f6be57d441a21c188c27d9 Mon Sep 17 00:00:00 2001 From: rsproule Date: Fri, 5 Jan 2024 11:13:26 -0500 Subject: [PATCH] feat: show the podium above treaties --- .../src/components/tankGame/EventsStream.tsx | 26 +++++++------------ frontend/src/components/tankGame/TankGame.tsx | 7 +++-- 2 files changed, 12 insertions(+), 21 deletions(-) diff --git a/frontend/src/components/tankGame/EventsStream.tsx b/frontend/src/components/tankGame/EventsStream.tsx index 847c425..3736d17 100644 --- a/frontend/src/components/tankGame/EventsStream.tsx +++ b/frontend/src/components/tankGame/EventsStream.tsx @@ -10,10 +10,6 @@ export async function getTankNameFromJoinIndex( address: Address, tankId: bigint ) { - // HACK: jonah forgot to set his name so we are mapping it here :eyeroll: - if (tankId === BigInt(2)) { - return "jonah-forgot-to-set-his-name"; - } let logs = await getLogs(address); let joinLogs = logs.filter((log) => log.eventName == "PlayerJoined"); // @ts-ignore @@ -41,13 +37,6 @@ export async function getTankNameFromAddress( address: Address, player: Address ) { - // HACK: jonah forgot to set his name so we are mapping it here :eyeroll: - if ( - player.toLowerCase() === - "0xc6d109eFf13844c1AE490Ed7e1dD46F56b337928".toLowerCase() - ) { - return "jonah-forgot-to-set-his-name"; - } let logs = await getLogs(address); let joinLogs = logs.filter((log) => log.eventName === "PlayerJoined"); // @ts-ignore @@ -280,8 +269,9 @@ const giveString = async (address: Address, event: any) => { return `🤝 ${await getTankNameFromJoinIndex( address, event.args.fromId - )} gave ${event.args.hearts || event.args.aps} ${event.args.hearts ? "hearts" : "aps" - } to ${await getTankNameFromJoinIndex(address, event.args.toId)}`; + )} gave ${event.args.hearts || event.args.aps} ${ + event.args.hearts ? "hearts" : "aps" + } to ${await getTankNameFromJoinIndex(address, event.args.toId)}`; }; const upgradeString = async (address: Address, event: any) => { @@ -321,15 +311,17 @@ const claimString = async (address: Address, event: any) => { }; const joinString = async (address: Address, event: any) => { - return `🆕 ${(await getTankNameFromAddress(address, event.args.player)) || + return `🆕 ${ + (await getTankNameFromAddress(address, event.args.player)) || event.args.player - } has joined the game.`; + } has joined the game.`; }; const donateString = async (address: Address, event: any) => { - return `🎁 ${(await getTankNameFromAddress(address, event.args.donator)) || + return `🎁 ${ + (await getTankNameFromAddress(address, event.args.donator)) || event.args.donator - } has added ${formatEther(event.args.amount!)} ether to the prize pool.`; + } has added ${formatEther(event.args.amount!)} ether to the prize pool.`; }; const startString = async () => { diff --git a/frontend/src/components/tankGame/TankGame.tsx b/frontend/src/components/tankGame/TankGame.tsx index 7bdcdbf..840c863 100644 --- a/frontend/src/components/tankGame/TankGame.tsx +++ b/frontend/src/components/tankGame/TankGame.tsx @@ -37,13 +37,12 @@ export function TankGame({ address }: { address: `0x${string}` }) { gameAddress={address} />
- + {gameState.data !== 2 && } + {gameState.data === 2 && } + {gameState.data !== 2 && }
- {/* {gameState.data === 1 && } */} - {gameState.data === 2 && } - {gameState.data !== 2 && }