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-24 11:13:19 +01:00
|
|
|
const { typebot, isReadOnly } = 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 (
|
2022-03-31 09:49:23 +02:00
|
|
|
<Flex
|
|
|
|
flex="1"
|
|
|
|
pos="relative"
|
|
|
|
h="full"
|
|
|
|
background="#f4f5f8"
|
|
|
|
backgroundImage="radial-gradient(#c6d0e1 1px, transparent 0)"
|
|
|
|
backgroundSize="40px 40px"
|
|
|
|
backgroundPosition="-19px -19px"
|
|
|
|
>
|
2022-02-04 19:00:08 +01:00
|
|
|
<GraphDndContext>
|
2022-01-29 11:22:22 +01:00
|
|
|
<StepsSideBar />
|
2022-02-24 11:13:19 +01:00
|
|
|
<GraphProvider blocks={typebot?.blocks ?? []} isReadOnly={isReadOnly}>
|
2022-02-11 18:06:59 +01:00
|
|
|
{typebot && <Graph flex="1" typebot={typebot} />}
|
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>
|
|
|
|
)
|
|
|
|
}
|