mirror of
https://github.com/0xShay/ticketchain.git
synced 2026-01-11 13:13:25 +00:00
🐛 FINALLY fixed the Metamask connection button!!!
This commit is contained in:
@@ -1,6 +1,13 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
|
import { WalletIcon } from 'lucide-react';
|
||||||
|
import { Button } from '@/components/ui/button';
|
||||||
|
import {
|
||||||
|
Popover,
|
||||||
|
PopoverContent,
|
||||||
|
PopoverTrigger,
|
||||||
|
} from '@/components/ui/popover';
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
interface Window {
|
interface Window {
|
||||||
@@ -88,24 +95,29 @@ function MetaMaskConnect() {
|
|||||||
return (
|
return (
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
{isConnected ? (
|
{isConnected ? (
|
||||||
<div>
|
<Popover>
|
||||||
<button
|
<PopoverTrigger asChild>
|
||||||
|
<Button variant="link" className="text-white">
|
||||||
|
{account && `${account.slice(0, 6)}...${account.slice(-4)}`}
|
||||||
|
</Button>
|
||||||
|
</PopoverTrigger>
|
||||||
|
<PopoverContent className="w-44">
|
||||||
|
<Button
|
||||||
|
variant="destructive"
|
||||||
onClick={disconnect}
|
onClick={disconnect}
|
||||||
className="bg-red-500 text-white px-4 py-2 rounded"
|
className="w-full px-4 py-2 text-left hover:bg-muted hover:text-destructive"
|
||||||
>
|
>
|
||||||
Disconnect
|
Disconnect
|
||||||
</button>
|
</Button>
|
||||||
<span>
|
</PopoverContent>
|
||||||
{account && `${account.slice(0, 6)}...${account.slice(-4)}`}
|
</Popover>
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
) : (
|
) : (
|
||||||
<button
|
<Button
|
||||||
onClick={connect}
|
onClick={connect}
|
||||||
className="bg-blue-500 text-white px-4 py-2 rounded"
|
className="bg-light-purple bg-opacity-75 hover:bg-purple border-0 hover:border-0"
|
||||||
>
|
>
|
||||||
Connect Wallet
|
<WalletIcon className="mr-2 h-4 w-4" /> Connect Wallet
|
||||||
</button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user