mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
fix: checks hydration issues
This commit is contained in:
1 parent
6e96798d5e
commit
2a32a1a7cb
3 files changed
+68
-59
No files matched your search
@@ -1,9 +1,15 @@
|
|||||||
'use client';
|
'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 { usePathname } from 'next/navigation';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { Link } from '../../components/Link';
|
|
||||||
import { extendAuth } from '../../core/blitz/extendAuth';
|
import { extendAuth } from '../../core/blitz/extendAuth';
|
||||||
import { logout } from '../../core/blitz/logout';
|
import { logout } from '../../core/blitz/logout';
|
||||||
import isDev from '../../core/blitzkit/isDev';
|
import isDev from '../../core/blitzkit/isDev';
|
||||||
@@ -20,6 +26,7 @@ export function Checks() {
|
|||||||
);
|
);
|
||||||
const pathname = usePathname();
|
const pathname = usePathname();
|
||||||
const isLegal = pathname.startsWith('/legal');
|
const isLegal = pathname.startsWith('/legal');
|
||||||
|
const [showPoliciesAgreement, setShowPoliciesAgreement] = useState(false);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setShowDevBuildAlert(
|
setShowDevBuildAlert(
|
||||||
@@ -29,6 +36,11 @@ export function Checks() {
|
|||||||
DEV_BUILD_AGREEMENT_COOLDOWN,
|
DEV_BUILD_AGREEMENT_COOLDOWN,
|
||||||
);
|
);
|
||||||
}, []);
|
}, []);
|
||||||
|
useEffect(() => {
|
||||||
|
setShowPoliciesAgreement(
|
||||||
|
policiesAgreementIndex !== CURRENT_POLICIES_AGREEMENT_INDEX && !isLegal,
|
||||||
|
);
|
||||||
|
}, [policiesAgreementIndex, isLegal]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!login) return;
|
if (!login) return;
|
||||||
@@ -72,70 +84,68 @@ export function Checks() {
|
|||||||
</AlertDialog.Content>
|
</AlertDialog.Content>
|
||||||
</AlertDialog.Root>
|
</AlertDialog.Root>
|
||||||
|
|
||||||
{policiesAgreementIndex !== CURRENT_POLICIES_AGREEMENT_INDEX &&
|
{showPoliciesAgreement && (
|
||||||
!isLegal && (
|
<Flex
|
||||||
|
align="end"
|
||||||
|
style={{
|
||||||
|
position: 'fixed',
|
||||||
|
top: 0,
|
||||||
|
left: 0,
|
||||||
|
width: '100%',
|
||||||
|
height: '100%',
|
||||||
|
background: 'var(--color-overlay)',
|
||||||
|
zIndex: 2,
|
||||||
|
}}
|
||||||
|
>
|
||||||
<Flex
|
<Flex
|
||||||
align="end"
|
p="8"
|
||||||
style={{
|
style={{
|
||||||
position: 'fixed',
|
|
||||||
top: 0,
|
|
||||||
left: 0,
|
|
||||||
width: '100%',
|
width: '100%',
|
||||||
height: '100%',
|
background: 'var(--color-panel-solid)',
|
||||||
background: 'var(--color-overlay)',
|
|
||||||
zIndex: 2,
|
|
||||||
}}
|
}}
|
||||||
|
justify="center"
|
||||||
>
|
>
|
||||||
<Flex
|
<Flex
|
||||||
p="8"
|
align="start"
|
||||||
|
gap="4"
|
||||||
style={{
|
style={{
|
||||||
width: '100%',
|
maxWidth: 640 * 2,
|
||||||
background: 'var(--color-panel-solid)',
|
|
||||||
}}
|
}}
|
||||||
justify="center"
|
direction="column"
|
||||||
>
|
>
|
||||||
<Flex
|
<Flex direction="column" gap="2">
|
||||||
align="start"
|
<Heading>
|
||||||
gap="4"
|
{policiesAgreementIndex === -1
|
||||||
style={{
|
? "BlitzKit's cookies"
|
||||||
maxWidth: 640 * 2,
|
: "BlitzKit's policies have changed"}
|
||||||
}}
|
</Heading>
|
||||||
direction="column"
|
|
||||||
>
|
|
||||||
<Flex direction="column" gap="2">
|
|
||||||
<Heading>
|
|
||||||
{policiesAgreementIndex === -1
|
|
||||||
? "BlitzKit's cookies"
|
|
||||||
: "BlitzKit's policies have changed"}
|
|
||||||
</Heading>
|
|
||||||
|
|
||||||
<Text>
|
<Text>
|
||||||
This website utilizes cookies to perform analytics and
|
This website utilizes cookies to perform analytics and
|
||||||
personalize your experience. You can learn more through{' '}
|
personalize your experience. You can learn more through{' '}
|
||||||
<Link href="/legal/privacy-policy">our privacy policy</Link>
|
<Link href="/legal/privacy-policy">our privacy policy</Link>.
|
||||||
. You may opt out of personalized advertizement by visiting{' '}
|
You may opt out of personalized advertizement by visiting{' '}
|
||||||
<Link href="https://www.google.com/settings/ads">
|
<Link href="https://www.google.com/settings/ads">
|
||||||
Google Ad Settings
|
Google Ad Settings
|
||||||
</Link>
|
</Link>
|
||||||
. By using BlitzKit, you also agree to our{' '}
|
. By using BlitzKit, you also agree to our{' '}
|
||||||
<Link href="/legal/terms-of-service">terms of service</Link>
|
<Link href="/legal/terms-of-service">terms of service</Link>.
|
||||||
.
|
</Text>
|
||||||
</Text>
|
|
||||||
</Flex>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
onClick={() => {
|
|
||||||
useApp.setState({
|
|
||||||
policiesAgreementIndex: CURRENT_POLICIES_AGREEMENT_INDEX,
|
|
||||||
});
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
I Agree
|
|
||||||
</Button>
|
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
onClick={() => {
|
||||||
|
useApp.setState({
|
||||||
|
policiesAgreementIndex: CURRENT_POLICIES_AGREEMENT_INDEX,
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
I Agree
|
||||||
|
</Button>
|
||||||
</Flex>
|
</Flex>
|
||||||
</Flex>
|
</Flex>
|
||||||
)}
|
</Flex>
|
||||||
|
)}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
+4
-6
@@ -5,9 +5,7 @@ import '@radix-ui/themes/styles.css';
|
|||||||
import { config } from 'dotenv';
|
import { config } from 'dotenv';
|
||||||
import { Roboto_Flex } from 'next/font/google';
|
import { Roboto_Flex } from 'next/font/google';
|
||||||
import { usePathname } from 'next/navigation';
|
import { usePathname } from 'next/navigation';
|
||||||
import { ReactNode, Suspense } from 'react';
|
import { ReactNode } from 'react';
|
||||||
import { Footer } from '../components/Footer';
|
|
||||||
import { Loader } from '../components/Loader';
|
|
||||||
import Navbar, { NAVBAR_HEIGHT } from '../components/Navbar';
|
import Navbar, { NAVBAR_HEIGHT } from '../components/Navbar';
|
||||||
import { Party3 } from '../components/Party3';
|
import { Party3 } from '../components/Party3';
|
||||||
import { Checks } from './components/Checks';
|
import { Checks } from './components/Checks';
|
||||||
@@ -72,7 +70,7 @@ export default function RootLayout({ children }: RootLayoutProps) {
|
|||||||
|
|
||||||
<Checks />
|
<Checks />
|
||||||
|
|
||||||
<Suspense
|
{/* <Suspense
|
||||||
fallback={
|
fallback={
|
||||||
<div style={{ flex: 1 }}>
|
<div style={{ flex: 1 }}>
|
||||||
<Loader />
|
<Loader />
|
||||||
@@ -80,9 +78,9 @@ export default function RootLayout({ children }: RootLayoutProps) {
|
|||||||
}
|
}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
</Suspense>
|
</Suspense> */}
|
||||||
|
|
||||||
{!isEmbed && <Footer />}
|
{/* {!isEmbed && <Footer />} */}
|
||||||
</Flex>
|
</Flex>
|
||||||
</Theme>
|
</Theme>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -190,6 +190,7 @@ export default function Navbar() {
|
|||||||
<Flex mt="6" gap="3" justify="center" wrap="wrap">
|
<Flex mt="6" gap="3" justify="center" wrap="wrap">
|
||||||
{TOOLS.filter((tool) => !tool.href).map((tool) => (
|
{TOOLS.filter((tool) => !tool.href).map((tool) => (
|
||||||
<Link
|
<Link
|
||||||
|
key={tool.id}
|
||||||
href={tool.href ?? `/tools/${tool.id}`}
|
href={tool.href ?? `/tools/${tool.id}`}
|
||||||
target={tool.href ? '_blank' : undefined}
|
target={tool.href ? '_blank' : undefined}
|
||||||
className={styles.toolCard}
|
className={styles.toolCard}
|
||||||
|
|||||||
Reference in new issue
Block a user