Skip to content

Commit 6f1abac

Browse files
committed
(add,modify) Re-optimizing the atom/selectors/components algorithm, building out logic to handle Atom to Selectors relationship first
1 parent 1395385 commit 6f1abac

File tree

1 file changed

+4
-71
lines changed

1 file changed

+4
-71
lines changed

src/app/components/AtomsRelationship.jsx

Lines changed: 4 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -33,64 +33,13 @@ function clusterDataPopulate(props) {
3333
clusterData.name = props[0].name;
3434
}
3535

36-
//internal counter for the array
37-
let ocounter = 0;
38-
let icounter = 0
39-
for (let key in atomCompObj) {
40-
41-
if(props[0].atomSelectors[key]){
42-
if(!clusterData.children){
43-
clusterData.children = []
44-
}
45-
//need to handle duplicates
46-
clusterData.children.push({ name: key });
47-
48-
if(props[0].atomSelectors[key].length){
49-
for(let i=0; i<props[0].atomSelectors[key].length;i++){
50-
if(!clusterData.children[ocounter].children){
51-
clusterData.children[ocounter].children = []
52-
}
53-
clusterData.children[ocounter].children.push({
54-
name: props[0].atomSelectors[key][i]
55-
})
56-
for(let i=0;i<clusterData.children[ocounter].children[icounter])
57-
58-
}
59-
}
60-
outercounter++
61-
}
36+
//we'll first handle AtomSelectors
37+
if(!Object.entries(props[0].atomSelectors).length === 0){
38+
6239
}
63-
64-
console.log(clusterData)
40+
6541
}
6642

67-
68-
69-
// if (atomCompObj[key].length) {
70-
// for (let i = 0; i < atomCompObj[key].length; i++) {
71-
72-
// if (!memoizeObj[key]) {
73-
// memoizeObj[key] = [];
74-
// if (!clusterData.children && !props[0].atomSelectors[key]) clusterData.children = [];
75-
// clusterData.children.push({ name: key });
76-
// }
77-
78-
79-
// if (!memoizeObj[key].includes(atomCompObj[key][i])) {
80-
// if (!clusterData.children[counter].children)
81-
// clusterData.children[counter].children = [];
82-
// clusterData.children[counter].children.push({
83-
// name: atomCompObj[key][i],
84-
// });
85-
// }
86-
// memoizeObj[key].push(atomCompObj[key][i]);
87-
// }
88-
// }
89-
// counter++;
90-
// }
91-
// console.log(clusterData)
92-
93-
9443
function reorganizedCompObj(props) {
9544
let atomsComponentObj = props[0].atomsComponents;
9645
let reorganizedCompObj = {};
@@ -107,22 +56,6 @@ function reorganizedCompObj(props) {
10756
return reorganizedCompObj;
10857
}
10958

110-
function reorganizedFamObj(props) {
111-
let atomsComponentObj = props[0].atomsComponents;
112-
let reorganizedCompObj = {};
113-
114-
for (const key in atomsComponentObj) {
115-
for (let i = 0; i < atomsComponentObj[key].length; i++) {
116-
if (!reorganizedCompObj[atomsComponentObj[key][i]]) {
117-
reorganizedCompObj[atomsComponentObj[key][i]] = [key];
118-
} else {
119-
reorganizedCompObj[atomsComponentObj[key][i]].push(key);
120-
}
121-
}
122-
}
123-
return reorganizedCompObj;
124-
}
125-
12659
function Node({ node }) {
12760
const isRoot = node.depth === 0;
12861
const isParent = !!node.children;

0 commit comments

Comments
 (0)