import { Box, Paper, Tab, Tabs, Typography } from '@material-ui/core'; import useTheme from '@material-ui/core/styles/useTheme'; import React from 'react'; import { useSelector } from 'react-redux'; import Scaffold from '../../containers/layouts/Scaffold'; import useActions from '../../redux/actions'; import * as TabActions from '../../redux/actions/tabs'; import { RootState } from '../../redux/reducers'; import AccountSettings from '../../views/Settings/AccountsTab/AccountSettings'; import TeammingTab from '../../views/Settings/TeammingTab'; import UserManagement from '../../views/Settings/UserManagementTab/UserManagement'; import useStyles from './styles'; interface TabPanelProps { children: React.ReactNode; index: any; value: any; } // TabPanel ise used to implement the functioning of tabs function TabPanel(props: TabPanelProps) { const { children, value, index, ...other } = props; return ( ); } // tabProps returns 'id' and 'aria-control' props of Tab function tabProps(index: any) { return { id: `simple-tab-${index}`, 'aria-controls': `simple-tabpanel-${index}`, }; } const Settings: React.FC = () => { const classes = useStyles(); const settingsTabValue = useSelector( (state: RootState) => state.tabNumber.settings ); const userData = useSelector((state: RootState) => state.userData); const tabs = useActions(TabActions); const handleChange = (event: React.ChangeEvent<{}>, newValue: number) => { tabs.changeSettingsTabs(newValue); }; const theme = useTheme(); return ( Settings {userData.username === 'admin' ? ( ) : ( <> )} {userData.username === 'admin' ? ( ) : ( <> )} ); }; export default Settings;