From 539952ff1af1d851287dfcbca3ac392c3284c561 Mon Sep 17 00:00:00 2001 From: rishabhkeshan Date: Wed, 18 Dec 2024 18:26:28 +0530 Subject: [PATCH] feat: minor fixes --- frontend/src/components/Game.tsx | 8 ++++-- frontend/src/components/NewPlayer.tsx | 4 +-- frontend/src/components/modals/BuySeeds.tsx | 5 +++- .../src/components/modals/MarketModal.tsx | 3 +++ frontend/src/components/modals/PlantModal.tsx | 4 +-- .../modals/UnsupportedWalletsNoticeModal.tsx | 25 +++++++++++-------- 6 files changed, 32 insertions(+), 17 deletions(-) diff --git a/frontend/src/components/Game.tsx b/frontend/src/components/Game.tsx index e9a84dc..54cec53 100644 --- a/frontend/src/components/Game.tsx +++ b/frontend/src/components/Game.tsx @@ -104,7 +104,7 @@ export default function Game({ // fetches player info 30 seconds const interval = setInterval(() => { setUpdateNum(updateNum + 1); - }, 10000); + }, 20000); return () => clearInterval(interval); }, [contract, updateNum]); @@ -112,7 +112,7 @@ export default function Game({ const updatePageNum = () => { setTimeout(() => { setUpdateNum(updateNum + 1); - }, 3000); + }, 3500); }; const handlePlantSuccess = (position: number) => { setSeeds((prev) => prev - 1); @@ -132,6 +132,9 @@ export default function Game({ } as GardenVectorOutput; }); }; + const handleBuySuccess = () => { + setSeeds((prev) => prev + 10); + }; const onHarvestSuccess = (position: number) => { setItems((prev) => prev + 1); setTileStates((prev) => { @@ -253,6 +256,7 @@ export default function Game({ items={items} setCanMove={setCanMove} farmCoinAssetID={farmCoinAssetID} + onBuySuccess={handleBuySuccess} /> )} diff --git a/frontend/src/components/NewPlayer.tsx b/frontend/src/components/NewPlayer.tsx index 8bc9b56..6e25ce1 100644 --- a/frontend/src/components/NewPlayer.tsx +++ b/frontend/src/components/NewPlayer.tsx @@ -79,7 +79,7 @@ export default function NewPlayer({ } as PlayerOutput); setModal("none"); updatePageNum(); - toast.success("Welcome to Sway Farm! 🌱"); + toast.success("Welcome to Sway Farm!"); } return tx; } @@ -126,7 +126,7 @@ export default function NewPlayer({ } as PlayerOutput); setModal("none"); updatePageNum(); - toast.success("Welcome to Sway Farm! 🌱"); + toast.success("Welcome to Sway Farm!"); } } diff --git a/frontend/src/components/modals/BuySeeds.tsx b/frontend/src/components/modals/BuySeeds.tsx index 46e3576..6fe03e6 100644 --- a/frontend/src/components/modals/BuySeeds.tsx +++ b/frontend/src/components/modals/BuySeeds.tsx @@ -16,6 +16,7 @@ interface BuySeedsProps { updatePageNum: () => void; setCanMove: Dispatch>; farmCoinAssetID: BytesLike; + onBuySuccess: () => void; } export default function BuySeeds({ @@ -23,6 +24,7 @@ export default function BuySeeds({ updatePageNum, setCanMove, farmCoinAssetID, + onBuySuccess, }: BuySeedsProps) { const [status, setStatus] = useState< "error" | "none" | "loading" | "retrying" @@ -93,6 +95,7 @@ export default function BuySeeds({ }); if (tx) { toast.success("Successfully bought seeds!"); + onBuySuccess(); updatePageNum(); } } @@ -121,7 +124,7 @@ export default function BuySeeds({ if (tx) { toast.success("Successfully bought seeds!"); - + onBuySuccess(); updatePageNum(); } return tx; diff --git a/frontend/src/components/modals/MarketModal.tsx b/frontend/src/components/modals/MarketModal.tsx index e4e524f..5181e36 100644 --- a/frontend/src/components/modals/MarketModal.tsx +++ b/frontend/src/components/modals/MarketModal.tsx @@ -12,6 +12,7 @@ interface MarketModalProps { items: number; setCanMove: Dispatch>; farmCoinAssetID: BytesLike; + onBuySuccess: () => void; } export default function MarketModal({ @@ -20,6 +21,7 @@ export default function MarketModal({ items, setCanMove, farmCoinAssetID, + onBuySuccess, }: MarketModalProps) { return (
@@ -28,6 +30,7 @@ export default function MarketModal({ updatePageNum={updatePageNum} setCanMove={setCanMove} farmCoinAssetID={farmCoinAssetID} + onBuySuccess={onBuySuccess} /> {items > 0 && ( e.stopPropagation()} style={{ - backgroundColor: "white", - padding: "20px", + backgroundColor: "rgb(18, 18, 18)", + padding: "30px", borderRadius: "8px", maxWidth: "400px", width: "90%", @@ -36,18 +36,22 @@ export const UnsupportedWalletsNoticeModal = ({ }} >
Wallet Support Notice
-
+
Note: Gasless transactions are currently only supported for the Burner - wallet & Fuelet. + wallet & Fuelet Wallet.

Support for other wallets is coming soon. If you use these other - wallets, you can still play the game, but you will need to pay gas - fees yourself. + wallets, you can still play the game by paying gas fees yourself.
); }; +