feat: remove login to generate

This commit is contained in:
tresabhi committed 2024-11-08 10:34:52 -06:00
1 parent d910ed9f5e
commit 2608d69ffe
4 files changed
+13 -48

No files matched your search

@@ -158,7 +158,7 @@ export function GenerateURL({ embed }: GenerateURLProps) {
setSearchDialogOpen(true);
}}
>
<CaretLeftIcon /> Search
<CaretLeftIcon /> Back
</Button>
<CopyButton
style={{ flex: 1 }}
@@ -10,11 +10,11 @@ import {
import { Box, Button, Flex, Heading, ScrollArea, Text } from '@radix-ui/themes';
import { capitalize, startCase } from 'lodash-es';
import { useEffect, useRef, useState, type ReactNode } from 'react';
import { stringify } from 'urlon';
import { CopyButton } from '../../../../components/CopyButton';
import { Boolean } from '../../../../components/Embeds/Boolean';
import { Color } from '../../../../components/Embeds/Color';
import { Enum } from '../../../../components/Embeds/Enum';
import { GenerateURL } from '../../../../components/Embeds/GenerateURL';
import { Import } from '../../../../components/Embeds/Import';
import { PreviewWrapper } from '../../../../components/Embeds/PreviewWrapper';
import { Radius } from '../../../../components/Embeds/Radius';
@@ -24,18 +24,13 @@ import { SizeWithout0 } from '../../../../components/Embeds/SizeWithout0';
import { Slider } from '../../../../components/Embeds/Slider';
import { TextController } from '../../../../components/Embeds/TextController';
import { PageWrapper } from '../../../../components/PageWrapper';
import { WargamingLoginButton } from '../../../../components/WargamingLoginButton';
import {
embedConfigurations,
extractEmbedConfigDefaults,
} from '../../../../constants/embeds';
import { NAVBAR_HEIGHT } from '../../../../constants/navbar';
import { App } from '../../../../stores/app';
import {
EmbedState,
type EmbedConfig,
type EmbedStateStore,
} from '../../../../stores/embedState';
import { EmbedState, type EmbedConfig } from '../../../../stores/embedState';
import { EmbedItemType } from '../../../../stores/embedState/constants';
export interface EmbedPreviewControllerProps {
@@ -98,35 +93,7 @@ function Content({ embed }: PageProps) {
</Text>
<Flex mb="6" gap="2" wrap="wrap">
{!wargaming && (
<WargamingLoginButton>
Log in to generate URL
</WargamingLoginButton>
)}
{wargaming && (
<CopyButton
copy={() => {
const state = embedStateStore.getState();
const initial = embedStateStore.getInitialState();
const shallowState: EmbedStateStore = {};
Object.entries(state).forEach(([key, value]) => {
if (value !== initial[key]) {
shallowState[key] = value;
}
});
const searchParams = new URLSearchParams({
id: `${wargaming.id}`,
state: stringify(shallowState),
});
return `${location.origin}/tools/embed/${embed}/host?${searchParams.toString()}`;
}}
>
Generate URL
</CopyButton>
)}
<GenerateURL embed={embed} />
<CopyButton
variant="outline"
@@ -1,10 +1,8 @@
import { imgur, ImgurSize } from '@blitzkit/core';
import { ExclamationTriangleIcon } from '@radix-ui/react-icons';
import { Box, Callout, Flex, Link, Text } from '@radix-ui/themes';
import { Box, Flex, Link, Text } from '@radix-ui/themes';
import { capitalize } from 'lodash-es';
import { PreviewWrapper } from '../../../components/Embeds/PreviewWrapper';
import { PageWrapper } from '../../../components/PageWrapper';
import { WargamingLoginButton } from '../../../components/WargamingLoginButton';
import {
embedConfigurations,
extractEmbedConfigDefaults,
@@ -22,15 +20,15 @@ export function Page() {
}
function Content() {
const wargaming = App.useDeferred((state) => state.logins.wargaming, {
token: '',
id: 0,
expires: 0,
});
// const wargaming = App.useDeferred((state) => state.logins.wargaming, {
// token: '',
// id: 0,
// expires: 0,
// });
return (
<PageWrapper color="red">
{!wargaming && (
{/* {!wargaming && (
<Flex direction="column" align="center" gap="2">
<Callout.Root>
<Callout.Icon>
@@ -43,7 +41,7 @@ function Content() {
<WargamingLoginButton>Log in with Wargaming</WargamingLoginButton>
</Flex>
)}
)} */}
<Text align="center" mt="3">
More embeds coming soon.{' '}
@@ -5,5 +5,5 @@ import { Page } from './_index';
---
<ToolLayout tool={embedTool}>
<Page client:load />
<Page />
</ToolLayout>