/** * Flowgram Tools Component * Based on: https://github.com/bytedance/flowgram.ai/tree/main/apps/demo-free-layout/src/components/tools */ import React, { useState, useEffect } from 'react'; import { Button, Tooltip, Divider } from 'antd'; import { UndoOutlined, RedoOutlined, PlusOutlined, ZoomInOutlined, ZoomOutOutlined, FullscreenOutlined, } from '@ant-design/icons'; import { useClientContext } from '@flowgram.ai/free-layout-editor'; import { ZoomSelect } from './zoom-select'; import { AddNodeDropdown } from './add-node-dropdown'; import { ToolContainer, ToolSection } from './styles'; export const FlowgramTools: React.FC = () => { const { history, playground } = useClientContext(); const [canUndo, setCanUndo] = useState(false); const [canRedo, setCanRedo] = useState(false); useEffect(() => { const disposable = history.undoRedoService.onChange(() => { setCanUndo(history.canUndo()); setCanRedo(history.canRedo()); }); return () => disposable.dispose(); }, [history]); return (