Skip to content

Commit 7ba2019

Browse files
committed
RouteDescription Completed
git commit -m mergeMessageHere
1 parent 89c4310 commit 7ba2019

24 files changed

+377
-212
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import React from "react";
2+
3+
const RouteDescription = (props) => {
4+
const url = new URL(props.actions[0].props.routePath);
5+
return (
6+
<div className="routedescription">
7+
<h3 className='route'>Route: {url.pathname}</h3>
8+
{props.actions}
9+
</div>
10+
);
11+
};
12+
13+
export default RouteDescription;

src/app/containers/ActionContainer.tsx

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import Action from '../components/Action';
1010
import SwitchAppDropdown from '../components/SwitchApp';
1111
import { emptySnapshots, changeView, changeSlider } from '../actions/actions';
1212
import { useStoreContext } from '../store';
13+
import RouteDescription from '../components/RouteDescription';
14+
1315

1416
const resetSlider = () => {
1517
const slider = document.querySelector('.rc-slider-handle');
@@ -50,6 +52,7 @@ function ActionContainer(props): JSX.Element {
5052
displayName: `${obj.name}.${obj.branch}`,
5153
state: obj.stateSnapshot.children[0].state,
5254
componentName: obj.stateSnapshot.children[0].name,
55+
routePath: obj.stateSnapshot.url,
5356
// nathan testing new entries for component name, original above
5457
// componentName: findDiff(obj.index),
5558
componentData:
@@ -123,6 +126,7 @@ function ActionContainer(props): JSX.Element {
123126
handleOnkeyDown={handleOnKeyDown}
124127
viewIndex={viewIndex}
125128
isCurrIndex={isCurrIndex}
129+
routePath={snapshot.routePath}
126130
/>
127131

128132
);
@@ -142,6 +146,29 @@ function ActionContainer(props): JSX.Element {
142146
setRecordingActions(!recordingActions);
143147
};
144148

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+
145172
// the conditional logic below will cause ActionContainer.test.tsx to fail as it cannot find the Empty button
146173
// UNLESS actionView={true} is passed into <ActionContainer /> in the beforeEach() call in ActionContainer.test.tsx
147174
return (
@@ -184,7 +211,11 @@ function ActionContainer(props): JSX.Element {
184211
Clear
185212
</button>
186213
</div>
187-
<div>{actionsArr}</div>
214+
{Object.keys(cache2).map((element) => {
215+
return (
216+
<RouteDescription actions = {cache2[element]}></RouteDescription>
217+
)
218+
})}
188219
</div>
189220
) : null}
190221
</div>

src/app/styles/components/_buttons.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
.empty-button {
5252
padding: 3px;
5353
outline: transparent;
54-
color: white;
54+
color: black;
5555
display: flex;
5656
justify-content: center;
5757
align-items: center;
@@ -63,7 +63,7 @@
6363
font: 300 14px 'Roboto', sans-serif;
6464
font-size: $button-text-size;
6565
width: 120px;
66-
background: $red-color-gradient;
66+
background: #62d6fb;
6767
}
6868

6969
.empty-button:hover {

src/app/styles/layout/_actionContainer.scss

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,11 @@
2424
#recordBtn .fa-regular{
2525
height: 100%;
2626
width: 28px;
27+
}
28+
29+
.route {
30+
background-color: #ff6569;
31+
padding-left: 10px;
32+
padding-top: 5px;
33+
padding-bottom: 5px;
2734
}

src/backend/linkFiber.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ function sendSnapshot(snap: Snapshot, mode: Mode): void {
9494
}
9595
const payload = snap.tree.cleanTreeCopy();
9696
// if it's Recoil - run different actions
97+
payload.url = window.location.href;
9798
if (isRecoil) {
9899
// getRecoilState()
99100
payload.atomsComponents = atomsComponents;
220 Bytes
Binary file not shown.
Binary file not shown.
4.03 KB
Loading
2.3 KB
Loading
54.3 KB
Loading

0 commit comments

Comments
 (0)