Skip to content

Commit 5fc0a63

Browse files
committed
switched component map for presentation
1 parent 66acd36 commit 5fc0a63

File tree

2 files changed

+5
-46
lines changed

2 files changed

+5
-46
lines changed

src/app/components/StateRoute/ComponentMap/ComponentMap.tsx

Lines changed: 4 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -198,40 +198,9 @@ export default function ComponentMap({
198198

199199
return newNode;
200200
};
201-
201+
// filter out Conext Providers
202202
let filtered = processTreeData(currentSnapshot);
203-
collectNodes(currentSnapshot);
204-
205-
const keepContextAndProviderNodes = (node) => {
206-
if (!node) return null;
207-
208-
// Check if this node should be kept
209-
const hasContext =
210-
node?.componentData?.context && Object.keys(node.componentData.context).length > 0;
211-
const isProvider = node?.name && node.name.endsWith('Provider');
212-
const shouldKeepNode = hasContext || isProvider;
213-
214-
// Process children first
215-
let processedChildren = [];
216-
if (node.children) {
217-
processedChildren = node.children
218-
.map((child) => keepContextAndProviderNodes(child))
219-
.filter(Boolean); // Remove null results
220-
}
221-
222-
// If this node should be kept or has kept children, return it
223-
if (shouldKeepNode || processedChildren.length > 0) {
224-
return {
225-
...node,
226-
children: processedChildren,
227-
};
228-
}
229-
230-
// If neither the node should be kept nor it has kept children, filter it out
231-
return null;
232-
};
233-
234-
const contextProvidersOnly = keepContextAndProviderNodes(currentSnapshot);
203+
collectNodes(filtered);
235204

236205
// @ts
237206
// find the node that has been selected and use it as the root
@@ -247,7 +216,7 @@ export default function ComponentMap({
247216
if (startNode === null) startNode = rootNode;
248217
};
249218

250-
findSelectedNode(); // locates the rootNode... do we really need this? This function is only used once... it's here.
219+
findSelectedNode(); // locates the rootNode
251220

252221
// controls for the map
253222
const LinkComponent: React.ComponentType<unknown> = getLinkComponent({
@@ -323,7 +292,6 @@ export default function ComponentMap({
323292
} else {
324293
stroke = plum;
325294
}
326-
// stroke = '#df6f37'
327295
}
328296

329297
return (
@@ -448,9 +416,8 @@ export default function ComponentMap({
448416
{node.depth === 0 && (
449417
<circle
450418
className='compMapRoot'
451-
r={25} // increase from 12 to 25 to improve visibility
419+
r={25}
452420
fill="url('#root-gradient')"
453-
//stroke={rootStroke}
454421
onClick={() => {
455422
dispatch(toggleExpanded(node.data));
456423
hideTooltip();
@@ -468,13 +435,6 @@ export default function ComponentMap({
468435
y={-height / 2}
469436
x={-width / 2}
470437
fill="url('#parent-gradient')"
471-
//color={'#ff0000'}
472-
//fill={node.children ? nodeParentFill : nodeChildFill}
473-
//stroke={
474-
// node.data.isExpanded && node.data.children.length > 0
475-
// ? nodeParentStroke
476-
// : nodeChildStroke
477-
// }
478438
strokeWidth={1.5}
479439
strokeOpacity='1'
480440
rx={node.children ? 4 : 10}

src/app/components/StateRoute/ComponentMap/LinkControls.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
/* eslint-disable jsx-a11y/label-has-associated-control */
22
import React from 'react';
33
import { LinkControlProps, ControlStyles, DropDownStyle, Node } from '../../../FrontendTypes';
4+
45
// Font size of the Controls label and Dropdowns
56
const controlStyles: ControlStyles = {
6-
//fontSize: '16px',
77
padding: '10px',
88
};
99

1010
const dropDownStyle: DropDownStyle = {
1111
margin: '0.1em',
12-
//fontSize: '16px',
1312
fontFamily: 'Roboto, sans-serif',
1413
borderRadius: '4px',
1514
borderStyle: 'solid',

0 commit comments

Comments
 (0)