-
Notifications
You must be signed in to change notification settings - Fork 0
/
FlowContextMenu.tsx
94 lines (90 loc) · 2.65 KB
/
FlowContextMenu.tsx
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import React from "react";
interface Props {
addNode: (node: string) => void;
}
const items = [
{
items: [
{ label: "Audio Buffer Source", node: "AudioBufferSource" },
{ label: "Gate", node: "Gate" },
{ label: "Keyboard", node: "Keyboard" },
{ label: "Metronome", node: "Metronome" },
{ label: "Noise", node: "Noise" },
{ label: "Oscillator", node: "Oscillator" },
{ label: "Oscillator Note", node: "OscillatorNote" },
],
label: "Sources",
},
{
items: [{ label: "Destination", node: "Destination" }],
label: "Destinations",
},
{
items: [
{ label: "Biquad Filter", node: "BiquadFilter" },
{ label: "Channel Merger", node: "ChannelMerger" },
{ label: "Channel Splitter", node: "ChannelSplitter" },
{ label: "Delay", node: "Delay" },
{ label: "Delay Effect", node: "DelayEffect" },
{ label: "Dynamics Compressor", node: "DynamicsCompressor" },
{ label: "Equalizer", node: "Equalizer" },
{ label: "Gain", node: "Gain" },
{ label: "Quantizer", node: "Quantizer" },
{ label: "Rectifier", node: "Rectifier" },
{ label: "Sample and Hold", node: "SampleAndHold" },
{ label: "Sign", node: "Sign" },
{ label: "Stereo Panner", node: "StereoPanner" },
{ label: "Transformer", node: "Transformer" },
{ label: "Wave Shaper", node: "WaveShaper" },
],
label: "Effects",
},
{
items: [
{ label: "ADSR", node: "ADSR" },
{ label: "Constant Source", node: "ConstantSource" },
{ label: "Input Switch", node: "InputSwitch" },
{ label: "Output Switch", node: "OutputSwitch" },
],
label: "Controllers",
},
{
items: [
{ label: "AND Gate", node: "AndGate" },
{ label: "Comparator", node: "Comparator" },
{ label: "NOT Gate", node: "NotGate" },
{ label: "OR Gate", node: "OrGate" },
{ label: "XOR Gate", node: "XorGate" },
],
label: "Logic",
},
{
items: [
{ label: "Analyser", node: "Analyser" },
{ label: "Meter", node: "Meter" },
],
label: "Analysers",
},
];
function FlowContextMenu({ addNode }: Props) {
return (
<ul className="contextMenu">
{items.map(item => (
<li key={item.label}>
{item.label}
<span>❯</span>
{item.items && (
<ul className="contextMenu sub">
{item.items.map(subitem => (
<li key={subitem.label} onClick={() => addNode(subitem.node)}>
{subitem.label}
</li>
))}
</ul>
)}
</li>
))}
</ul>
);
}
export default React.memo(FlowContextMenu);