2
0

feat(db): 🗃️ Remove duplicate fields in PublicTypebot

This commit is contained in:
Baptiste Arnaud
2022-06-04 11:05:46 +02:00
parent 8ec117aee4
commit ad32ae02ef
11 changed files with 29 additions and 47 deletions

View File

@ -5,6 +5,7 @@ import {
Stack,
HStack,
Text,
Spinner,
} from '@chakra-ui/react'
import React, { ChangeEvent, FormEvent, useEffect } from 'react'
import { useState } from 'react'
@ -70,6 +71,7 @@ export const SignInForm = ({
})
setAuthLoading(false)
}
if (isLoadingProviders) return <Spinner />
if (hasNoAuthProvider)
return (
<Text>

View File

@ -23,14 +23,14 @@ import { integrationsList } from './integrations/EmbedButton'
export const ShareContent = () => {
const { workspace } = useWorkspace()
const { typebot, updateOnBothTypebots } = useTypebot()
const { typebot, updateTypebot } = useTypebot()
const { showToast } = useToast()
const handlePublicIdChange = (publicId: string) => {
if (publicId === typebot?.publicId) return
if (publicId.length < 4)
return showToast({ description: 'ID must be longer than 4 characters' })
updateOnBothTypebots({ publicId })
updateTypebot({ publicId })
}
const publicId = typebot
@ -46,8 +46,8 @@ export const ShareContent = () => {
handleCustomDomainChange(newDomain)
}
const handleCustomDomainChange = (customDomain: string | null) =>
updateOnBothTypebots({ customDomain })
const handleCustomDomainChange = (customDomain: string | undefined) =>
updateTypebot({ customDomain })
return (
<Flex h="full" w="full" justifyContent="center" align="flex-start">
@ -76,7 +76,7 @@ export const ShareContent = () => {
icon={<TrashIcon />}
aria-label="Remove custom domain"
size="xs"
onClick={() => handleCustomDomainChange(null)}
onClick={() => handleCustomDomainChange(undefined)}
/>
</HStack>
)}

View File

@ -25,7 +25,6 @@ export const TypebotHeader = () => {
const router = useRouter()
const {
typebot,
updateOnBothTypebots,
updateTypebot,
save,
undo,
@ -36,7 +35,7 @@ export const TypebotHeader = () => {
} = useTypebot()
const { setRightPanel, rightPanel, setStartPreviewAtBlock } = useEditor()
const handleNameSubmit = (name: string) => updateOnBothTypebots({ name })
const handleNameSubmit = (name: string) => updateTypebot({ name })
const handleChangeIcon = (icon: string) => updateTypebot({ icon })