2
0

fix(viewer): 💚 Attempt to fix LP rewrites

This commit is contained in:
Baptiste Arnaud
2022-02-10 16:23:21 +01:00
parent 92515efcc3
commit 19f4fdb83a
11 changed files with 65 additions and 73 deletions

View File

@ -30,7 +30,7 @@ export const EditableUrl = ({
onSubmit={onPublicIdChange}
>
<HStack spacing={1}>
<Text>https://</Text>
<Text>{process.env.NEXT_PUBLIC_VIEWER_HOST}/</Text>
<Tooltip label="Edit">
<EditablePreview
mx={1}
@ -43,15 +43,15 @@ export const EditableUrl = ({
fontWeight="semibold"
/>
</Tooltip>
<EditableInput px={2} />
<Text>.typebot.io/</Text>
</HStack>
<HStack>
<EditButton size="xs" />
<CopyButton size="xs" textToCopy={`https://${publicId}.typebot.io/`} />
<CopyButton
size="xs"
textToCopy={`${process.env.NEXT_PUBLIC_VIEWER_HOST}/${publicId}`}
/>
</HStack>
</Editable>
)

View File

@ -4,7 +4,6 @@ import {
PublicBlock,
PublicStep,
PublicTypebot,
Step,
Typebot,
} from 'models'
import shortId from 'short-uuid'
@ -17,10 +16,15 @@ import { isDefined } from '@udecode/plate-common'
export const parseTypebotToPublicTypebot = (
typebot: Typebot
): PublicTypebot => ({
...typebot,
id: shortId.generate(),
typebotId: typebot.id,
blocks: parseBlocksToPublicBlocks(typebot.blocks),
edges: typebot.edges,
name: typebot.name,
publicId: typebot.publicId,
settings: typebot.settings,
theme: typebot.theme,
variables: typebot.variables,
})
const parseBlocksToPublicBlocks = (blocks: Block[]): PublicBlock[] =>