Skip to content

Commit 640b860

Browse files
authored
Merge pull request #1 from oslabs-beta/David/Joseph-RouteDescription
David/joseph route description
2 parents 89c4310 + b321d1f commit 640b860

24 files changed

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

src/app/containers/ActionContainer.tsx

Lines changed: 20 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.route.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,16 @@ function ActionContainer(props): JSX.Element {
142146
setRecordingActions(!recordingActions);
143147
};
144148

149+
// Logic to create the route description components
150+
const routes = {};
151+
for (let i = 0; i < actionsArr.length; i++) {
152+
if (!routes.hasOwnProperty(actionsArr[i].props.routePath)) {
153+
routes[actionsArr[i].props.routePath] = [actionsArr[i]];
154+
} else {
155+
routes[actionsArr[i].props.routePath].push(actionsArr[i]);
156+
}
157+
}
158+
145159
// the conditional logic below will cause ActionContainer.test.tsx to fail as it cannot find the Empty button
146160
// UNLESS actionView={true} is passed into <ActionContainer /> in the beforeEach() call in ActionContainer.test.tsx
147161
return (
@@ -184,7 +198,12 @@ function ActionContainer(props): JSX.Element {
184198
Clear
185199
</button>
186200
</div>
187-
<div>{actionsArr}</div>
201+
{/* Rendering of route description components */}
202+
{Object.keys(routes).map((route) => {
203+
return (
204+
<RouteDescription actions = {routes[route]}></RouteDescription>
205+
)
206+
})}
188207
</div>
189208
) : null}
190209
</div>

src/app/module.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ declare module 'enzyme-adapter-react-16';
1414
declare module 'enzyme';
1515
declare module 'react-apexcharts';
1616
declare module 'react-hover';
17+

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
}
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)