Skip to content

Commit 98498ab

Browse files
authored
Merge pull request #8 from oslabs-beta/PatriceFeature
Refactor 'Route Description' and 'Action Container' for Visual Cleanliness
2 parents 7bb8211 + 0f0b00e commit 98498ab

File tree

2 files changed

+25
-26
lines changed

2 files changed

+25
-26
lines changed

src/app/components/Actions/RouteDescription.tsx

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import React from 'react';
2+
import Slider from 'rc-slider';
3+
import VerticalSlider from '../TimeTravel/VerticalSlider';
24

35
/*
46
Render's the red route description on app's left sided column between the clear button and the list of state snapshots. The route description is derived from the first state snapshot.
@@ -12,12 +14,26 @@ const RouteDescription = (props: RouteProps): JSX.Element => {
1214
const { actions } = props;
1315

1416
const url: URL = new URL(actions[0].props.routePath); // Use new URL to use the url.pathname method.
17+
1518
return (
16-
<div className='routedescription'>
17-
<h3 className='route'>Route: {url.pathname}</h3>
18-
{actions}
19-
</div>
19+
<div className='routedescription' >
20+
<h3 className='route'>Route: {url.pathname}</h3>
21+
<div style={{
22+
// div that contains slider and snapshots
23+
display: 'flex',
24+
flexDirection: 'row',
25+
height: `${actions.length * 30}px`,
26+
marginBottom: '50px'
27+
}}>
28+
<VerticalSlider className='main-slider' snapshots={actions} />
29+
<div style={{marginTop: '10px'}}>
30+
{/* actual snapshots per route */}
31+
{actions}
32+
</div>
33+
</div>
34+
</div>
2035
);
2136
};
2237

38+
2339
export default RouteDescription;

src/app/containers/ActionContainer.tsx

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ import ProvConContainer from './ProvConContainer';
1010
import { ActionContainerProps, CurrentTab, MainState, Obj, RootState } from '../FrontendTypes';
1111
import { Button, Switch } from '@mui/material';
1212

13-
import Slider from 'rc-slider';
14-
import VerticalSlider from '../components/TimeTravel/VerticalSlider';
15-
1613
/*
1714
This file renders the 'ActionContainer'. The action container is the leftmost column in the application. It includes the button that shrinks and expands the action container, a dropdown to select the active site, a clear button, the current selected Route, and a list of selectable snapshots with timestamps.
1815
*/
@@ -252,27 +249,13 @@ function ActionContainer(props: ActionContainerProps): JSX.Element {
252249
Clear
253250
</Button>
254251
</div>
255-
<div className='MapRouteAndSlider' style={{
256-
display: 'flex',
257-
flexDirection: 'row',
258-
alignItems: 'flex-start',
259-
}}>
260-
<div className='snapshots'>
261-
{dropdownSelection === 'Provider/Consumer' && <ProvConContainer/>}
262-
{dropdownSelection === 'TimeJump' &&
263-
Object.keys(routes).map((route, i) => (
264-
<div style={{
265-
display: 'flex',
266-
flexDirection: 'row',
267-
height: `${routes[route].length * 4.5}vh`,
268-
marginBottom: '30px'
269-
}}>
270-
<VerticalSlider className='main-slider' snapshots={routes[route]}/>
252+
<div className='snapshots'>
253+
{dropdownSelection === 'Provider/Consumer' && <ProvConContainer/>}
254+
{dropdownSelection === 'TimeJump' &&
255+
Object.keys(routes).map((route, i) => (
271256
<RouteDescription key={`route${i}`} actions={routes[route]} />
272-
</div>
273257
))
274-
}
275-
</div>
258+
}
276259
</div>
277260
</div>
278261
) : null}

0 commit comments

Comments
 (0)