/ src / components / AuthButton.tsx
AuthButton.tsx
 1  import React from 'react';
 2  import { useWeb3Modal } from '@web3modal/wagmi/react';
 3  import { useAccount } from 'wagmi';
 4  import { Button } from './Button';
 5  
 6  interface AuthButtonProps {
 7    onAuthClick: () => void;
 8  }
 9  
10  const AuthButton: React.FC<AuthButtonProps> = ({ onAuthClick }) => {
11    const { open } = useWeb3Modal();
12    const { isConnected } = useAccount();
13  
14    const handleClick = () => {
15      if (isConnected) {
16        onAuthClick();
17      } else {
18        open();
19      }
20    };
21  
22    return (
23      <Button
24        label={isConnected ? 'Start' : 'Connect Wallet'} // Updated label
25        onClick={handleClick}
26        fullWidth
27      />
28    );
29  };
30  
31  export default AuthButton;