Skip to content

Commit

Permalink
feat: removed unused imports and console logs
Browse files Browse the repository at this point in the history
  • Loading branch information
rishabhkeshan committed Oct 30, 2024
1 parent d5b84a3 commit 4119dd8
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 70 deletions.
6 changes: 1 addition & 5 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ import { cssObj } from "@fuel-ui/css";
import { Box, BoxCentered, Heading } from "@fuel-ui/react";
import {
useIsConnected,
useWallet,
useAssets,
useAddAssets,
useWallet
} from "@fuels/react";
//Add Analytics
import { useState, useEffect, useMemo } from "react";
Expand All @@ -13,15 +11,13 @@ import Game from "./components/Game.tsx";
import Home from "./components/home/Home.tsx";
import {
CONTRACT_ID,
FARM_COIN_ASSET,
FARM_COIN_ASSET_ID,
// VERCEL_ENV,
} from "./constants.ts";
import "./App.css";
import { FarmContract } from "./sway-api/index.ts";

function App() {
const [mounted, setMounted] = useState<boolean>(false);
const [isMobile, setIsMobile] = useState(false);
const [farmCoinAssetID, setFarmCoinAssetId] = useState<string | null>(
FARM_COIN_ASSET_ID
Expand Down
1 change: 0 additions & 1 deletion frontend/src/components/Game.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ export default function Game({
// get the player first

const { value: Some } = await contract.functions.get_player(id).get();
console.log("SOME:", Some);
if (Some?.farming_skill.gte(1)) {
setPlayer(Some);
const seedType: FoodTypeInput = FoodTypeInput.Tomatoes;
Expand Down
8 changes: 0 additions & 8 deletions frontend/src/components/Garden.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,13 @@ export default function Garden({
}: GardenProps) {
useEffect(() => {
async function getPlantedSeeds() {
const startTime = performance.now();

if (contract && contract.account) {
try {
const address: AddressInput = {
bits: contract.account.address.toB256(),
};
const id: IdentityInput = { Address: address };
const { value } = await contract.functions.get_garden_vec(id).get();
const firstTxTime = performance.now();
const timeDiff = (firstTxTime - startTime) / 1000; // Difference in seconds
console.log(
`3rd tx call duration: ${timeDiff.toFixed(2)} seconds`
);
console.log("VALUE:", value)
setTileStates(value);
} catch (err) {
console.log('Error in Garden:', err);
Expand Down
1 change: 0 additions & 1 deletion frontend/src/components/GardenTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ export default function GardenTile({
let diff = (now - unix) / 1000;
diff /= 60;
const minutesAgo = Math.abs(Math.floor(diff));
console.log(`Position: ${position.x}, Diff: ${diff}, Minutes Ago: ${minutesAgo}`)
if (minutesAgo < 20) {
setTileState(minutesAgo);
} else {
Expand Down
2 changes: 0 additions & 2 deletions frontend/src/components/modals/PlantModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,10 @@ export default function PlantModal({
setCanMove(false);
const seedType: FoodTypeInput = FoodTypeInput.Tomatoes;

console.log("TILE ARRAY:", tileArray);
const tx = await contract.functions
.plant_seed_at_index(seedType, tileArray[0])
.call();

console.log("tx", tx);
if (tx) {
onPlantSuccess(tileArray[0]);
setModal("none");
Expand Down
14 changes: 1 addition & 13 deletions frontend/src/components/show/Info.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,8 @@ export default function Info({
/>
</Box>
<Box css={styles.playeriInfo}>
{/* <GithubRepo />
<ShowPlayerInfo
player={player}
contract={contract}
updateNum={updateNum}
farmCoinAssetID={farmCoinAssetID}
/> */}
<Inventory seeds={seeds} items={items} />
<WalletInfo
player={player}
contract={contract}
updateNum={updateNum}
farmCoinAssetID={farmCoinAssetID}
/>
<WalletInfo/>
</Box>
</Box>
);
Expand Down
28 changes: 2 additions & 26 deletions frontend/src/components/show/WalletInfo.tsx
Original file line number Diff line number Diff line change
@@ -1,37 +1,13 @@
import { cssObj } from "@fuel-ui/css";
import { Flex, Box } from "@fuel-ui/react";
import type { BytesLike } from "fuels";
import {
useWallet,
useIsConnected,
useNetwork,
useBalance,
useDisconnect,
} from "@fuels/react";

import type {
FarmContract,
PlayerOutput,
} from "../../sway-api/contracts/FarmContract";

interface PlayerProps {
player: PlayerOutput | null;
contract: FarmContract | null;
updateNum: number;
farmCoinAssetID: BytesLike;
}

export default function WalletInfo({
player,
contract,
updateNum,
farmCoinAssetID,
}: PlayerProps) {
let valSold;
if (player !== null) {
valSold = parseFloat(player.total_value_sold.format().toLocaleString());
}
const { wallet, isLoading: isWalletLoading } = useWallet();
export default function WalletInfo() {
const { wallet } = useWallet();
const getTruncatedAddress = (address: string) => {
return address.slice(0, 6) + "..." + address.slice(-4);
};
Expand Down
17 changes: 3 additions & 14 deletions frontend/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
createConfig as createFuelConfig,
FueletWalletConnector,
FuelWalletConnector,
BurnerWalletConnector,
SolanaConnector,
WalletConnectConnector,
defaultConnectors,

Check failure on line 10 in frontend/src/main.tsx

View workflow job for this annotation

GitHub Actions / Lint

'defaultConnectors' is defined but never used
Expand Down Expand Up @@ -61,7 +60,6 @@ const FUEL_CONFIG = createFuelConfig(() => {
const fueletWalletConnector = new FueletWalletConnector();
const fuelWalletConnector = new FuelWalletConnector();
const bakoSafeConnector = new BakoSafeConnector();
const burnerWalletConnector = new BurnerWalletConnector();
const walletConnectConnector = new WalletConnectConnector({
projectId: WalletConnectProjectId,
wagmiConfig: wagmiConfig as any,

Check failure on line 65 in frontend/src/main.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
Expand All @@ -78,25 +76,16 @@ const FUEL_CONFIG = createFuelConfig(() => {
walletConnectConnector,
solanaConnector,
fuelWalletConnector,
bakoSafeConnector,
burnerWalletConnector
bakoSafeConnector
],
};
});
createRoot(document.getElementById("root")!).render(
<StrictMode>
<QueryClientProvider client={queryClient}>
<FuelProvider
// networks={networks}
// fuelConfig={FUEL_CONFIG}
fuelConfig={{
connectors: defaultConnectors({
devMode: true,
wcProjectId: "35b967d8f17700b2de24f0abee77e579",
chainId: CHAIN_IDS.fuel.mainnet,
fuelProvider: Provider.create(FUEL_PROVIDER_URL),
}),
}}
networks={networks}
fuelConfig={FUEL_CONFIG}
uiConfig={{ suggestBridge: false }}
theme="dark"
>
Expand Down

0 comments on commit 4119dd8

Please sign in to comment.