2
0

feat(editor): Restore published version button

Had to migrate webhooks into a standalone table
This commit is contained in:
Baptiste Arnaud
2022-03-01 07:13:09 +01:00
parent 0df719d531
commit e17a1a0869
46 changed files with 578 additions and 348 deletions

View File

@ -1,11 +1,16 @@
import { Text } from '@chakra-ui/react'
import { useTypebot } from 'contexts/TypebotContext'
import { WebhookStep } from 'models'
import { byId } from 'utils'
type Props = {
step: WebhookStep
}
export const WebhookContent = ({ step: { webhook } }: Props) => {
export const WebhookContent = ({ step: { webhookId } }: Props) => {
const { webhooks } = useTypebot()
const webhook = webhooks.find(byId(webhookId))
if (!webhook?.url) return <Text color="gray.500">Configure...</Text>
return (
<Text isTruncated pr="6">

View File

@ -1,17 +1,21 @@
import { Text } from '@chakra-ui/react'
import { useTypebot } from 'contexts/TypebotContext'
import { ZapierStep } from 'models'
import { isNotDefined } from 'utils'
import { byId, isNotDefined } from 'utils'
type Props = {
step: ZapierStep
}
export const ZapierContent = ({ step }: Props) => {
if (isNotDefined(step.webhook.body))
export const ZapierContent = ({ step: { webhookId } }: Props) => {
const { webhooks } = useTypebot()
const webhook = webhooks.find(byId(webhookId))
if (isNotDefined(webhook?.body))
return <Text color="gray.500">Configure...</Text>
return (
<Text isTruncated pr="6">
{step.webhook.url ? 'Enabled' : 'Disabled'}
{webhook?.url ? 'Enabled' : 'Disabled'}
</Text>
)
}