refactor node context menu III, added zustand

This commit is contained in:
2025-11-11 01:25:59 +01:00
parent 8e630839a0
commit cd4963a4bd
7 changed files with 124 additions and 139 deletions

View File

@@ -1,6 +1,6 @@
import React, { useState } from 'react';
import React, { createContext, useState } from 'react';
import { Layout, theme, Breadcrumb } from 'antd';
import Graph, { NodeModel } from './components/Graph';
import Graph, { GraphModel } from './components/Graph';
import type { BreadcrumbItemType } from 'antd/es/breadcrumb/Breadcrumb';
const { Content } = Layout;
@@ -11,14 +11,10 @@ const App: React.FC = () => {
} = theme.useToken();
const [graphLevel, setGraphLevel] = useState<BreadcrumbItemType[]>([])
function setGraphLevelPath(path: BreadcrumbItemType[]) {
setGraphLevel(path)
}
return (
<Layout>
<Layout>
<Breadcrumb style={{ margin: '8px 0 0 16px' }} items={graphLevel} />
<Breadcrumb style={{ margin: '8px 0 0 16px' }} items={graphLevel} />
<Content
style={{
margin: '8px 16px',
@@ -28,7 +24,7 @@ const App: React.FC = () => {
borderRadius: borderRadiusLG,
}}
>
<Graph setGraphPath={setGraphLevelPath} />
<Graph setGraphPath={setGraphLevel} />
</Content>
</Layout>
</Layout>