Files
blitzkit/packages/website/src/components/Plugs.tsx
T

77 lines
2.3 KiB
TypeScript
Raw Normal View History

2024-09-06 21:45:58 -05:00
import { assertSecret, patreonLoginUrl } from '@blitzkit/core';
2024-09-01 20:53:44 -05:00
import { ArrowRightIcon } from '@radix-ui/react-icons';
2024-10-13 00:26:38 -05:00
import { Button, Code, Flex, Link, Separator, Text } from '@radix-ui/themes';
2024-09-14 18:32:36 -05:00
import { useAdExempt } from '../hooks/useAdExempt';
2024-10-09 21:04:49 -05:00
import { App } from '../stores/app';
2024-09-14 18:32:36 -05:00
import { PatreonIcon } from './PatreonIcon';
2024-09-01 20:53:44 -05:00
export function Plugs() {
2024-10-09 21:04:49 -05:00
return (
<App.Provider>
<Content />
</App.Provider>
);
}
function Content() {
2024-09-01 20:53:44 -05:00
const exempt = useAdExempt();
2024-10-09 21:04:49 -05:00
const hasPatreon = App.use((state) => state.logins.patreon !== undefined);
2024-09-01 20:53:44 -05:00
return (
<Flex
align="center"
direction="column"
justify="center"
px="4"
py="8"
gap="6"
>
2024-09-17 22:50:34 -05:00
{assertSecret(import.meta.env.PUBLIC_PROMOTE_OPENTEST) === 'true' &&
assertSecret(import.meta.env.PUBLIC_ASSET_BRANCH) !== 'opentest' && (
2024-09-04 22:16:31 -05:00
<>
<Flex direction="column" gap="3" align="center">
2024-10-13 00:26:38 -05:00
<Text size="5">
BlitzKit{' '}
<Code variant="outline" size="4" color="gray" highContrast>
opentest
</Code>{' '}
is available now{' '}
</Text>
2024-09-04 22:16:31 -05:00
<Link href="https://opentest.blitzkit.app/" target="_blank">
<Button color="green">
BlitzKit opentest <ArrowRightIcon />
</Button>
</Link>
2024-09-01 20:53:44 -05:00
</Flex>
2024-09-04 22:16:31 -05:00
<Separator size="3" />
</>
)}
2024-09-01 20:53:44 -05:00
<Flex direction="column" gap="3" align="center">
<Flex gap="1" align="center">
<Text size="4" align="center">
{exempt
? 'You are supporting BlitzKit, thank you!'
: 'Active Patreon supports go ad-free'}
</Text>
</Flex>
<Flex gap="2" wrap="wrap" justify="center">
<Link href="https://www.patreon.com/tresabhi" target="_blank">
<Button>
<PatreonIcon width={15} height={15} />{' '}
{exempt ? 'Manage membership' : 'Support on Patreon'}
</Button>
</Link>
{!hasPatreon && !exempt && (
<Link href={patreonLoginUrl()}>
<Button variant="outline">Log in with Patreon</Button>
</Link>
)}
</Flex>
</Flex>
</Flex>
);
}