Skip to content

Commit da3451c

Browse files
Merge branch 'dev' into click-tab/ragad
2 parents a65ab5d + 759e5e0 commit da3451c

File tree

3 files changed

+44
-29
lines changed

3 files changed

+44
-29
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-
const DropDown = (): JSX.Element => {
5-
// const [hook, setHook] = useState('useState');
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);
7+
};
68

7-
// const handleChange = (options: {value:string}) => {
8-
// setHook(options.value);
9-
// }
9+
const options = [
10+
{ value: 'TimeJump', label: 'TimeJump' },
11+
{ value: 'Provider/Consumer', label: 'Provider/Consumer' },
12+
];
1013

11-
const options = [
12-
{value: 'useState', label: 'useState'},
13-
{value: 'useReducer', label: 'useReducer'},
14-
{value: 'useContext', label: 'useContext'}
15-
];
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+
};
1623

17-
return (
18-
<div>
19-
<Select
20-
placeholder = 'Select Hook'
21-
// onChange={handleChange}
22-
options = {options}
23-
/>
24-
{/* <p>Selected Hook: {hook}</p> */}
25-
</div>
26-
27-
)
28-
}
29-
export default DropDown;
24+
export default DropDown;

src/app/containers/ActionContainer.tsx

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ 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
import ClickableLink from '../components/Actions/ClickableLink';
@@ -25,6 +26,9 @@ const resetSlider = () => {
2526
};
2627

2728
function ActionContainer(props: ActionContainerProps): JSX.Element {
29+
30+
const [dropdownSelection, setDropdownSelection] = useState('TimeJump');
31+
2832
const dispatch = useDispatch();
2933
const { currentTab, tabs, port }: MainState = useSelector((state: RootState) => state.main);
3034

@@ -225,7 +229,10 @@ function ActionContainer(props: ActionContainerProps): JSX.Element {
225229
<SwitchAppDropdown />
226230
{/* add new component here for dropdown menu for useStae/ useReducer- ragad */}
227231

228-
<DropDown />
232+
<DropDown
233+
dropdownSelection = {dropdownSelection}
234+
setDropdownSelection={setDropdownSelection}
235+
/>
229236
<ClickableLink />
230237
<div className='action-component exclude'>
231238
<Button
@@ -241,10 +248,12 @@ function ActionContainer(props: ActionContainerProps): JSX.Element {
241248
Clear
242249
</Button>
243250
</div>
244-
{/* Rendering of route description components */}
245-
{Object.keys(routes).map((route, i) => (
246-
<RouteDescription key={`route${i}`} actions={routes[route]} />
247-
))}
251+
{dropdownSelection === 'Provider/Consumer' && <ProvConContainer/>}
252+
{dropdownSelection === 'TimeJump' &&
253+
Object.keys(routes).map((route, i) => (
254+
<RouteDescription key={`route${i}`} actions={routes[route]} />
255+
))
256+
}
248257
</div>
249258
) : null}
250259
</div>
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)