diff --git a/src/app/components/PatreonPlug.tsx b/src/app/components/PatreonPlug.tsx deleted file mode 100644 index e6d29813e..000000000 --- a/src/app/components/PatreonPlug.tsx +++ /dev/null @@ -1,53 +0,0 @@ -'use client'; - -import { CheckIcon } from '@radix-ui/react-icons'; -import { Button, Flex, Link, Text } from '@radix-ui/themes'; -import { useLayoutEffect, useState } from 'react'; -import { patreonLoginUrl } from '../../core/blitzkit/patreonLoginUrl'; -import { useAdExempt } from '../../hooks/useAdExempt'; -import { PatreonIcon } from '../../icons/Patreon'; -import * as App from '../../stores/app'; - -export function PatreonPlug() { - const [hasPatreon, setHasPatreon] = useState(false); - const exempt = useAdExempt(); - const patreon = App.use((state) => state.logins.patreon); - - useLayoutEffect(() => { - setHasPatreon(patreon !== undefined); - }, [patreon]); - - return ( - - - - {exempt - ? 'You are supporting BlitzKit, thank you!' - : 'Active Patreon supports go ad-free'} - - {!exempt && } - - - - - - - {!hasPatreon && !exempt && ( - - - - )} - - - ); -} diff --git a/src/app/components/Plugs.tsx b/src/app/components/Plugs.tsx new file mode 100644 index 000000000..053dfa1b3 --- /dev/null +++ b/src/app/components/Plugs.tsx @@ -0,0 +1,88 @@ +'use client'; + +import { ArrowRightIcon } from '@radix-ui/react-icons'; +import { + Badge, + Button, + Code, + Flex, + Link, + Separator, + Text, +} from '@radix-ui/themes'; +import { useLayoutEffect, useState } from 'react'; +import { patreonLoginUrl } from '../../core/blitzkit/patreonLoginUrl'; +import { assertSecret } from '../../core/blitzkit/secret'; +import { useAdExempt } from '../../hooks/useAdExempt'; +import { PatreonIcon } from '../../icons/Patreon'; +import * as App from '../../stores/app'; + +export function Plugs() { + const [hasPatreon, setHasPatreon] = useState(false); + const exempt = useAdExempt(); + const patreon = App.use((state) => state.logins.patreon); + + useLayoutEffect(() => { + setHasPatreon(patreon !== undefined); + }, [patreon]); + + return ( + + {assertSecret(process.env.NEXT_PUBLIC_PROMOTE_OPENTEST) === 'true' && ( + <> + + + NEW + + BlitzKit{' '} + + opentest + {' '} + is available now{' '} + + + + + + + + + + + )} + + + + + {exempt + ? 'You are supporting BlitzKit, thank you!' + : 'Active Patreon supports go ad-free'} + + + + + + + + {!hasPatreon && !exempt && ( + + + + )} + + + + ); +} diff --git a/src/app/page.tsx b/src/app/page.tsx index bf9c2044d..1906797ad 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -13,7 +13,7 @@ import { } from '../constants/tools'; import { useAdExempt } from '../hooks/useAdExempt'; import { Hero } from './components/Hero'; -import { PatreonPlug } from './components/PatreonPlug'; +import { Plugs } from './components/Plugs'; import { ToolCard } from './components/ToolCard'; export default function Page() { @@ -23,7 +23,7 @@ export default function Page() { <> - +