From 9d714929f5bab712e7771a613694abe9fe9e6f0e Mon Sep 17 00:00:00 2001 From: Tom Quirk <12551741+tomquirk@users.noreply.github.com> Date: Sat, 17 Feb 2024 14:03:15 +1000 Subject: [PATCH] fix: mobile accept legal notice (#4251) --- package.json | 2 +- src/components/Navbar/SiteNavigation.tsx | 162 +++++++++--------- .../Navbar/components/HamburgerMenuButton.tsx | 4 +- .../Navbar/components/Wallet/WalletButton.tsx | 29 +++- .../common/CoreAppWrapper/CoreAppWrapper.tsx | 2 +- src/components/modals/LegalNoticeModal.tsx | 21 +-- .../CyclesPayoutsPanel.test.tsx.snap | 2 + yarn.lock | 21 ++- 8 files changed, 127 insertions(+), 116 deletions(-) diff --git a/package.json b/package.json index efc269efb8..5a8fef657e 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,7 @@ "dependencies": { "@apollo/client": "3.6.9", "@graphql-codegen/add": "^4.0.1", - "@headlessui/react": "^1.7.10", + "@headlessui/react": "^1.7.18", "@heroicons/react": "^2.0.17", "@jbx-protocol/contracts-v1": "2.0.0", "@jbx-protocol/contracts-v2-4.0.0": "npm:@jbx-protocol/contracts-v2@4.0.0", diff --git a/src/components/Navbar/SiteNavigation.tsx b/src/components/Navbar/SiteNavigation.tsx index 6f6c400618..e643fc11b9 100644 --- a/src/components/Navbar/SiteNavigation.tsx +++ b/src/components/Navbar/SiteNavigation.tsx @@ -3,30 +3,32 @@ import { Trans, t } from '@lingui/macro' import { QuickProjectSearchButton } from 'components/QuickProjectSearch/QuickProjectSearchButton' import { TruncatedText } from 'components/TruncatedText' import PatchedNextLink from 'components/fixes/PatchedNextLink' -import { Fragment } from 'react' +import useMobile from 'hooks/useMobile' +import { Fragment, useEffect, useState } from 'react' import { DropdownMenu } from './components/DropdownMenu' import { MobileMenuButton } from './components/HamburgerMenuButton' import { LogoHomeButton } from './components/LogoHomeButton' import NavLanguageSelector from './components/NavLanguageSelector' import ThemePicker from './components/ThemePicker' import { TransactionsList } from './components/TransactionList/TransactionsList' -import WalletButton from './components/Wallet/WalletButton' +import { WalletButton } from './components/Wallet/WalletButton' -export default function SiteNavigation() { - return ( - <> -
- -
-
- -
- - ) +export function SiteNavigation() { + const [hasMounted, setHasMounted] = useState(false) + const isMobile = useMobile() + + useEffect(() => { + setHasMounted(true) + }, []) + + if (!hasMounted) { + return null + } + + return isMobile ? : } const DesktopSiteNavigation = () => { - const isMobile = false return (