2
0
Files
bot/apps/builder/layouts/editor/Board.tsx

29 lines
1.1 KiB
TypeScript
Raw Normal View History

2021-12-16 10:43:49 +01:00
import { Flex } from '@chakra-ui/react'
import React from 'react'
import { GraphDndContext } from 'contexts/GraphDndContext'
import { StepsSideBar } from '../../components/editor/StepsSideBar'
import { PreviewDrawer } from '../../components/editor/preview/PreviewDrawer'
import { RightPanel, useEditor } from 'contexts/EditorContext'
2022-01-03 17:39:59 +01:00
import { GraphProvider } from 'contexts/GraphContext'
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
export const Board = () => {
2022-02-24 11:13:19 +01:00
const { typebot, isReadOnly } = useTypebot()
const { rightPanel } = useEditor()
return (
2021-12-23 09:37:42 +01:00
<Flex flex="1" pos="relative" bgColor="gray.50" h="full">
<GraphDndContext>
<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" />
{rightPanel === RightPanel.PREVIEW && <PreviewDrawer />}
2022-01-03 17:39:59 +01:00
</GraphProvider>
</GraphDndContext>
</Flex>
)
}