@@ -10,6 +10,8 @@ import Action from '../components/Action';
10
10
import SwitchAppDropdown from '../components/SwitchApp' ;
11
11
import { emptySnapshots , changeView , changeSlider } from '../actions/actions' ;
12
12
import { useStoreContext } from '../store' ;
13
+ import RouteDescription from '../components/RouteDescription' ;
14
+
13
15
14
16
const resetSlider = ( ) => {
15
17
const slider = document . querySelector ( '.rc-slider-handle' ) ;
@@ -50,6 +52,7 @@ function ActionContainer(props): JSX.Element {
50
52
displayName : `${ obj . name } .${ obj . branch } ` ,
51
53
state : obj . stateSnapshot . children [ 0 ] . state ,
52
54
componentName : obj . stateSnapshot . children [ 0 ] . name ,
55
+ routePath : obj . stateSnapshot . url ,
53
56
// nathan testing new entries for component name, original above
54
57
// componentName: findDiff(obj.index),
55
58
componentData :
@@ -123,6 +126,7 @@ function ActionContainer(props): JSX.Element {
123
126
handleOnkeyDown = { handleOnKeyDown }
124
127
viewIndex = { viewIndex }
125
128
isCurrIndex = { isCurrIndex }
129
+ routePath = { snapshot . routePath }
126
130
/>
127
131
128
132
) ;
@@ -142,6 +146,29 @@ function ActionContainer(props): JSX.Element {
142
146
setRecordingActions ( ! recordingActions ) ;
143
147
} ;
144
148
149
+
150
+ // Create a cache that will be an array of all the route paths.
151
+ const cache = [ ] ;
152
+ for ( let i = 0 ; i < actionsArr . length ; i ++ ) {
153
+ if ( ! cache . includes ( actionsArr [ i ] . props . routePath ) ) {
154
+ cache . push ( actionsArr [ i ] . props . routePath ) ;
155
+ }
156
+ }
157
+ // Create cache2 as an object route path as a key and the individual-actions as the value.
158
+ const cache2 = { } ;
159
+ for ( const element of cache ) {
160
+ cache2 [ element ] = [ ] ;
161
+ }
162
+ // Create a conditional that will check if the individual-action matches the route path and add it to the cache2.
163
+ for ( let i = 0 ; i < actionsArr . length ; i ++ ) {
164
+ for ( const key in cache2 ) {
165
+ if ( actionsArr [ i ] . props . routePath === key ) {
166
+ cache2 [ key ] . push ( actionsArr [ i ] ) ;
167
+ }
168
+ }
169
+ }
170
+
171
+
145
172
// the conditional logic below will cause ActionContainer.test.tsx to fail as it cannot find the Empty button
146
173
// UNLESS actionView={true} is passed into <ActionContainer /> in the beforeEach() call in ActionContainer.test.tsx
147
174
return (
@@ -184,7 +211,11 @@ function ActionContainer(props): JSX.Element {
184
211
Clear
185
212
</ button >
186
213
</ div >
187
- < div > { actionsArr } </ div >
214
+ { Object . keys ( cache2 ) . map ( ( element ) => {
215
+ return (
216
+ < RouteDescription actions = { cache2 [ element ] } > </ RouteDescription >
217
+ )
218
+ } ) }
188
219
</ div >
189
220
) : null }
190
221
</ div >
0 commit comments