Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/app/components/Actions/Action.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { ActionProps, OptionsCursorTrueWithMargin } from '../../FrontendTypes';
import { useDispatch } from 'react-redux';

/*
This render's the individual snapshot components on the left side column
This renders the individual snapshot components on the left side column
*/

/**
Expand Down
25 changes: 25 additions & 0 deletions src/app/components/Actions/DropDown.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import Select from 'react-select';
import React, { useEffect, useState } from 'react';

const DropDown = (): JSX.Element => {
const [hook, setHook] = useState('useState');

const handleChange = (selectedHook: {hooks:string}) => {
setHook(selectedHook);
}

const options = [
{value: 'useState', label: 'useState'},
{value: 'useReducer', label: 'useReducer'},
{value: 'useContext', label: 'useContext'}
];

return (
<Select
placeholder = 'Select Hook'
onChange={handleChange}
options = {options}
/>
)
}
export default DropDown;
9 changes: 9 additions & 0 deletions src/app/components/Actions/SwitchApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const SwitchAppDropdown = (): JSX.Element => {
value: currentTab,
label: tabs[currentTab].title,
};
console.log('tabs', tabs)

const customStyles: {} = {
menu: (provided, state): {} => {
Expand All @@ -39,6 +40,11 @@ const SwitchAppDropdown = (): JSX.Element => {
},
};

const customComponents = {
DropdownIndicator: () => null,
IndicatorSeparator: () => null, // Removes the separator line
};

return (
<Select
className='tab-select-container'
Expand All @@ -49,6 +55,9 @@ const SwitchAppDropdown = (): JSX.Element => {
dispatch(setTab(parseInt(e.value, 10)));
}}
options={tabsArray}
isSearchable={false} // Disable search functionality
menuIsOpen={false} // Prevent dropdown from opening
components={customComponents}
/>
);
};
Expand Down
4 changes: 4 additions & 0 deletions src/app/containers/ActionContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
import React, { useEffect, useState } from 'react';
import Action from '../components/Actions/Action';
import SwitchAppDropdown from '../components/Actions/SwitchApp';
// Import new dropdown
import { emptySnapshots, changeView, changeSlider } from '../slices/mainSlice';
import { useDispatch, useSelector } from 'react-redux';
import RouteDescription from '../components/Actions/RouteDescription';
import DropDown from '../components/Actions/DropDown';
import { ActionContainerProps, CurrentTab, MainState, Obj, RootState } from '../FrontendTypes';
import { Button, Switch } from '@mui/material';

Expand Down Expand Up @@ -221,6 +223,8 @@ function ActionContainer(props: ActionContainerProps): JSX.Element {
{recordingActions ? <Switch defaultChecked /> : <Switch />}
</a>
<SwitchAppDropdown />
{/* add new component here for dropdown menu for useStae/ useReducer- ragad */}
<DropDown />
<div className='action-component exclude'>
<Button
className='clear-button'
Expand Down