feat: login with wargaming to generate url

This commit is contained in:
TrèsAbhi committed 2024-10-26 15:24:56 -05:00
1 parent 7a8ad6c290
commit 71c9d1461f
4 files changed
+72 -11

No files matched your search

@@ -0,0 +1,51 @@
import { ExclamationTriangleIcon } from '@radix-ui/react-icons';
import { Callout, Flex, Link } from '@radix-ui/themes';
import { PageWrapper } from '../../../components/PageWrapper';
import { WargamingLoginButton } from '../../../components/WargamingLoginButton';
import { configurations } from '../../../constants/embeds';
import { App, type WargamingLogin } from '../../../stores/app';
export function Page() {
return (
<App.Provider>
<Content />
</App.Provider>
);
}
function Content() {
const wargaming = App.useDeferred((state) => state.logins.wargaming, {
expires: 0,
id: 0,
token: '',
} satisfies WargamingLogin);
return (
<PageWrapper color="red">
{!wargaming && (
<>
<Flex justify="center">
<Callout.Root size="1">
<Callout.Icon>
<ExclamationTriangleIcon />
</Callout.Icon>
<Callout.Text>
You must be logged in with your Wargaming account to export
embeds.
</Callout.Text>
</Callout.Root>
</Flex>
<Flex justify="center">
<WargamingLoginButton>Log in with Wargaming</WargamingLoginButton>
</Flex>
</>
)}
{Object.entries(configurations).map(([embed, config]) => (
<Link href={`/tools/embed/${embed}`}>{embed}</Link>
))}
</PageWrapper>
);
}