Skip to content

Commit

Permalink
fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
starknetdev committed Jan 10, 2024
1 parent ca57351 commit 0b3572a
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 16 deletions.
8 changes: 2 additions & 6 deletions ui/src/app/components/intro/ArcadeIntro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@ import { useEffect, useState } from "react";
import { MdClose } from "react-icons/md";
import { Contract } from "starknet";
import { useAccount, useConnect, useDisconnect } from "@starknet-react/core";
import {
ETH_PREFUND_AMOUNT,
LORDS_PREFUND_AMOUNT,
useBurner,
} from "@/app/lib/burner";
import { ETH_PREFUND_AMOUNT, useBurner } from "@/app/lib/burner";
import { Button } from "@/app/components/buttons/Button";
import useUIStore from "@/app/hooks/useUIStore";
import { getWalletConnectors } from "@/app/lib/connectors";
Expand Down Expand Up @@ -66,7 +62,7 @@ export const ArcadeIntro = ({
const eth = Number(ethBalance);

const checkNotEnoughPrefundEth = eth < parseInt(ETH_PREFUND_AMOUNT);
const checkNotEnoughPrefundLords = lords < parseInt(LORDS_PREFUND_AMOUNT);
const checkNotEnoughPrefundLords = lords < parseInt("1000000000000");

useEffect(() => {
if (
Expand Down
2 changes: 0 additions & 2 deletions ui/src/app/components/intro/WalletSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { useState } from "react";
import Image from "next/image";
import { Button } from "@/app/components/buttons/Button";
import { useConnect } from "@starknet-react/core";
import useUIStore from "@/app/hooks/useUIStore";
import { WalletTutorial } from "@/app/components/intro/WalletTutorial";
import Storage from "@/app/lib/storage";
import { BurnerStorage } from "@/app/types";
Expand All @@ -12,7 +11,6 @@ interface WalletSelectProps {}

const WalletSelect = ({}: WalletSelectProps) => {
const { connectors, connect } = useConnect();
const setDisconnected = useUIStore((state) => state.setDisconnected);
const [screen, setScreen] = useState("wallet");

if (!connectors) return <div></div>;
Expand Down
4 changes: 4 additions & 0 deletions ui/src/app/components/start/CreateAdventurer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export interface CreateAdventurerProps {
gameContract: Contract;
getBalances: () => Promise<void>;
mintLords: () => Promise<void>;
costToPlay: bigint;
}

export const CreateAdventurer = ({
Expand All @@ -25,6 +26,7 @@ export const CreateAdventurer = ({
gameContract,
getBalances,
mintLords,
costToPlay,
}: CreateAdventurerProps) => {
const [formData, setFormData] = useState<FormData>({
startingWeapon: "",
Expand Down Expand Up @@ -120,6 +122,7 @@ export const CreateAdventurer = ({
gameContract={gameContract}
getBalances={getBalances}
mintLords={mintLords}
costToPlay={costToPlay}
/>
</div>
<div className="sm:hidden">
Expand All @@ -144,6 +147,7 @@ export const CreateAdventurer = ({
gameContract={gameContract}
getBalances={getBalances}
mintLords={mintLords}
costToPlay={costToPlay}
/>
</div>
)}
Expand Down
9 changes: 6 additions & 3 deletions ui/src/app/components/start/Spawn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export interface SpawnProps {
gameContract: Contract;
getBalances: () => Promise<void>;
mintLords: () => Promise<void>;
costToPlay: bigint;
}

export const Spawn = ({
Expand All @@ -43,6 +44,7 @@ export const Spawn = ({
gameContract,
getBalances,
mintLords,
costToPlay,
}: SpawnProps) => {
const [showWalletTutorial, setShowWalletTutorial] = useState(false);
const [formFilled, setFormFilled] = useState(false);
Expand Down Expand Up @@ -72,15 +74,17 @@ export const Spawn = ({
setShowWalletTutorial(true);
};

const lordsGameCost = Number(costToPlay);

const handleSubmitLords = async () => {
resetNotification();
await spawn(formData, "0", costToPlay!);
await spawn(formData, "0", lordsGameCost);
await getBalances();
};

const handleSubmitGoldenToken = async () => {
resetNotification();
await spawn(formData, usableToken, costToPlay);
await spawn(formData, usableToken, lordsGameCost);
await getBalances();
};

Expand Down Expand Up @@ -133,7 +137,6 @@ export const Spawn = ({

useEffect(() => {
getUsableGoldenToken(goldenTokens ?? []);
getCostToPlay();
}, []);

return (
Expand Down
3 changes: 3 additions & 0 deletions ui/src/app/containers/AdventurerScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ interface AdventurerScreenProps {
goldenTokenData: any;
getBalances: () => Promise<void>;
mintLords: () => Promise<void>;
costToPlay: bigint;
}

/**
Expand All @@ -30,6 +31,7 @@ export default function AdventurerScreen({
goldenTokenData,
getBalances,
mintLords,
costToPlay,
}: AdventurerScreenProps) {
const [activeMenu, setActiveMenu] = useState(0);
const setAdventurer = useAdventurerStore((state) => state.setAdventurer);
Expand Down Expand Up @@ -93,6 +95,7 @@ export default function AdventurerScreen({
gameContract={gameContract}
getBalances={getBalances}
mintLords={mintLords}
costToPlay={costToPlay}
/>
</div>
)}
Expand Down
6 changes: 2 additions & 4 deletions ui/src/app/containers/Onboarding.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { useState, useEffect } from "react";
import Image from "next/image";
import { MdClose } from "react-icons/md";
import { CompleteIcon, InfoIcon } from "@/app/components/icons/Icons";
import { Button } from "@/app/components/buttons/Button";
import { getWalletConnectors } from "@/app/lib/connectors";
import { useAccount, useConnect, useDisconnect } from "@starknet-react/core";
import useUIStore from "@/app/hooks/useUIStore";
import { ETH_PREFUND_AMOUNT } from "../lib/burner";
import Eth from "public/icons/eth-2.svg";
import Lords from "public/icons/lords.svg";
Expand Down Expand Up @@ -130,7 +128,7 @@ const Onboarding = ({
costToPlay,
mintLords,
}: OnboardingProps) => {
const { account, address, connector } = useAccount();
const { account, address } = useAccount();
const { connect, connectors } = useConnect();
const { disconnect } = useDisconnect();
const walletConnectors = getWalletConnectors(connectors);
Expand All @@ -139,7 +137,7 @@ const Onboarding = ({

const [step, setStep] = useState(1);

const setScreen = useUIStore((state) => state.setScreen);
// const setScreen = useUIStore((state) => state.setScreen);

const eth = Number(ethBalance);
const lords = Number(lordsBalance);
Expand Down
4 changes: 3 additions & 1 deletion ui/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ import Game from "@/app/abi/Game.json";
import Lords from "@/app/abi/Lords.json";
import EthBalanceFragment from "@/app/abi/EthBalanceFragment.json";
import Beasts from "@/app/abi/Beasts.json";
import { ArcadeIntro } from "@/app/components/intro/ArcadeIntro";
// import { ArcadeIntro } from "@/app/components/intro/ArcadeIntro";
import ScreenMenu from "@/app/components/menu/ScreenMenu";
import {
getArcadeConnectors,
Expand Down Expand Up @@ -526,6 +526,7 @@ function Home({ updateConnectors }: HomeProps) {
ethBalance={ethBalance}
lordsBalance={lordsBalance}
costToPlay={costToPlay!}
mintLords={mintLords}
/>
) : (
<>
Expand Down Expand Up @@ -608,6 +609,7 @@ function Home({ updateConnectors }: HomeProps) {
goldenTokenData={goldenTokenData}
getBalances={getBalances}
mintLords={mintLords}
costToPlay={costToPlay!}
/>
)}
{screen === "play" && (
Expand Down

0 comments on commit 0b3572a

Please sign in to comment.