2
0

feat(dashboard): Add lead generation template

While creating the template I also made sure to fix and improve everything I stumble upon
This commit is contained in:
Baptiste Arnaud
2022-02-07 07:13:16 +01:00
parent 524ef0812c
commit 1f320c5d99
20 changed files with 397 additions and 46 deletions

View File

@ -0,0 +1,64 @@
import {
Modal,
ModalOverlay,
ModalContent,
ModalHeader,
ModalCloseButton,
ModalBody,
ModalFooter,
Button,
} from '@chakra-ui/react'
import { TypebotViewer } from 'bot-engine'
import { TemplateProps } from 'layouts/dashboard/TemplatesContent'
import { Typebot } from 'models'
import React from 'react'
import { parseTypebotToPublicTypebot } from 'services/publicTypebot'
type Props = {
template: TemplateProps
typebot: Typebot
isOpen: boolean
onCreateClick: () => void
onClose: () => void
}
export const PreviewModal = ({
template,
typebot,
isOpen,
onClose,
onCreateClick,
}: Props) => {
const handleCreateClick = () => {
onCreateClick()
onClose()
}
return (
<Modal
size="3xl"
isOpen={isOpen}
onClose={onClose}
blockScrollOnMount={false}
>
<ModalOverlay />
<ModalContent h="85vh">
<ModalHeader>
{(template.emoji ?? '') + ' ' + template.name}
</ModalHeader>
<ModalCloseButton />
<ModalBody>
<TypebotViewer typebot={parseTypebotToPublicTypebot(typebot)} />
</ModalBody>
<ModalFooter>
<Button mr={3} onClick={handleCreateClick}>
Use this template
</Button>
<Button variant="ghost" colorScheme="gray" onClick={onClose}>
Close
</Button>
</ModalFooter>
</ModalContent>
</Modal>
)
}