1- import { Graph } from '@graphscope/studio-graph-editor' ;
21import React , { useCallback , useContext , useEffect , useMemo , useState } from 'react' ;
32import { useNodeStore } from '../../stores/useNodeStore' ;
43import { useEdgeStore } from '../../stores/useEdgeStore' ;
5- import { ISchemaEdge } from '@graphscope/studio-graph-editor' ;
64import { useGenerateRelation } from '../../hooks/generateRelation/useGenerateRelation' ;
7- import PopoverContent from './PopoverContent' ;
85import { Property } from '../../types/property' ;
96import { useTransform } from '../../hooks/transform/useTransform' ;
10- import { ISchemaNode } from '@graphscope/studio-graph-editor' ;
117import { useGraphStore } from '../../stores/useGraphStore' ;
128import { useEncodeCypher } from '../../hooks/cypher/useEncodeCypher' ;
13- import { Button , Input , Modal , Tooltip } from 'antd' ;
9+ import { Button , Tooltip } from 'antd' ;
1410import { usePropertiesStore } from '../../stores/usePropertiesStore' ;
11+ import ButtonController from './ButtonController' ;
1512import { DrawPatternContext , DrawPatternValue } from '../DrawPattern' ;
1613import _ from 'lodash' ;
14+ import { theme } from 'antd' ;
1715import { useSection } from '@graphscope/studio-components' ;
16+ import { Background , MiniMap , Controls } from 'reactflow' ;
1817import { InsertRowRightOutlined , SearchOutlined } from '@ant-design/icons' ;
18+ import { GraphProvider , GraphEditor , ISchemaEdge , ISchemaNode } from '@graphscope/studio-flow-editor' ;
1919
2020export const Canvas = ( ) => {
2121 const [ descState , setDescState ] = useState < string > ( ) ;
@@ -40,6 +40,7 @@ export const Canvas = () => {
4040 const { toggleLeftSide } = useSection ( ) ;
4141 const [ clickTrigger , setClickTrigger ] = useState < boolean > ( false ) ;
4242 const [ isModalOpen , setIsModalOpen ] = useState < boolean > ( false ) ;
43+ const { token } = theme . useToken ( ) ;
4344
4445 useEffect ( ( ) => {
4546 const nodeReturn = Array . from ( nodesStore ) . map ( node => `${ node . variable } ` ) ;
@@ -115,22 +116,32 @@ export const Canvas = () => {
115116
116117 const MyGraph = useCallback ( ( ) => {
117118 return (
118- < Graph
119- graphId = "edit-graph"
119+ < GraphEditor
120120 noDefaultLabel = { true }
121121 defaultNodes = { graphNodes }
122122 defaultEdges = { graphEdges as unknown as ISchemaEdge [ ] }
123123 onNodesChange = { handleNodes }
124124 onEdgesChange = { handleEdges }
125- isShowPopover = { true }
126- popoverCustomContent = { < PopoverContent onChange = { handlePropertiesChange } > </ PopoverContent > }
127- />
125+ >
126+ < ButtonController />
127+ < Controls
128+ style = { {
129+ gap : '4px' ,
130+ boxShadow :
131+ '0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 9px 28px 8px rgba(0, 0, 0, 0.05)' ,
132+ } }
133+ />
134+ < Background style = { { background : token . colorBgBase } } />
135+ < MiniMap style = { { backgroundColor : token . colorBgBase } } />
136+ </ GraphEditor >
128137 ) ;
129138 } , [ graphNodes , graphEdges ] ) ;
130139
131140 return (
132141 < div style = { { height : '100%' , width : '100%' } } >
133- < MyGraph > </ MyGraph >
142+ < GraphProvider >
143+ < MyGraph > </ MyGraph >
144+ </ GraphProvider >
134145 < div
135146 style = { {
136147 backgroundColor : 'white' ,
0 commit comments