From 2a32a1a7cb3c1002ea5a5a466f5ca47f48afe8cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Thu, 23 May 2024 13:14:45 -0500 Subject: [PATCH] fix: checks hydration issues --- src/app/components/Checks.tsx | 116 +++++++++++++++++--------------- src/app/layout.tsx | 10 ++- src/components/Navbar/index.tsx | 1 + 3 files changed, 68 insertions(+), 59 deletions(-) diff --git a/src/app/components/Checks.tsx b/src/app/components/Checks.tsx index 6312ccfd1..7893adef0 100644 --- a/src/app/components/Checks.tsx +++ b/src/app/components/Checks.tsx @@ -1,9 +1,15 @@ 'use client'; -import { AlertDialog, Button, Flex, Heading, Text } from '@radix-ui/themes'; +import { + AlertDialog, + Button, + Flex, + Heading, + Link, + Text, +} from '@radix-ui/themes'; import { usePathname } from 'next/navigation'; import { useEffect, useState } from 'react'; -import { Link } from '../../components/Link'; import { extendAuth } from '../../core/blitz/extendAuth'; import { logout } from '../../core/blitz/logout'; import isDev from '../../core/blitzkit/isDev'; @@ -20,6 +26,7 @@ export function Checks() { ); const pathname = usePathname(); const isLegal = pathname.startsWith('/legal'); + const [showPoliciesAgreement, setShowPoliciesAgreement] = useState(false); useEffect(() => { setShowDevBuildAlert( @@ -29,6 +36,11 @@ export function Checks() { DEV_BUILD_AGREEMENT_COOLDOWN, ); }, []); + useEffect(() => { + setShowPoliciesAgreement( + policiesAgreementIndex !== CURRENT_POLICIES_AGREEMENT_INDEX && !isLegal, + ); + }, [policiesAgreementIndex, isLegal]); useEffect(() => { if (!login) return; @@ -72,70 +84,68 @@ export function Checks() { - {policiesAgreementIndex !== CURRENT_POLICIES_AGREEMENT_INDEX && - !isLegal && ( + {showPoliciesAgreement && ( + - - - - {policiesAgreementIndex === -1 - ? "BlitzKit's cookies" - : "BlitzKit's policies have changed"} - + + + {policiesAgreementIndex === -1 + ? "BlitzKit's cookies" + : "BlitzKit's policies have changed"} + - - This website utilizes cookies to perform analytics and - personalize your experience. You can learn more through{' '} - our privacy policy - . You may opt out of personalized advertizement by visiting{' '} - - Google Ad Settings - - . By using BlitzKit, you also agree to our{' '} - terms of service - . - - - - + + This website utilizes cookies to perform analytics and + personalize your experience. You can learn more through{' '} + our privacy policy. + You may opt out of personalized advertizement by visiting{' '} + + Google Ad Settings + + . By using BlitzKit, you also agree to our{' '} + terms of service. + + + - )} + + )} ); } diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 3de77ed76..8e233f8b7 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -5,9 +5,7 @@ import '@radix-ui/themes/styles.css'; import { config } from 'dotenv'; import { Roboto_Flex } from 'next/font/google'; import { usePathname } from 'next/navigation'; -import { ReactNode, Suspense } from 'react'; -import { Footer } from '../components/Footer'; -import { Loader } from '../components/Loader'; +import { ReactNode } from 'react'; import Navbar, { NAVBAR_HEIGHT } from '../components/Navbar'; import { Party3 } from '../components/Party3'; import { Checks } from './components/Checks'; @@ -72,7 +70,7 @@ export default function RootLayout({ children }: RootLayoutProps) { - @@ -80,9 +78,9 @@ export default function RootLayout({ children }: RootLayoutProps) { } > {children} - + */} - {!isEmbed &&