mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
feat: better homepage
This commit is contained in:
1 parent
5deafff3ab
commit
0beaf3f9d6
2 files changed
+92
-43
No files matched your search
@@ -1,63 +1,112 @@
|
|||||||
import { imgur, ImgurSize } from '@blitzkit/core';
|
import { imgur, ImgurSize } from '@blitzkit/core';
|
||||||
import { Box, Flex, Link, Text } from '@radix-ui/themes';
|
import { ExclamationTriangleIcon } from '@radix-ui/react-icons';
|
||||||
|
import { Box, Callout, Flex, Link, Text } from '@radix-ui/themes';
|
||||||
import { capitalize } from 'lodash-es';
|
import { capitalize } from 'lodash-es';
|
||||||
import { PreviewWrapper } from '../../../components/Embeds/PreviewWrapper';
|
import { PreviewWrapper } from '../../../components/Embeds/PreviewWrapper';
|
||||||
import { PageWrapper } from '../../../components/PageWrapper';
|
import { PageWrapper } from '../../../components/PageWrapper';
|
||||||
|
import { WargamingLoginButton } from '../../../components/WargamingLoginButton';
|
||||||
import {
|
import {
|
||||||
embedConfigurations,
|
embedConfigurations,
|
||||||
extractEmbedConfigDefaults,
|
extractEmbedConfigDefaults,
|
||||||
} from '../../../constants/embeds';
|
} from '../../../constants/embeds';
|
||||||
import { Var } from '../../../core/radix/var';
|
import { Var } from '../../../core/radix/var';
|
||||||
|
import { App } from '../../../stores/app';
|
||||||
import { EmbedState } from '../../../stores/embedState';
|
import { EmbedState } from '../../../stores/embedState';
|
||||||
|
|
||||||
export function Page() {
|
export function Page() {
|
||||||
return (
|
return (
|
||||||
<PageWrapper color="red">
|
<App.Provider>
|
||||||
{Object.entries(embedConfigurations).map(([embed, config]) => (
|
<Content />
|
||||||
<EmbedState.Provider data={extractEmbedConfigDefaults(config)}>
|
</App.Provider>
|
||||||
<Link
|
);
|
||||||
href={`/tools/embed/${embed}`}
|
}
|
||||||
color="gray"
|
|
||||||
highContrast
|
|
||||||
style={{
|
|
||||||
width: 'fit-content',
|
|
||||||
height: 'fit-content',
|
|
||||||
}}
|
|
||||||
underline="hover"
|
|
||||||
>
|
|
||||||
<Flex
|
|
||||||
direction="column"
|
|
||||||
overflow="hidden"
|
|
||||||
style={{
|
|
||||||
borderRadius: Var('radius-4'),
|
|
||||||
backgroundColor: Var('color-panel-solid'),
|
|
||||||
boxShadow: Var('shadow-3'),
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Flex justify="center" p="2">
|
|
||||||
<Text>{capitalize(embed)}</Text>
|
|
||||||
</Flex>
|
|
||||||
|
|
||||||
<Box
|
function Content() {
|
||||||
width="20rem"
|
const wargaming = App.useDeferred((state) => state.logins.wargaming, {
|
||||||
height="20rem"
|
token: '',
|
||||||
|
id: 0,
|
||||||
|
expires: 0,
|
||||||
|
});
|
||||||
|
|
||||||
|
return (
|
||||||
|
<PageWrapper color="red">
|
||||||
|
{!wargaming && (
|
||||||
|
<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>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<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"
|
||||||
overflow="hidden"
|
overflow="hidden"
|
||||||
position="relative"
|
|
||||||
style={{
|
style={{
|
||||||
backgroundImage: `url(${imgur('SO13zur', { format: 'jpeg', size: ImgurSize.SmallThumbnail })})`,
|
borderRadius: Var('radius-4'),
|
||||||
backgroundSize: 'cover',
|
backgroundColor: Var('color-panel-solid'),
|
||||||
backgroundPosition: 'center',
|
boxShadow: Var('shadow-3'),
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<PreviewWrapper
|
<Flex justify="center" p="2">
|
||||||
naked
|
<Text>{capitalize(embed)}</Text>
|
||||||
name={embed as keyof typeof embedConfigurations}
|
</Flex>
|
||||||
/>
|
|
||||||
</Box>
|
<Box
|
||||||
</Flex>
|
width="20rem"
|
||||||
</Link>
|
height="20rem"
|
||||||
</EmbedState.Provider>
|
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>
|
||||||
</PageWrapper>
|
</PageWrapper>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -5,5 +5,5 @@ import { Page } from './_index';
|
|||||||
---
|
---
|
||||||
|
|
||||||
<ToolLayout tool={embedTool}>
|
<ToolLayout tool={embedTool}>
|
||||||
<Page />
|
<Page client:load />
|
||||||
</ToolLayout>
|
</ToolLayout>
|
||||||
Reference in new issue
Block a user