From 17d7dfe0efb2ac08d85da94e8dfc2cfafc170e2c Mon Sep 17 00:00:00 2001 From: Alexandre Magno Date: Tue, 19 Sep 2023 14:13:22 +0200 Subject: [PATCH] just shows bank account for maintainer --- .../profile/components/account-tabs.tsx | 79 ++++++------------- 1 file changed, 24 insertions(+), 55 deletions(-) diff --git a/frontend/src/components/profile/components/account-tabs.tsx b/frontend/src/components/profile/components/account-tabs.tsx index fbdbe1b09..6a595c040 100644 --- a/frontend/src/components/profile/components/account-tabs.tsx +++ b/frontend/src/components/profile/components/account-tabs.tsx @@ -13,32 +13,6 @@ import Preferences from '../preferences'; import AccountTabMain from './account-tab-main'; -interface TabPanelProps { - children?: React.ReactNode; - index: number; - value: number; -} - -function TabPanel(props: TabPanelProps) { - const { children, value, index, ...other } = props; - - return ( - - ); -} - export default function AccountTabs({ user, updateUser, @@ -46,27 +20,26 @@ export default function AccountTabs({ addNotification, history, }) { - const [value, setValue] = React.useState(0); - const [index, setIndex] = React.useState(0); + const [value, setValue] = React.useState('account'); - const handleChange = (event: React.SyntheticEvent, newValue: number) => { + const handleChange = (event: React.SyntheticEvent, newValue: string) => { switch (newValue) { - case 0: + case 'account': history.push('/profile/user-account'); break; - case 1: + case 'details': history.push('/profile/user-account/details'); break; - case 2: + case 'bank': history.push('/profile/user-account/bank'); break; - case 3: + case 'roles': history.push('/profile/user-account/roles'); break; - case 4: + case 'skills': history.push('/profile/user-account/skills'); break; - case 5: + case 'settings': history.push('/profile/user-account/settings'); break; default: @@ -77,23 +50,17 @@ export default function AccountTabs({ useEffect(() => { if (history.location.pathname === '/profile/user-account') { - setValue(0) - setIndex(0); + setValue('account') } else if (history.location.pathname === '/profile/user-account/details') { - setValue(1) - setIndex(1); + setValue('details') } else if (history.location.pathname === '/profile/user-account/bank') { - setValue(2) - setIndex(2); + setValue('bank') } else if (history.location.pathname === '/profile/user-account/roles') { - setValue(3) - setIndex(3); + setValue('roles') } else if (history.location.pathname === '/profile/user-account/skills') { - setValue(4) - setIndex(4); + setValue('skills') } else if (history.location.pathname === '/profile/user-account/settings') { - setValue(5) - setIndex(5); + setValue('settings') } }, [history.location.pathname]); @@ -101,15 +68,17 @@ export default function AccountTabs({ - - - - - - + + + { user?.Types?.map(u => u.name)?.includes('contributor') && + + } + + + - + - + ); }