Skip to content

Commit

Permalink
fix: testing without double render
Browse files Browse the repository at this point in the history
  • Loading branch information
irisdv committed Aug 28, 2023
1 parent 820b61c commit 1b734b8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 29 deletions.
41 changes: 13 additions & 28 deletions components/UI/wallets.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import styles from "../../styles/components/wallets.module.css";
import { Connector, useAccount, useConnectors } from "@starknet-react/core";
import { useAccount, useConnectors } from "@starknet-react/core";
import Button from "./button";
import { FunctionComponent, useEffect } from "react";
import { Modal } from "@mui/material";
Expand All @@ -24,21 +24,6 @@ const Wallets: FunctionComponent<WalletsProps> = ({
}
}, [account, closeWallet]);

function connectWallet(connector: Connector) {
try {
connect(connector);
} finally {
if (!connector.available() && !account) {
if (connector.id === "argentX")
window.open("https://www.argent.xyz/argent-x/");
else if (connector.id === "braavos")
window.open("https://braavos.app/download-braavos-wallet/");
} else {
closeWallet();
}
}
}

return (
<Modal
disableAutoFocus
Expand All @@ -65,18 +50,18 @@ const Wallets: FunctionComponent<WalletsProps> = ({
</button>
<p className={styles.menu_title}>You need a Starknet wallet</p>
{connectors.map((connector) => {
// if (connector.available()) {
return (
<div className="mt-5 flex justify-center" key={connector.id}>
<Button onClick={() => connectWallet(connector)}>
<div className="flex justify-center items-center">
<WalletIcons id={connector.id} />
{`Connect ${connector.id}`}
</div>
</Button>
</div>
);
// }
if (connector.available()) {
return (
<div className="mt-5 flex justify-center" key={connector.id}>
<Button onClick={() => connect(connector)}>
<div className="flex justify-center items-center">
<WalletIcons id={connector.id} />
{`Connect ${connector.id}`}
</div>
</Button>
</div>
);
}
})}
</div>
</Modal>
Expand Down
2 changes: 1 addition & 1 deletion next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module.exports = {
],
};
},
reactStrictMode: true,
reactStrictMode: false,
webpack: (config, { isServer }) => {
if (!isServer) {
config.resolve.fallback.fs = false;
Expand Down

0 comments on commit 1b734b8

Please sign in to comment.