Skip to content

Commit

Permalink
build: bump
Browse files Browse the repository at this point in the history
  • Loading branch information
Majorfi committed Feb 9, 2024
1 parent 3eeeeb4 commit 5f2e309
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@yearn-finance/web-lib",
"version": "3.0.137",
"version": "3.0.139",
"main": "./dist/index.js",
"types": "./dist/index.d.js",
"files": [
Expand Down
34 changes: 27 additions & 7 deletions src/components/LogoPopover.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {cloneElement, useMemo, useState} from 'react';
import Link from 'next/link';
import {useRouter} from 'next/router';
import {motion} from 'framer-motion';
import {cl} from '@builtbymom/web3/utils';
import {Popover, Transition} from '@headlessui/react';
Expand Down Expand Up @@ -38,8 +37,6 @@ function MotionDiv({animate, name, children}: TMotionDiv): ReactElement {
}

function Logo(): ReactElement {
const {pathname} = useRouter();

const currentHost = useMemo(() => {
if (typeof window === 'undefined') {
return 'yearn.fi';
Expand All @@ -48,6 +45,14 @@ function Logo(): ReactElement {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [typeof window]);

const pathname = useMemo(() => {
if (typeof window === 'undefined') {
return '/';
}
return window.location.pathname;
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [typeof window]);

const isYearnFi = useMemo(() => {
return currentHost === 'yearn.fi' || currentHost.includes('localhost:');
}, [currentHost]);
Expand Down Expand Up @@ -80,12 +85,27 @@ function Logo(): ReactElement {

export function LogoPopover(): ReactElement {
const [isShowing, set_isShowing] = useState(false);
const router = useRouter();

const currentHost = useMemo(() => {
if (typeof window === 'undefined') {
return 'yearn.fi';
}
return window.location.host;
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [typeof window]);

const isYearnFi = useMemo(() => {
return currentHost === 'yearn.fi' || currentHost.includes('localhost:');
}, [currentHost]);

const currentApp = useMemo(() => {
const pageURI = router.pathname.toLowerCase();
return Object.values(APPS).find(({host}): boolean => pageURI.includes(host)) || APPS.Vaults;
}, [router]);
return Object.values(APPS).find(({host}): boolean => {
if (isYearnFi) {
return window.location.pathname.includes(host);
}
return currentHost.includes(host);
});
}, [currentHost, isYearnFi]);

return (
<>
Expand Down

0 comments on commit 5f2e309

Please sign in to comment.