🔀 Merge pull request #17 from Ayush272002/sid-visual-fixes

🐛 Fixed some bugs and enhanced frontend.
This commit is contained in:
Sid
2024-10-26 16:31:54 +01:00
committed by GitHub
3 changed files with 27 additions and 135 deletions

View File

@@ -35,26 +35,37 @@ const Header = () => {
}}
></div>
<div className="container mx-auto px-6 py-4 flex justify-between items-center">
<h1 className="text-2xl font-semibold text-white">TicketChain</h1>
<Link href="/" legacyBehavior>
<a className="text-2xl font-semibold text-white">TicketChain</a>
</Link>
<nav className="nav">
<ul className="flex space-x-6">
<li>
<Link href="/" legacyBehavior>
<a className="text-white hover:text-blue-500 transition-colors duration-300">
<a
className="text-white hover:text-blue-500 transition-colors duration-300"
style={{ textShadow: '1px 1px 2px rgba(0, 0, 0, 0.5)' }}
>
Home
</a>
</Link>
</li>
<li>
<Link href="/events" legacyBehavior>
<a className="text-white hover:text-blue-500 transition-colors duration-300">
<a
className="text-white hover:text-blue-500 transition-colors duration-300"
style={{ textShadow: '1px 1px 2px rgba(0, 0, 0, 0.5)' }}
>
Events
</a>
</Link>
</li>
<li>
<Link href="/contact" legacyBehavior>
<a className="text-white hover:text-blue-500 transition-colors duration-300">
<a
className="text-white hover:text-blue-500 transition-colors duration-300"
style={{ textShadow: '1px 1px 2px rgba(0, 0, 0, 0.5)' }}
>
Contact
</a>
</Link>

View File

@@ -37,20 +37,16 @@ function formatAddress(address: string | undefined): string {
function MetaMaskConnect() {
const { sdk, connected, connecting, account } = useSDK();
const [metaMaskInstalled, setMetaMaskInstalled] = useState(false);
const isMetaMaskInstalled = () =>
typeof window !== 'undefined' && typeof window.ethereum !== 'undefined';
const [isConnected, setIsConnected] = useState(false);
useEffect(() => {
if (isMetaMaskInstalled()) {
setMetaMaskInstalled(true);
}
}, []);
setIsConnected(connected);
}, [connected]);
const connect = async () => {
try {
await sdk?.connect();
setIsConnected(true);
} catch (err) {
console.warn(`No accounts found`, err);
}
@@ -59,36 +55,25 @@ function MetaMaskConnect() {
const disconnect = () => {
if (sdk) {
sdk.terminate();
setIsConnected(false);
}
};
if (!metaMaskInstalled) {
return (
<Button
onClick={() =>
window.open('https://metamask.io/download.html', '_blank')
}
className="bg-gradient-to-r from-blue-500 to-indigo-700"
>
Install MetaMask
</Button>
);
}
return (
<div className="relative">
{connected ? (
{isConnected ? (
<Popover>
<PopoverTrigger asChild>
<Button>{formatAddress(account)}</Button>
</PopoverTrigger>
<PopoverContent className="w-44">
<button
<Button
variant="destructive"
onClick={disconnect}
className="w-full px-4 py-2 text-left text-destructive hover:bg-muted"
className="w-full px-4 py-2 text-left hover:bg-muted hover:text-destructive"
>
Disconnect
</button>
</Button>
</PopoverContent>
</Popover>
) : (

108
package-lock.json generated
View File

@@ -4976,7 +4976,6 @@
"cpu": [
"x64"
],
"license": "MIT",
"optional": true,
"os": [
"win32"
@@ -13017,6 +13016,7 @@
"resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.5.tgz",
"integrity": "sha512-HTm14iMQKK2FjFLRTM5lAVcyaUzOnqbPtesFIvREgXpJHdQm8bWS+GkQgIkfaBYRHuCnea7w8UVNfwiAQhlr9A==",
"dev": true,
"hasInstallScript": true,
"optional": true,
"dependencies": {
"node-gyp-build": "^4.3.0"
@@ -13379,6 +13379,7 @@
"resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.7.tgz",
"integrity": "sha512-vLt1O5Pp+flcArHGIyKEQq883nBt8nN8tVBcoL0qUXj2XT1n7p70yGIq2VK98I5FdZ1YHc0wk/koOnHjnXWk1Q==",
"dev": true,
"hasInstallScript": true,
"optional": true,
"dependencies": {
"node-gyp-build": "^4.3.0"
@@ -24012,111 +24013,6 @@
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/@next/swc-darwin-arm64": {
"version": "14.2.13",
"resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-14.2.13.tgz",
"integrity": "sha512-IkAmQEa2Htq+wHACBxOsslt+jMoV3msvxCn0WFSfJSkv/scy+i/EukBKNad36grRxywaXUYJc9mxEGkeIs8Bzg==",
"cpu": [
"arm64"
],
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": ">= 10"
}
},
"node_modules/@next/swc-darwin-x64": {
"version": "14.2.13",
"resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-14.2.13.tgz",
"integrity": "sha512-Dv1RBGs2TTjkwEnFMVL5XIfJEavnLqqwYSD6LXgTPdEy/u6FlSrLBSSfe1pcfqhFEXRAgVL3Wpjibe5wXJzWog==",
"cpu": [
"x64"
],
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": ">= 10"
}
},
"node_modules/@next/swc-linux-arm64-gnu": {
"version": "14.2.13",
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-14.2.13.tgz",
"integrity": "sha512-yB1tYEFFqo4ZNWkwrJultbsw7NPAAxlPXURXioRl9SdW6aIefOLS+0TEsKrWBtbJ9moTDgU3HRILL6QBQnMevg==",
"cpu": [
"arm64"
],
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">= 10"
}
},
"node_modules/@next/swc-linux-arm64-musl": {
"version": "14.2.13",
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-14.2.13.tgz",
"integrity": "sha512-v5jZ/FV/eHGoWhMKYrsAweQ7CWb8xsWGM/8m1mwwZQ/sutJjoFaXchwK4pX8NqwImILEvQmZWyb8pPTcP7htWg==",
"cpu": [
"arm64"
],
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">= 10"
}
},
"node_modules/@next/swc-win32-arm64-msvc": {
"version": "14.2.13",
"resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-14.2.13.tgz",
"integrity": "sha512-uP1XkqCqV2NVH9+g2sC7qIw+w2tRbcMiXFEbMihkQ8B1+V6m28sshBwAB0SDmOe0u44ne1vFU66+gx/28RsBVQ==",
"cpu": [
"arm64"
],
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">= 10"
}
},
"node_modules/@next/swc-win32-ia32-msvc": {
"version": "14.2.13",
"resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-14.2.13.tgz",
"integrity": "sha512-V26ezyjPqQpDBV4lcWIh8B/QICQ4v+M5Bo9ykLN+sqeKKBxJVDpEc6biDVyluTXTC40f5IqCU0ttth7Es2ZuMw==",
"cpu": [
"ia32"
],
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">= 10"
}
},
"node_modules/@next/swc-win32-x64-msvc": {
"version": "14.2.13",
"resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-14.2.13.tgz",
"integrity": "sha512-WwzOEAFBGhlDHE5Z73mNU8CO8mqMNLqaG+AO9ETmzdCQlJhVtWZnOl2+rqgVQS+YHunjOWptdFmNfbpwcUuEsw==",
"cpu": [
"x64"
],
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">= 10"
}
}
}
}