Skip to content

Commit f802c6c

Browse files
removed console logs commented sections for greater clarity on what the code is doing
1 parent d9df418 commit f802c6c

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/app/components/ComponentMap.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ import useForceUpdate from './useForceUpdate';
1212
import LinkControls from './LinkControls';
1313
import getLinkComponent from './getLinkComponent';
1414

15-
// setting the base margins for the Map to render in the window.
15+
// setting the base margins for the Map to render in the Chrome extension window.
1616
const defaultMargin = { top: 30, left: 30, right: 30, bottom: 30 };
1717

18+
// export these types because this will only be used on this page, interface not needed as it will not be re-used.
1819
export type LinkTypesProps = {
1920
width: number;
2021
height: number;
@@ -30,7 +31,8 @@ export default function ComponentMap({
3031
snapshots: snapshots,
3132
}: LinkTypesProps) {
3233
console.log(totalHeight);
33-
// preparing the data to be used for render
34+
35+
// This is where we select the last object in the snapshots array from props to allow hierarchy to parse the data for render on the component map per hierarchy layout specifications.
3436
const lastNode = snapshots.length - 1;
3537
const data = snapshots[lastNode];
3638
// importing custom hooks for the selection tabs.
@@ -68,9 +70,9 @@ export default function ComponentMap({
6870
}
6971

7072
// render controls for the map
71-
73+
// svg - complete layout of self contained component map
7274
// Tree is rendering each component from the component tree.
73-
// rect- Contains both text and rectangle node information for rendering each component.
75+
// rect- Contains both text and rectangle node information for rendering each component on the map.
7476
// circle- setup and layout for the root node.
7577
const LinkComponent = getLinkComponent({ layout, linkType, orientation });
7678
return totalWidth < 10 ? null : (
@@ -93,7 +95,7 @@ export default function ComponentMap({
9395
<Tree
9496
root={hierarchy(data, (d) => (d.isExpanded ? null : d.children))}
9597
size={[sizeWidth, sizeHeight]}
96-
separation={(a, b) => (a.parent === b.parent ? 1000 : 0) / a.depth}
98+
separation={(a, b) => (a.parent === b.parent ? 10 : 0) / a.depth}
9799
>
98100
{(tree) => (
99101
<Group top={origin.y} left={origin.x}>
@@ -134,7 +136,6 @@ export default function ComponentMap({
134136
fill="url('#links-gradient')"
135137
onClick={() => {
136138
node.data.isExpanded = !node.data.isExpanded;
137-
console.log(node);
138139
forceUpdate();
139140
}}
140141
/>

0 commit comments

Comments
 (0)