Files
blitzkit/packages/website/src/pages/tools/embed/_index.tsx
T

110 lines
3.2 KiB
TypeScript
Raw Normal View History

2024-10-28 10:57:42 -05:00
import { imgur, ImgurSize } from '@blitzkit/core';
2024-11-08 10:34:52 -06:00
import { Box, Flex, Link, Text } from '@radix-ui/themes';
2024-10-28 10:57:42 -05:00
import { capitalize } from 'lodash-es';
import { PreviewWrapper } from '../../../components/Embeds/PreviewWrapper';
import { PageWrapper } from '../../../components/PageWrapper';
import {
embedConfigurations,
extractEmbedConfigDefaults,
} from '../../../constants/embeds';
import { Var } from '../../../core/radix/var';
2024-11-01 10:30:36 -05:00
import { App } from '../../../stores/app';
2024-10-28 10:57:42 -05:00
import { EmbedState } from '../../../stores/embedState';
export function Page() {
return (
2024-11-01 10:30:36 -05:00
<App.Provider>
<Content />
</App.Provider>
);
}
2024-10-28 10:57:42 -05:00
2024-11-01 10:30:36 -05:00
function Content() {
2024-11-08 10:34:52 -06:00
// const wargaming = App.useDeferred((state) => state.logins.wargaming, {
// token: '',
// id: 0,
// expires: 0,
// });
2024-11-01 10:30:36 -05:00
return (
<PageWrapper color="red">
2024-11-08 10:34:52 -06:00
{/* {!wargaming && (
2024-11-01 10:30:36 -05:00
<Flex direction="column" align="center" gap="2">
<Callout.Root>
<Callout.Icon>
<ExclamationTriangleIcon />
</Callout.Icon>
<Callout.Text>
<Flex align="center">You must log in to generate embeds.</Flex>
</Callout.Text>
</Callout.Root>
<WargamingLoginButton>Log in with Wargaming</WargamingLoginButton>
</Flex>
2024-11-08 10:34:52 -06:00
)} */}
2024-11-01 10:30:36 -05:00
<Text align="center" mt="3">
More embeds coming soon.{' '}
<Link
underline="always"
href="https://discord.gg/nDt7AjGJQH"
target="_blank"
>
Suggest ideas
</Link>
.
</Text>
<Flex justify="center">
{Object.entries(embedConfigurations).map(([embed, config]) => (
<EmbedState.Provider
key={embed}
data={extractEmbedConfigDefaults(config)}
>
<Link
href={`/tools/embed/${embed}`}
color="gray"
highContrast
style={{
width: 'fit-content',
height: 'fit-content',
}}
underline="hover"
>
<Flex
direction="column"
2024-10-28 10:57:42 -05:00
overflow="hidden"
style={{
2024-11-01 10:30:36 -05:00
borderRadius: Var('radius-4'),
backgroundColor: Var('color-panel-solid'),
boxShadow: Var('shadow-3'),
2024-10-28 10:57:42 -05:00
}}
>
2024-11-01 10:30:36 -05:00
<Flex justify="center" p="2">
<Text>{capitalize(embed)}</Text>
</Flex>
<Box
width="20rem"
height="20rem"
overflow="hidden"
position="relative"
style={{
backgroundImage: `url(${imgur('SO13zur', { format: 'jpeg', size: ImgurSize.SmallThumbnail })})`,
backgroundSize: 'cover',
backgroundPosition: 'center',
}}
>
<PreviewWrapper
naked
name={embed as keyof typeof embedConfigurations}
/>
</Box>
</Flex>
</Link>
</EmbedState.Provider>
))}
</Flex>
2024-10-28 10:57:42 -05:00
</PageWrapper>
);
}