2
0

feat(editor): ️ Improve graph navigation setting

This commit is contained in:
Baptiste Arnaud
2022-04-08 15:10:21 -05:00
parent c5d3b9214d
commit 4502e68065
5 changed files with 106 additions and 74 deletions

View File

@ -10,15 +10,30 @@ import {
import assert from 'assert'
import { DownloadIcon, MoreVerticalIcon, SettingsIcon } from 'assets/icons'
import { useTypebot } from 'contexts/TypebotContext'
import React, { useState } from 'react'
import { useUser } from 'contexts/UserContext'
import { useRouter } from 'next/router'
import React, { useEffect, useState } from 'react'
import { parseDefaultPublicId } from 'services/typebots'
import { isNotDefined } from 'utils'
import { EditorSettingsModal } from './EditorSettingsModal'
export const BoardMenuButton = (props: MenuButtonProps) => {
const { query } = useRouter()
const { typebot } = useTypebot()
const { user } = useUser()
const [isDownloading, setIsDownloading] = useState(false)
const { isOpen, onOpen, onClose } = useDisclosure()
useEffect(() => {
if (
user &&
isNotDefined(user.graphNavigation) &&
isNotDefined(query.isFirstBot)
)
onOpen()
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [])
const downloadFlow = () => {
assert(typebot)
setIsDownloading(true)