Skip to content

Commit 0ef3570

Browse files
committed
feat: make array node index looks like array by enclosing it with square brackets
1 parent 12fabc1 commit 0ef3570

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/json-diagram/components/ArrayNode.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { addPrefixChain } from '../../store/json-engine/helpers/json-parser.help
66
import { ArrayNodeData } from '../../store/json-engine/types/sea-node.type';
77
import { useNodeDetailViewStore } from '../../store/node-detail-view/node-detail-view.store';
88
import { isEmptyArray } from '../../utils/array.util';
9+
import { encloseSquareBrackets } from '../../utils/string.util';
910
import { ROOT_NODE_NAME } from '../constants/root-node.constant';
1011
import { ChainHandle } from './ChainHandle';
1112
import { DefaultHandle } from './DefaultHandle';
@@ -30,7 +31,7 @@ const _ArrayNode = ({ id, data }: NodeProps<ArrayNodeData>) => {
3031
{!isRootNode && <DefaultHandle id={id} type="target" />}
3132
<ChainHandle id={addPrefixChain(id)} type="target" />
3233

33-
<Text css={{ margin: 'auto' }}>{isRootNode ? ROOT_NODE_NAME : arrayIndex}</Text>
34+
<Text css={{ margin: 'auto' }}>{isRootNode ? ROOT_NODE_NAME : encloseSquareBrackets(arrayIndex)}</Text>
3435

3536
{!isEmptyArray(items) && <DefaultHandle id={id} type="source" />}
3637

0 commit comments

Comments
 (0)