feat: better homepage

This commit is contained in:
TrèsAbhi committed 2024-11-01 10:30:36 -05:00
1 parent 5deafff3ab
commit 0beaf3f9d6
2 files changed
+52 -3

No files matched your search

@@ -1,20 +1,68 @@
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 (
<App.Provider>
<Content />
</App.Provider>
);
}
function Content() {
const wargaming = App.useDeferred((state) => state.logins.wargaming, {
token: '',
id: 0,
expires: 0,
});
return ( return (
<PageWrapper color="red"> <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]) => ( {Object.entries(embedConfigurations).map(([embed, config]) => (
<EmbedState.Provider data={extractEmbedConfigDefaults(config)}> <EmbedState.Provider
key={embed}
data={extractEmbedConfigDefaults(config)}
>
<Link <Link
href={`/tools/embed/${embed}`} href={`/tools/embed/${embed}`}
color="gray" color="gray"
@@ -58,6 +106,7 @@ export function Page() {
</Link> </Link>
</EmbedState.Provider> </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>