2
0

feat: Add new onboarding flow

This commit is contained in:
Baptiste Arnaud
2022-03-23 09:56:39 +01:00
parent f9aba27aae
commit f4e6f63b26
32 changed files with 1115 additions and 89 deletions

View File

@ -12,10 +12,12 @@ import {
} from '@chakra-ui/react'
import { ChevronLeftIcon } from 'assets/icons'
import { useTypebot } from 'contexts/TypebotContext/TypebotContext'
import { useRouter } from 'next/router'
import { timeSince } from 'services/utils'
import { isNotDefined } from 'utils'
export const PublishButton = () => {
const { push, query } = useRouter()
const {
isPublishing,
isPublished,
@ -24,6 +26,11 @@ export const PublishButton = () => {
restorePublishedTypebot,
} = useTypebot()
const handlePublishClick = () => {
publishTypebot()
if (!publishedTypebot) push(`/typebots/${query.typebotId}/share`)
}
return (
<HStack spacing="1px">
<Tooltip
@ -47,7 +54,7 @@ export const PublishButton = () => {
colorScheme="blue"
isLoading={isPublishing}
isDisabled={isPublished}
onClick={publishTypebot}
onClick={handlePublishClick}
borderRightRadius={publishedTypebot && !isPublished ? 0 : undefined}
>
{isPublished ? 'Published' : 'Publish'}