Skip to content

Commit f7f1754

Browse files
committed
Merge branch 'dev' into feature/garrett
2 parents 4f2a453 + 759e5e0 commit f7f1754

File tree

5 files changed

+63
-5
lines changed

5 files changed

+63
-5
lines changed

src/app/components/Actions/Action.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { ActionProps, OptionsCursorTrueWithMargin } from '../../FrontendTypes';
99
import { useDispatch } from 'react-redux';
1010

1111
/*
12-
This render's the individual snapshot components on the left side column
12+
This renders the individual snapshot components on the left side column
1313
*/
1414

1515
/**
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import Select from 'react-select';
2+
import React from 'react';
3+
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+
};
8+
9+
const options = [
10+
{ value: 'TimeJump', label: 'TimeJump' },
11+
{ value: 'Provider/Consumer', label: 'Provider/Consumer' },
12+
];
13+
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+
};
23+
24+
export default DropDown;

src/app/components/Actions/SwitchApp.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ const SwitchAppDropdown = (): JSX.Element => {
2828
value: currentTab,
2929
label: tabs[currentTab].title,
3030
};
31+
console.log('tabs', tabs)
3132

3233
const customStyles: {} = {
3334
menu: (provided, state): {} => {
@@ -39,6 +40,11 @@ const SwitchAppDropdown = (): JSX.Element => {
3940
},
4041
};
4142

43+
const customComponents = {
44+
DropdownIndicator: () => null,
45+
IndicatorSeparator: () => null, // Removes the separator line
46+
};
47+
4248
return (
4349
<Select
4450
className='tab-select-container'
@@ -49,6 +55,9 @@ const SwitchAppDropdown = (): JSX.Element => {
4955
dispatch(setTab(parseInt(e.value, 10)));
5056
}}
5157
options={tabsArray}
58+
isSearchable={false} // Disable search functionality
59+
menuIsOpen={false} // Prevent dropdown from opening
60+
components={customComponents}
5261
/>
5362
);
5463
};

src/app/containers/ActionContainer.tsx

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,16 @@
22
import React, { useEffect, useState } from 'react';
33
import Action from '../components/Actions/Action';
44
import SwitchAppDropdown from '../components/Actions/SwitchApp';
5+
// Import new dropdown
56
import { emptySnapshots, changeView, changeSlider } from '../slices/mainSlice';
67
import { useDispatch, useSelector } from 'react-redux';
78
import RouteDescription from '../components/Actions/RouteDescription';
9+
import DropDown from '../components/Actions/DropDown';
10+
import ProvConContainer from './ProvConContainer';
811
import { ActionContainerProps, CurrentTab, MainState, Obj, RootState } from '../FrontendTypes';
912
import { Button, Switch } from '@mui/material';
1013

14+
1115
/*
1216
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.
1317
*/
@@ -23,6 +27,9 @@ const resetSlider = () => {
2327
};
2428

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

@@ -221,6 +228,11 @@ function ActionContainer(props: ActionContainerProps): JSX.Element {
221228
{recordingActions ? <Switch defaultChecked /> : <Switch />}
222229
</a>
223230
<SwitchAppDropdown />
231+
{/* add new component here for dropdown menu for useStae/ useReducer- ragad */}
232+
<DropDown
233+
dropdownSelection = {dropdownSelection}
234+
setDropdownSelection={setDropdownSelection}
235+
/>
224236
<div className='action-component exclude'>
225237
<Button
226238
className='clear-button'
@@ -235,10 +247,12 @@ function ActionContainer(props: ActionContainerProps): JSX.Element {
235247
Clear
236248
</Button>
237249
</div>
238-
{/* Rendering of route description components */}
239-
{Object.keys(routes).map((route, i) => (
240-
<RouteDescription key={`route${i}`} actions={routes[route]} />
241-
))}
250+
{dropdownSelection === 'Provider/Consumer' && <ProvConContainer/>}
251+
{dropdownSelection === 'TimeJump' &&
252+
Object.keys(routes).map((route, i) => (
253+
<RouteDescription key={`route${i}`} actions={routes[route]} />
254+
))
255+
}
242256
</div>
243257
) : null}
244258
</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)