Skip to content

Commit 5a89b32

Browse files
committed
Original Changes before dev pull
1 parent 606b08c commit 5a89b32

File tree

4 files changed

+49
-37
lines changed

4 files changed

+49
-37
lines changed
Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,24 @@
11
import Select from 'react-select';
2-
import React, { useEffect, useState } from 'react';
2+
import React from 'react';
33

4-
interface DropDownProps {
5-
onChange: (selectedHook: string) => void;
6-
}
4+
const DropDown = ({ dropdownSelection, setDropdownSelection }: { dropdownSelection: string; setDropdownSelection: (value: string) => void }): JSX.Element => {
5+
const handleChange = (selected: { value: string; label: string }) => {
6+
setDropdownSelection(selected.value); // Update parent state
7+
};
78

8-
const DropDown = ({onChange}: DropDownProps): JSX.Element => {
9-
10-
const options = [
11-
{value: 'useState', label: 'useState'},
12-
{value: 'useReducer', label: 'useReducer'},
13-
{value: 'useContext', label: 'useContext'}
14-
];
15-
const handleChange = (selectedHook: {value:string; label: string} | null) => {
16-
onChange(selectedHook.value);
17-
}
9+
const options = [
10+
{ value: 'TimeJump', label: 'TimeJump' },
11+
{ value: 'Provider/Consumer', label: 'Provider/Consumer' },
12+
];
1813

14+
return (
15+
<Select
16+
placeholder="Select Hook"
17+
onChange={handleChange}
18+
options={options}
19+
value={options.find((option) => option.value === dropdownSelection)}
20+
/>
21+
);
22+
};
1923

20-
21-
return (
22-
<Select
23-
placeholder = 'Select Hook'
24-
onChange={handleChange}
25-
options = {options}
26-
/>
27-
)
28-
}
29-
export default DropDown;
24+
export default DropDown;

src/app/containers/ActionContainer.tsx

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ import { emptySnapshots, changeView, changeSlider } from '../slices/mainSlice';
77
import { useDispatch, useSelector } from 'react-redux';
88
import RouteDescription from '../components/Actions/RouteDescription';
99
import DropDown from '../components/Actions/DropDown';
10+
import ProvConContainer from './ProvConContainer';
1011
import { ActionContainerProps, CurrentTab, MainState, Obj, RootState } from '../FrontendTypes';
1112
import { Button, Switch } from '@mui/material';
1213

14+
1315
/*
1416
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.
1517
*/
@@ -25,6 +27,9 @@ const resetSlider = () => {
2527
};
2628

2729
function ActionContainer(props: ActionContainerProps): JSX.Element {
30+
31+
const [dropdownSelection, setDropdownSelection] = useState('TimeJump');
32+
2833
const dispatch = useDispatch();
2934
const { currentTab, tabs, port }: MainState = useSelector((state: RootState) => state.main);
3035

@@ -224,7 +229,10 @@ function ActionContainer(props: ActionContainerProps): JSX.Element {
224229
</a>
225230
<SwitchAppDropdown />
226231
{/* add new component here for dropdown menu for useStae/ useReducer- ragad */}
227-
<DropDown onChange={useState} />
232+
<DropDown
233+
dropdownSelection = {dropdownSelection}
234+
setDropdownSelection={setDropdownSelection}
235+
/>
228236
<div className='action-component exclude'>
229237
<Button
230238
className='clear-button'
@@ -240,9 +248,17 @@ function ActionContainer(props: ActionContainerProps): JSX.Element {
240248
</Button>
241249
</div>
242250
{/* Rendering of route description components */}
243-
{Object.keys(routes).map((route, i) => (
251+
{/* {Object.keys(routes).map((route, i) => (
244252
<RouteDescription key={`route${i}`} actions={routes[route]} />
245-
))}
253+
))} */}
254+
{/* <ProvConContainer/> */}
255+
256+
{dropdownSelection === 'Provider/Consumer' && <ProvConContainer/>}
257+
{dropdownSelection === 'TimeJump' &&
258+
Object.keys(routes).map((route, i) => (
259+
<RouteDescription key={`route${i}`} actions={routes[route]} />
260+
))
261+
}
246262
</div>
247263
) : null}
248264
</div>

src/app/containers/MainContainer.tsx

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ import TravelContainer from './TravelContainer';
55
import ButtonsContainer from './ButtonsContainer';
66
import ErrorContainer from './ErrorContainer';
77
import StateContainer from './StateContainer';
8-
import ReduceContainer from './ReduceContainer'
9-
import DropDown from '../components/Actions/DropDown';
108
import {
119
addNewSnapshots,
1210
initialConnect,
@@ -39,7 +37,6 @@ function MainContainer(): JSX.Element {
3937

4038
const [actionView, setActionView] = useState(true); // We create a local state 'actionView' and set it to true
4139

42-
const [hook, setHook] = useState('useState');
4340
// this function handles Time Jump sidebar view
4441
const toggleActionContainer = () => {
4542
setActionView(!actionView); // sets actionView to the opposite boolean value
@@ -211,7 +208,6 @@ function MainContainer(): JSX.Element {
211208
return (
212209
<div className='main-container'>
213210
<div id='bodyContainer' className='body-container'>
214-
<DropDown onChange={(value) => setHook(value)}/>
215211
<ActionContainer
216212
actionView={actionView}
217213
setActionView={setActionView}
@@ -233,12 +229,6 @@ function MainContainer(): JSX.Element {
233229
currLocation={currLocation}
234230
axSnapshots={axSnapshots}
235231
/>
236-
{hook === 'useReducer' && (
237-
<div className="state-container-container">
238-
<ReduceContainer />
239-
</div>
240-
)}
241-
242232
</div>
243233
) : null}
244234
{/* @ts-ignore */}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import React from "react";
2+
3+
const ProvConContainer = (): JSX.Element => {
4+
return (
5+
<div>
6+
hello
7+
</div>
8+
)
9+
}
10+
11+
export default ProvConContainer;

0 commit comments

Comments
 (0)