From e9c78a788066d8b9fa04cc00301f682c80b13711 Mon Sep 17 00:00:00 2001 From: Majorfi Date: Tue, 13 Feb 2024 12:03:27 +0100 Subject: [PATCH] build: bump --- package.json | 2 +- src/components/LogoPopover.tsx | 47 +++++++++++++++------------------- 2 files changed, 22 insertions(+), 27 deletions(-) diff --git a/package.json b/package.json index 02c2cd13..b0cdd860 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@yearn-finance/web-lib", - "version": "3.0.167", + "version": "3.0.168", "main": "./dist/index.js", "types": "./dist/index.d.js", "files": [ diff --git a/src/components/LogoPopover.tsx b/src/components/LogoPopover.tsx index 1b4cf5cc..20529be6 100644 --- a/src/components/LogoPopover.tsx +++ b/src/components/LogoPopover.tsx @@ -39,29 +39,7 @@ function MotionDiv({animate, name, children}: TMotionDiv): ReactElement { ); } -function Logo(): ReactElement { - const pathname = usePathname(); - const currentHost = useMemo(() => { - if (typeof window === 'undefined') { - return 'yearn.fi'; - } - return window.location.host; - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [typeof window, pathname]); - - const isVaultPage = useMemo(() => { - if (typeof window === 'undefined') { - return false; - } - - const isVaultPage = - typeof window !== 'undefined' && - window.location.pathname.startsWith('/vaults/') && - window.location.pathname.split('/').length === 4; - return isVaultPage; - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [typeof window, pathname]); - +function Logo({currentHost, isVaultPage}: {currentHost: string; isVaultPage: boolean}): ReactElement { return ( <> {Object.values(APPS).map(({name, host, icon}): ReactElement => { @@ -88,6 +66,7 @@ function Logo(): ReactElement { export function LogoPopover(): ReactElement { const [isShowing, set_isShowing] = useState(false); const isMounted = useIsMounted(); + const pathname = usePathname(); const currentHost = useMemo(() => { if (typeof window === 'undefined') { @@ -103,6 +82,19 @@ export function LogoPopover(): ReactElement { }); }, [currentHost]); + const isVaultPage = useMemo(() => { + if (typeof window === 'undefined') { + return false; + } + + const isVaultPage = + typeof window !== 'undefined' && + window.location.pathname.startsWith('/vaults/') && + window.location.pathname.split('/').length === 4; + return isVaultPage; + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [typeof window, pathname]); + return ( <> - + {'Back to home'} - + @@ -135,7 +130,7 @@ export function LogoPopover(): ReactElement { className={'relative z-[9999999]'}> -
+