Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import React from "react";
import HistoryNavigator from "./historynavigator";
import { DynamicGraph } from "../graph";
import NodeDetails from "./nodedetails";
import { NodeTypesEditor } from "./nodetypeseditor";
import Settings from "./settings";
import Instructions from "./instructions";
import { Checkpoint, History } from "../../common/history";
import { Node } from "../../common/graph/node";
import { NodeType } from "../../common/graph/nodetype";
import { SimGraphData } from "../../common/graph/graph";
import { NodeDataChangeRequest } from "../editor";
interface SidepanelProps {
graph: DynamicGraph;
onCheckpointLoad: { (checkpoint: Checkpoint<SimGraphData>): void };
onNodeTypeSelect: (type: NodeType) => void;
onConnectOnDragChange: (connectOnDrag: boolean) => void;
onLabelVisibilityChange: (state: boolean) => void;
onNodeDataChange: { (requests: NodeDataChangeRequest[]): void };
selectedNodes: Node[];
visibleLabels: boolean;
connectOnDrag: boolean;
}
function Sidepanel({
graph,
onCheckpointLoad,
onNodeTypeSelect,
onConnectOnDragChange,
onLabelVisibilityChange,
onNodeDataChange,
selectedNodes,
visibleLabels,
connectOnDrag,
}: SidepanelProps) {
return (
<div id="sidepanel">
<HistoryNavigator
history={graph.history}
onCheckpointLoad={onCheckpointLoad}
/>
<hr />
<NodeDetails
selectedNodes={selectedNodes}
nameToObjectType={graph.nameToObjectGroup} // TODO: Change to id
onNodeDataChange={onNodeDataChange}
/>
<hr />
<NodeTypesEditor
onChange={() =>
console.log("Refactor onChange for nodetypes editor!")
} // TODO: Refactor
graph={graph}
onSelectAll={onNodeTypeSelect}
/>
<hr />
<Settings
labelVisibility={visibleLabels}
onLabelVisibilityChange={onLabelVisibilityChange}
connectOnDrag={connectOnDrag}
onConnectOnDragChange={onConnectOnDragChange}
/>
<hr />
<Instructions connectOnDragEnabled={connectOnDrag} />
</div>
);
}
export default Sidepanel;