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

37 lines
1.3 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 (
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"
>
<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>
)
}