Skip to content

Commit a30a0eb

Browse files
committed
Added port descriptions and improved port display in GraphInspector
1 parent 977309a commit a30a0eb

File tree

3 files changed

+67
-14
lines changed

3 files changed

+67
-14
lines changed

src/components/GraphInspector.js

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,23 @@ import React from 'react';
22
import styles from './GraphInspector.module.css';
33
import { getIconForNodeType } from './ContextMenu';
44

5+
const PortItem = ({ port, isDarkTheme }) => (
6+
<div className={`${styles.portContainer} ${isDarkTheme ? styles.portContainerDark : styles.portContainerLight}`}>
7+
<div className={port.type === 'control' ? styles.portIconControl : styles.portIconData} />
8+
<div className={styles.portInfo}>
9+
<div className={styles.portNameRow}>
10+
<span>"{port.name}"</span>
11+
<span className={styles.portType}>({port.type})</span>
12+
</div>
13+
{port.description && (
14+
<div className={`${styles.portDescription} ${isDarkTheme ? styles.portDescriptionDark : styles.portDescriptionLight}`}>
15+
{port.description}
16+
</div>
17+
)}
18+
</div>
19+
</div>
20+
);
21+
522
const GraphInspector = ({
623
selectedNodes,
724
nodeTypes,
@@ -95,11 +112,7 @@ const GraphInspector = ({
95112
Input Ports
96113
</div>
97114
{nodeType.inputs.map((input, index) => (
98-
<div key={index} className={`${styles.portContainer} ${config.isDarkTheme ? styles.portContainerDark : styles.portContainerLight}`}>
99-
<div className={input.type === 'control' ? styles.portIconControl : styles.portIconData} />
100-
<span>"{input.name}"</span>
101-
<span className={styles.portType}>({input.type})</span>
102-
</div>
115+
<PortItem key={index} port={input} isDarkTheme={config.isDarkTheme} />
103116
))}
104117

105118
{/* Output Ports */}
@@ -108,11 +121,7 @@ const GraphInspector = ({
108121
Output Ports
109122
</div>
110123
{nodeType.outputs.map((output, index) => (
111-
<div key={index} className={`${styles.portContainer} ${config.isDarkTheme ? styles.portContainerDark : styles.portContainerLight}`}>
112-
<div className={output.type === 'control' ? styles.portIconControl : styles.portIconData} />
113-
<span>"{output.name}"</span>
114-
<span className={styles.portType}>({output.type})</span>
115-
</div>
124+
<PortItem key={index} port={output} isDarkTheme={config.isDarkTheme} />
116125
))}
117126
</div>
118127
</div>

src/components/GraphInspector.module.css

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,4 +226,32 @@
226226
left: 0;
227227
border-left: none;
228228
border-right: 6px solid #4CAF50;
229+
}
230+
231+
.portInfo {
232+
flex: 1;
233+
display: flex;
234+
flex-direction: column;
235+
gap: 4px;
236+
}
237+
238+
.portNameRow {
239+
display: flex;
240+
align-items: center;
241+
gap: 8px;
242+
}
243+
244+
.portDescription {
245+
font-size: 0.85em;
246+
color: #666;
247+
font-style: italic;
248+
margin-left: 4px;
249+
}
250+
251+
.portDescriptionDark {
252+
color: #999;
253+
}
254+
255+
.portDescriptionLight {
256+
color: #666;
229257
}

src/nodeDefinitions.js

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,32 @@ export const nodeTypes = {
22
OnStart: {
33
color: '#4CAF50',
44
inputs: [],
5-
outputs: [{ type: 'control', name: 'Next' }],
5+
outputs: [{
6+
type: 'control',
7+
name: 'Next',
8+
description: 'Triggered when the script begins execution'
9+
}],
610
description: 'Triggered when the script starts'
711
},
812
Log: {
913
color: '#FF5722',
1014
inputs: [
11-
{ type: 'control', name: 'In' },
12-
{ type: 'data', name: 'Message' }
15+
{
16+
type: 'control',
17+
name: 'In',
18+
description: 'Triggers the log operation'
19+
},
20+
{
21+
type: 'data',
22+
name: 'Message',
23+
description: 'The message to be logged'
24+
}
1325
],
14-
outputs: [{ type: 'control', name: 'Out' }],
26+
outputs: [{
27+
type: 'control',
28+
name: 'Out',
29+
description: 'Triggered after the message is logged'
30+
}],
1531
description: 'Logs a message to the console',
1632
properties: [
1733
{ name: 'message', type: 'string', default: '' },

0 commit comments

Comments
 (0)