You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{/* we wrap our MainContainer with the provider so that we will be able to use the store context. We create our store by using useReducer and passing it into the value property */}
Copy file name to clipboardExpand all lines: src/app/containers/ActionContainer.tsx
+3-8Lines changed: 3 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -58,8 +58,7 @@ function ActionContainer(props): JSX.Element {
58
58
obj.stateSnapshot.children[0].state&&// with a 'state'
59
59
obj.stateSnapshot.children[0].name// and a 'name'
60
60
){
61
-
constnewObj: Record<string,unknown>={
62
-
// we create a new Record object (whose property keys are Keys and whose property values are Type. This utility can be used to map the properties of a type to another type) and populate it's properties with relevant values from our argument 'obj'.
61
+
constnewObj: Record<string,unknown>={// we create a new Record object (whose property keys are Keys and whose property values are Type. This utility can be used to map the properties of a type to another type) and populate it's properties with relevant values from our argument 'obj'.
63
62
index: obj.index,
64
63
displayName: `${obj.name}.${obj.branch}`,
65
64
state: obj.stateSnapshot.children[0].state,
@@ -73,8 +72,7 @@ function ActionContainer(props): JSX.Element {
73
72
hierarchyArr.push(newObj);// we push our record object into 'hiearchyArr' defined on line 35
74
73
}
75
74
76
-
if(obj.children){
77
-
// if argument has a 'children' array, we iterate through it and run 'displayArray' on each element
75
+
if(obj.children){// if argument has a 'children' array, we iterate through it and run 'displayArray' on each element
78
76
obj.children.forEach((element): void=>{
79
77
displayArray(element);
80
78
});
@@ -98,8 +96,7 @@ function ActionContainer(props): JSX.Element {
98
96
currIndex++;
99
97
if(currIndex>hierarchyArr.length-1)return;
100
98
dispatch(changeView(currIndex));
101
-
}elseif(e.key==='Enter'){
102
-
// enter key pressed
99
+
}elseif(e.key==='Enter'){// enter key pressed
103
100
e.stopPropagation();// prevents further propagation of the current event in the capturing and bubbling phases
104
101
e.preventDefault();// needed or will trigger onClick right after
105
102
dispatch(changeSlider(currIndex));
@@ -108,8 +105,6 @@ function ActionContainer(props): JSX.Element {
108
105
109
106
// Sort hierarchyArr by index property of each object. This will be useful when later when we build our components so that our components will be displayed in index/chronological order
// Sort hierarchyArr by index property of each object. This will be useful later when we render the components: components will be displayed in index/chronological order
0 commit comments