Skip to content

Commit

Permalink
latest
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobHomanics committed May 23, 2024
1 parent c557339 commit 443d324
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 47 deletions.
89 changes: 46 additions & 43 deletions packages/nextjs/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,54 +98,57 @@ export const Header = () => {
useCallback(() => setIsDrawerOpen(false), []),
);

const [output, setOutput] = useState<any>();
// const [output, setOutput] = useState<any>();

useEffect(() => {
if (location?.pathname !== "/")
setOutput(
<div className="sticky lg:static top-0 navbar bg-base-100 min-h-0 flex-shrink-0 justify-between z-20 shadow-md shadow-secondary px-0 sm:px-2">
<div className="navbar-start w-auto lg:w-1/2">
<div className="lg:hidden dropdown" ref={burgerMenuRef}>
<label
let output;

const pathname = usePathname();
if (pathname !== "/") {
output = (
<div className="sticky lg:static top-0 navbar bg-base-100 min-h-0 flex-shrink-0 justify-between z-20 shadow-md shadow-secondary px-0 sm:px-2">
<div className="navbar-start w-auto lg:w-1/2">
<div className="lg:hidden dropdown" ref={burgerMenuRef}>
<label
tabIndex={0}
className={`ml-1 btn btn-ghost ${isDrawerOpen ? "hover:bg-secondary" : "hover:bg-transparent"}`}
onClick={() => {
setIsDrawerOpen(prevIsOpenState => !prevIsOpenState);
}}
>
<Bars3Icon className="h-1/2" />
</label>
{isDrawerOpen && (
<ul
tabIndex={0}
className={`ml-1 btn btn-ghost ${isDrawerOpen ? "hover:bg-secondary" : "hover:bg-transparent"}`}
className="menu menu-compact dropdown-content mt-3 p-2 shadow bg-base-100 rounded-box w-52"
onClick={() => {
setIsDrawerOpen(prevIsOpenState => !prevIsOpenState);
setIsDrawerOpen(false);
}}
>
<Bars3Icon className="h-1/2" />
</label>
{isDrawerOpen && (
<ul
tabIndex={0}
className="menu menu-compact dropdown-content mt-3 p-2 shadow bg-base-100 rounded-box w-52"
onClick={() => {
setIsDrawerOpen(false);
}}
>
<HeaderMenuLinks menuLinks={instancedHeaderLinks} />
</ul>
)}
</div>
<Link href="/" passHref className="hidden lg:flex items-center gap-2 ml-4 mr-6 shrink-0">
<div className="flex relative w-10 h-10">
<Image alt="SE2 logo" className="cursor-pointer" fill src="/logo.svg" />
</div>
<div className="flex flex-col">
<span className="font-bold leading-tight">Ladders.Vision</span>
<span className="text-xs">NFT dev stack</span>
</div>
</Link>
<ul className="hidden lg:flex lg:flex-nowrap menu menu-horizontal px-1 gap-2">
<HeaderMenuLinks menuLinks={instancedHeaderLinks} />
</ul>
<HeaderMenuLinks menuLinks={instancedHeaderLinks} />
</ul>
)}
</div>
<div className="navbar-end flex-grow mr-4">
<RainbowKitCustomConnectButton2 />
{/*<FaucetButton /> */}
</div>
</div>,
);
}, []);
<Link href="/" passHref className="hidden lg:flex items-center gap-2 ml-4 mr-6 shrink-0">
<div className="flex relative w-10 h-10">
<Image alt="SE2 logo" className="cursor-pointer" fill src="/logo.svg" />
</div>
<div className="flex flex-col">
<span className="font-bold leading-tight">Ladders.Vision</span>
<span className="text-xs">NFT dev stack</span>
</div>
</Link>
<ul className="hidden lg:flex lg:flex-nowrap menu menu-horizontal px-1 gap-2">
<HeaderMenuLinks menuLinks={instancedHeaderLinks} />
</ul>
</div>
<div className="navbar-end flex-grow mr-4">
<RainbowKitCustomConnectButton2 />
{/*<FaucetButton /> */}
</div>
</div>
);
}

return <>{output}</>;
};
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@ export const RainbowKitCustomConnectButton2 = () => {
<ConnectButton.Custom>
{({ account, chain, openConnectModal, mounted }) => {
const connected = mounted && account && chain;
const blockExplorerAddressLink = account
? getBlockExplorerAddressLink(targetNetwork2!, account.address)
: undefined;
const blockExplorerAddressLink =
account && targetNetwork2 ? getBlockExplorerAddressLink(targetNetwork2, account.address) : undefined;

return (
<>
Expand All @@ -42,7 +41,7 @@ export const RainbowKitCustomConnectButton2 = () => {
);
}

if (chain.id !== targetNetwork2!.id) {
if (chain.id !== targetNetwork2?.id) {
return <WrongNetworkDropdown />;
}

Expand Down

0 comments on commit 443d324

Please sign in to comment.