2021-12-16 10:43:49 +01:00
|
|
|
import { Flex } from '@chakra-ui/react'
|
|
|
|
import React from 'react'
|
2022-02-04 19:00:08 +01:00
|
|
|
import { GraphDndContext } from 'contexts/GraphDndContext'
|
2022-02-02 08:05:02 +01:00
|
|
|
import { StepsSideBar } from '../../components/editor/StepsSideBar'
|
|
|
|
import { PreviewDrawer } from '../../components/editor/preview/PreviewDrawer'
|
2021-12-22 14:59:07 +01:00
|
|
|
import { RightPanel, useEditor } from 'contexts/EditorContext'
|
2022-01-03 17:39:59 +01:00
|
|
|
import { GraphProvider } from 'contexts/GraphContext'
|
2022-02-02 08:05:02 +01:00
|
|
|
import { BoardMenuButton } from '../../components/editor/BoardMenuButton'
|
|
|
|
import { useTypebot } from 'contexts/TypebotContext'
|
|
|
|
import { Graph } from 'components/shared/Graph'
|
2021-12-16 10:43:49 +01:00
|
|
|
|
2021-12-22 14:59:07 +01:00
|
|
|
export const Board = () => {
|
2022-02-02 08:05:02 +01:00
|
|
|
const { typebot } = useTypebot()
|
2021-12-22 14:59:07 +01:00
|
|
|
const { rightPanel } = useEditor()
|
2022-02-02 08:05:02 +01:00
|
|
|
|
2021-12-22 14:59:07 +01:00
|
|
|
return (
|
2021-12-23 09:37:42 +01:00
|
|
|
<Flex flex="1" pos="relative" bgColor="gray.50" h="full">
|
2022-02-04 19:00:08 +01:00
|
|
|
<GraphDndContext>
|
2022-01-29 11:22:22 +01:00
|
|
|
<StepsSideBar />
|
2022-02-04 19:00:08 +01:00
|
|
|
<GraphProvider blocks={typebot?.blocks ?? []}>
|
2022-01-03 17:39:59 +01:00
|
|
|
<Graph flex="1" />
|
2022-01-19 09:44:21 +01:00
|
|
|
<BoardMenuButton pos="absolute" right="40px" top="20px" />
|
2022-01-12 09:57:00 +01:00
|
|
|
{rightPanel === RightPanel.PREVIEW && <PreviewDrawer />}
|
2022-01-03 17:39:59 +01:00
|
|
|
</GraphProvider>
|
2022-02-04 19:00:08 +01:00
|
|
|
</GraphDndContext>
|
2021-12-22 14:59:07 +01:00
|
|
|
</Flex>
|
|
|
|
)
|
|
|
|
}
|