Skip to content

Commit b9bf77d

Browse files
commit
1 parent 8c08d60 commit b9bf77d

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/app/containers/ActionContainer.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import { useStoreContext } from '../store';
1010
import RouteDescription from '../components/RouteDescription';
1111
import { Obj } from '../FrontendTypes';
1212

13+
14+
// resetSlider locates the rc-slider elements on the document and resets it's style attributes
1315
const resetSlider = () => {
1416
const slider = document.querySelector('.rc-slider-handle');
1517
const sliderTrack = document.querySelector('.rc-slider-track');
@@ -19,21 +21,35 @@ const resetSlider = () => {
1921
}
2022
};
2123

24+
2225
function ActionContainer(props): JSX.Element {
26+
// we destructure the returned context object from the invocation of the useStoreContext function. Properties not found on the initialState object (dispatch) are from the useReducer function invocation in the App component
2327
const [{ tabs, currentTab, port }, dispatch] = useStoreContext();
28+
29+
// we destructure the currentTab object
2430
const { currLocation, hierarchy, sliderIndex, viewIndex } = tabs[currentTab];
31+
32+
// we destructure our props object
2533
const { toggleActionContainer, actionView, setActionView } = props;
34+
35+
// We create a local state 'recordingActions' and set it to true
2636
const [recordingActions, setRecordingActions] = useState(true);
2737

38+
// we create an array 'actionsArr' that will hold elements we create later on
2839
let actionsArr: JSX.Element[] = [];
40+
// we create an array 'hierarchyArr' that will hold objects and numbers
2941
const hierarchyArr: (number | {})[] = [];
3042

3143
// function to traverse state from hierarchy and also getting information on display name and component name
3244
const displayArray = (obj: Obj): void => {
3345
if (
46+
// if the stateSnapshot has a non-empty children array
3447
obj.stateSnapshot.children.length > 0 &&
48+
// and there is an element
3549
obj.stateSnapshot.children[0] &&
50+
// with a state
3651
obj.stateSnapshot.children[0].state &&
52+
// and a name
3753
obj.stateSnapshot.children[0].name
3854
) {
3955
const newObj: Record<string, unknown> = {

0 commit comments

Comments
 (0)