created a new branch with alert functionality and added the compose files etc ..
This commit is contained in:
@@ -1,16 +1,18 @@
|
||||
'use client';
|
||||
|
||||
import { useWeb3Modal } from '@web3modal/wagmi/react';
|
||||
import { useAccount, useDisconnect } from 'wagmi';
|
||||
import { useAccount } from 'wagmi';
|
||||
import { formatAddress } from '@/utils/format';
|
||||
|
||||
export function ConnectButton() {
|
||||
const { open } = useWeb3Modal();
|
||||
const { address, isConnected } = useAccount();
|
||||
const { disconnect } = useDisconnect();
|
||||
|
||||
const handleConnect = () => {
|
||||
open();
|
||||
try {
|
||||
// Minimal connect without WalletConnect modal
|
||||
if (typeof window !== 'undefined' && (window as any).ethereum?.request) {
|
||||
(window as any).ethereum.request({ method: 'eth_requestAccounts' });
|
||||
}
|
||||
} catch {}
|
||||
};
|
||||
|
||||
if (isConnected && address) {
|
||||
@@ -19,12 +21,7 @@ export function ConnectButton() {
|
||||
<span className="text-sm font-medium text-gray-700">
|
||||
{formatAddress(address)}
|
||||
</span>
|
||||
<button
|
||||
onClick={() => disconnect()}
|
||||
className="inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-red-600 hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500"
|
||||
>
|
||||
Disconnect
|
||||
</button>
|
||||
{/* Disconnect can be done from the wallet UI; no WalletConnect here */}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user