Connect wallet or search an account to continue.
diff --git a/src/components/common/Name.tsx b/src/components/common/Name.tsx
new file mode 100644
index 00000000..6451df0b
--- /dev/null
+++ b/src/components/common/Name.tsx
@@ -0,0 +1,23 @@
+'use client';
+
+import { useEnsName } from 'wagmi';
+
+type NameProps = {
+ address: `0x${string}`;
+ className?: string;
+};
+
+export function Name({ address, className = '' }: NameProps) {
+ const { data: ensName, isLoading } = useEnsName({
+ address,
+ chainId: 1,
+ });
+
+ if (isLoading) {
+ return
... ;
+ }
+
+ return (
+
{ensName ?? `${address.slice(0, 6)}...${address.slice(-4)}`}
+ );
+}
diff --git a/src/components/layout/header/AccountConnect.tsx b/src/components/layout/header/AccountConnect.tsx
index d6ac5d93..438c38c5 100644
--- a/src/components/layout/header/AccountConnect.tsx
+++ b/src/components/layout/header/AccountConnect.tsx
@@ -1,5 +1,6 @@
import { ConnectButton } from '@rainbow-me/rainbowkit';
import '@rainbow-me/rainbowkit/styles.css';
+import { Button } from '@/components/common';
import { AccountDropdown } from './AccountDropdown';
/**
@@ -34,13 +35,9 @@ function AccountConnect() {
{(() => {
if (!connected) {
return (
-
- Connect
-
+
+ Connect
+
);
}
diff --git a/src/components/layout/header/AccountDropdown.tsx b/src/components/layout/header/AccountDropdown.tsx
index a03f952f..3f547ba7 100644
--- a/src/components/layout/header/AccountDropdown.tsx
+++ b/src/components/layout/header/AccountDropdown.tsx
@@ -1,5 +1,6 @@
+'use client';
+
import { useCallback, useState } from 'react';
-import { Name } from '@coinbase/onchainkit/identity';
import * as DropdownMenu from '@radix-ui/react-dropdown-menu';
import { ExitIcon, ExternalLinkIcon } from '@radix-ui/react-icons';
import { clsx } from 'clsx';
@@ -8,6 +9,7 @@ import { usePathname } from 'next/navigation';
import { FiSettings } from 'react-icons/fi';
import { useAccount, useDisconnect } from 'wagmi';
import { Avatar } from '@/components/Avatar/Avatar';
+import { Name } from '@/components/common/Name';
import { getSlicedAddress } from '@/utils/address';
import { getExplorerURL } from '@/utils/external';
diff --git a/src/components/layout/header/Navbar.test.tsx b/src/components/layout/header/Navbar.test.tsx
deleted file mode 100644
index c6b2be64..00000000
--- a/src/components/layout/header/Navbar.test.tsx
+++ /dev/null
@@ -1,20 +0,0 @@
-/**
- * @jest-environment jsdom
- */
-import { render, screen, waitFor } from '@testing-library/react';
-import OnchainProviders from '@/OnchainProviders';
-import Navbar from './Navbar';
-
-describe('Navbar', () => {
- it('mounts', async () => {
- render(
-
-
- ,
- );
-
- await waitFor(() => {
- expect(screen.getByText('Get Started')).toBeInTheDocument();
- });
- });
-});
diff --git a/src/components/layout/header/Navbar.tsx b/src/components/layout/header/Navbar.tsx
index efb7c7c4..f4f90264 100644
--- a/src/components/layout/header/Navbar.tsx
+++ b/src/components/layout/header/Navbar.tsx
@@ -1,11 +1,14 @@
'use client';
+import { useEffect, useState } from 'react';
import { clsx } from 'clsx';
import Image from 'next/image';
import NextLink from 'next/link';
import { usePathname } from 'next/navigation';
import { useTheme } from 'next-themes';
-import { FaRegMoon, FaSun } from 'react-icons/fa';
+import { FaRegMoon } from 'react-icons/fa';
+import { LuSunMedium } from 'react-icons/lu';
+
import { useAccount } from 'wagmi';
import logo from '../../imgs/logo.png';
import AccountConnect from './AccountConnect';
@@ -62,6 +65,15 @@ export function NavbarTitle() {
export function Navbar() {
const { theme, setTheme } = useTheme();
const { address } = useAccount();
+ const [mounted, setMounted] = useState(false);
+
+ useEffect(() => {
+ setMounted(true);
+ }, []);
+
+ const toggleTheme = () => {
+ setTheme(theme === 'dark' ? 'light' : 'dark');
+ };
return (
@@ -74,17 +86,16 @@ export function Navbar() {
Rewards
- {/* FAQ */}
setTheme(theme === 'dark' ? 'light' : 'dark')}
- className="hover:bg-hover flex h-10 w-10 items-center justify-center rounded-full"
+ onClick={toggleTheme}
+ className="flex h-10 w-10 items-center justify-center rounded-full"
aria-label="Toggle theme"
>
- {theme === 'dark' ? : }
+ {mounted && (theme === 'dark' ? : )}
diff --git a/src/components/layout/header/NavbarMobile.test.tsx b/src/components/layout/header/NavbarMobile.test.tsx
deleted file mode 100644
index f1398cb9..00000000
--- a/src/components/layout/header/NavbarMobile.test.tsx
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * @jest-environment jsdom
- */
-import { render, screen, waitFor } from '@testing-library/react';
-import userEvent from '@testing-library/user-event';
-import OnchainProviders from '@/OnchainProviders';
-import NavbarMobile from './NavbarMobile';
-
-describe('NavbarMobile', () => {
- it('mounts', () => {
- render(
-
-
- ,
- );
- expect(screen.getByText('BUILD ONCHAIN APPS')).toBeInTheDocument();
- });
-
- it('clicking the hamburger icon opens the navbar menu', async () => {
- render(
-
-
- ,
- );
- await userEvent.click(screen.getByRole('button'));
-
- await waitFor(() => {
- expect(screen.getByText('Get Started')).toBeInTheDocument();
- });
- });
-});
diff --git a/src/hooks/useTransactionWithToast.tsx b/src/hooks/useTransactionWithToast.tsx
index d5d841c9..2b66fa03 100644
--- a/src/hooks/useTransactionWithToast.tsx
+++ b/src/hooks/useTransactionWithToast.tsx
@@ -37,8 +37,6 @@ export function useTransactionWithToast({
hash,
});
- console.log('isConfirmed', isConfirmed, toastId, hash);
-
const onClick = useCallback(() => {
if (hash) {
// if chainId is not supported, use 1
diff --git a/src/store/createWagmiConfig.ts b/src/store/createWagmiConfig.ts
index 3e4a9b62..9380af0c 100644
--- a/src/store/createWagmiConfig.ts
+++ b/src/store/createWagmiConfig.ts
@@ -7,6 +7,8 @@ import {
safeWallet,
argentWallet,
injectedWallet,
+ trustWallet,
+ ledgerWallet,
} from '@rainbow-me/rainbowkit/wallets';
import { createConfig, http } from 'wagmi';
import { base, mainnet } from 'wagmi/chains';
@@ -27,12 +29,14 @@ export function createWagmiConfig(projectId: string) {
{
groupName: 'Other Wallets',
wallets: [
+ metaMaskWallet,
rainbowWallet,
coinbaseWallet,
- metaMaskWallet,
safeWallet,
argentWallet,
injectedWallet,
+ trustWallet,
+ ledgerWallet,
],
},
],
diff --git a/yarn.lock b/yarn.lock
index ddb43faf..bfabc1f0 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1516,21 +1516,6 @@ __metadata:
languageName: node
linkType: hard
-"@coinbase/onchainkit@npm:0.10.0":
- version: 0.10.0
- resolution: "@coinbase/onchainkit@npm:0.10.0"
- peerDependencies:
- "@tanstack/react-query": ^5
- "@xmtp/frames-validator": ^0.5.0
- graphql: ^14
- graphql-request: ^6
- react: ^18
- react-dom: ^18
- viem: ^2.7.0
- checksum: 10c0/f1b3bb3d805703c3fcb5e28821971efbaa098cd7729995ac8a8502cdec38395cbcbcac81442f8ce45a30c333ecafaaeaa368fce77ca69732f045c88ec93342e8
- languageName: node
- linkType: hard
-
"@coinbase/wallet-sdk@npm:4.0.4":
version: 4.0.4
resolution: "@coinbase/wallet-sdk@npm:4.0.4"
@@ -15227,7 +15212,6 @@ __metadata:
"@babel/preset-env": "npm:^7.23.5"
"@babel/preset-react": "npm:^7.23.3"
"@babel/preset-typescript": "npm:^7.23.3"
- "@coinbase/onchainkit": "npm:0.10.0"
"@coinbase/wallet-sdk": "npm:^3.9.1"
"@jest/globals": "npm:^29.7.0"
"@nextui-org/accordion": "npm:^2.0.35"