Skip to content

Commit

Permalink
fixed ark project logo link not working when both wallets connected
Browse files Browse the repository at this point in the history
  • Loading branch information
YohanTz committed Apr 5, 2024
1 parent 1e4b6fc commit 8c65f90
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 20 deletions.
15 changes: 0 additions & 15 deletions apps/web/src/app/(routes)/page.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,12 @@
"use client";

import { useAccount as useStarknetAccount } from "@starknet-react/core";
import { Typography } from "design-system";
import Image from "next/image";
import { useRouter } from "next/navigation";
import { useEffect } from "react";
import { useAccount as useEthereumAccount } from "wagmi";

import ConnectWalletsButton from "../_components/ConnectWalletsButton";
import Footer from "../_components/Footer";

export default function Page() {
const { address: starknetAddress } = useStarknetAccount();
const { address: ethereumAddress } = useEthereumAccount();

const router = useRouter();

useEffect(() => {
if (starknetAddress !== undefined && ethereumAddress !== undefined) {
void router.push("/bridge");
}
}, [starknetAddress, ethereumAddress, router]);

return (
<>
<div className="flex">
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/app/(routes)/providers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const wagmiConfig = createConfig({
// chains: [goerli],
chains: [mainnet],
connectors: ethereumConnectors,
ssr: true,
ssr: false,
transports: {
[mainnet.id]: http(
process.env.NEXT_PUBLIC_ALCHEMY_ETHEREUM_RPC_ENDPOINT ?? ""
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/app/_components/ConnectWalletsButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default function ConnectWalletsButton() {
toggleConnectEthereumWalletModal();
return;
}
toggleConnectWalletsModal;
toggleConnectWalletsModal();
}

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
useNetwork as useStarknetNetwork,
} from "@starknet-react/core";
import { SideDialog } from "design-system";
import { usePathname } from "next/navigation";
import { usePathname, useRouter } from "next/navigation";
import {
type PropsWithChildren,
createContext,
Expand Down Expand Up @@ -38,6 +38,7 @@ export function WalletModalsProvider({ children }: PropsWithChildren) {
>(null);

const pathname = usePathname();
const router = useRouter();

const toggleConnectEthereumWalletModal = useCallback(() => {
if (userOpenedModal === "ethereumWallet") {
Expand Down Expand Up @@ -88,6 +89,7 @@ export function WalletModalsProvider({ children }: PropsWithChildren) {
ethereumAddress !== undefined
) {
setUserOpenedModal(null);
void router.push("/bridge");
return;
}
}, [starknetAddress, ethereumAddress, userOpenedModal]);
Expand All @@ -111,8 +113,7 @@ export function WalletModalsProvider({ children }: PropsWithChildren) {
return;
}
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [pathname]);
}, [pathname, starknetAddress, ethereumAddress]);

return (
<WalletModalsContext.Provider
Expand Down

0 comments on commit 8c65f90

Please sign in to comment.