Skip to content

Commit 89b41c3

Browse files
committed
just pulled from upstream
2 parents dc18e63 + fb1f985 commit 89b41c3

File tree

3 files changed

+31
-19
lines changed

3 files changed

+31
-19
lines changed

src/containers/LeftContainer.jsx

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -75,20 +75,24 @@ class LeftContainer extends Component {
7575
} = this.props;
7676
const { componentName } = this.state;
7777

78-
const componentsExpansionPanel = components.map((component, i) => (
79-
<LeftColExpansionPanel
80-
key={component.id}
81-
index={i}
82-
id={component.id}
83-
updateComponent={updateComponent}
84-
component={component}
85-
focusComponent={focusComponent}
86-
addChild={addChild}
87-
changeFocusComponent={changeFocusComponent}
88-
changeFocusChild={changeFocusChild}
89-
selectableChildren={selectableChildren}
90-
/>
91-
));
78+
console.log(components);
79+
80+
const componentsExpansionPanel = components
81+
.sort((a, b) => parseInt(b.id) - parseInt(a.id)) // sort by id value of comp
82+
.map((component, i) => (
83+
<LeftColExpansionPanel
84+
key={component.id}
85+
index={i}
86+
id={component.id}
87+
updateComponent={updateComponent}
88+
component={component}
89+
focusComponent={focusComponent}
90+
addChild={addChild}
91+
changeFocusComponent={changeFocusComponent}
92+
changeFocusChild={changeFocusChild}
93+
selectableChildren={selectableChildren}
94+
/>
95+
));
9296

9397
return (
9498
<div className="column left">

src/utils/componentReducer.util.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,18 @@ export const addComponent = (state, { title }) => {
4949
const totalComponents = state.totalComponents + 1;
5050
const nextId = state.nextId + 1;
5151

52+
let selectableChildren = state.components
53+
.map(comp => comp.id)
54+
.filter(id => id !== newComponent.id);
55+
5256
return {
5357
...state,
5458
totalComponents,
5559
nextId,
5660
components,
57-
focusComponent: newComponent
61+
focusComponent: newComponent,
62+
ancestors: [],
63+
selectableChildren: selectableChildren // new component so you everyone except yourself is available
5864
};
5965
};
6066

src/utils/getSelectable.util.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
function getSelectable(newFocusComponent, components) {
22
let focusComponentId = newFocusComponent.id;
3-
43
let componentsToCheck = components
54
.map(comp => comp.id)
65
.filter(id => id !== focusComponentId);
7-
8-
console.log(componentsToCheck);
9-
106
return findAncestors(components, [focusComponentId], componentsToCheck);
117
}
128

@@ -30,9 +26,12 @@ function findAncestors(
3026
child => child.childComponentId
3127
);
3228

29+
<<<<<<< HEAD
3330
// console.log(components[i].id, components[i].title);
3431
// console.log("myChildren", myChilren);
3532

33+
=======
34+
>>>>>>> fb1f985158be18ca3fc94b8978b45292fa8b1d28
3635
let found = currentCompArr.filter(comp => myChilren.includes(comp));
3736

3837
if (found.length) {
@@ -47,11 +46,14 @@ function findAncestors(
4746
}
4847
}
4948
}
49+
<<<<<<< HEAD
5050

5151
// console.log("newancestors", newAncestors);
5252
// console.log("comptocheck", componentsToCheck);
5353
// console.log("cumulativeancestors", ancestors);
5454

55+
=======
56+
>>>>>>> fb1f985158be18ca3fc94b8978b45292fa8b1d28
5557
return findAncestors(components, newAncestors, componentsToCheck, ancestors);
5658
}
5759

0 commit comments

Comments
 (0)