11import * as React from 'react'
2- import { DialogContent , AppBar , Tabs , Tab , Box } from '@mui/material'
32import { useTranslation } from 'react-i18next'
3+ import TabContext from '@mui/lab/TabContext'
4+ import TabList from '@mui/lab/TabList'
5+ import TabPanel from '@mui/lab/TabPanel'
6+ import Tab from '@mui/material/Tab'
7+ import Box from '@mui/material/Box'
8+ import DialogContent from '@mui/material/DialogContent'
49
510import { useMemory } from '@hooks/useMemory'
611import { useLayoutStore } from '@hooks/useLayoutStore'
712import Utility from '@services/Utility'
813
914import Header from '../../general/Header'
1015import Footer from '../../general/Footer'
11- import TabPanel from '../../general/TabPanel'
1216import { DialogWrapper } from '../DialogWrapper'
1317import { UserBackups } from './Backups'
1418import { UserPermissions } from './Permissions'
@@ -24,8 +28,9 @@ export default function UserProfile() {
2428
2529 const locale = localStorage . getItem ( 'i18nextLng' ) || 'en'
2630
27- const [ tab , setTab ] = React . useState ( 0 )
31+ const [ tab , setTab ] = React . useState ( 'profile' )
2832 const [ tabsHeight , setTabsHeight ] = React . useState ( 0 )
33+
2934 const handleTabChange = ( _event , newValue ) => {
3035 setTab ( newValue )
3136 }
@@ -42,36 +47,37 @@ export default function UserProfile() {
4247 action = { handleClose }
4348 />
4449 < DialogContent sx = { { p : 0 } } >
45- < AppBar
46- position = "static"
47- ref = { ( ref ) => ref && setTabsHeight ( ref . clientHeight ) }
48- >
49- < Tabs value = { tab } onChange = { handleTabChange } >
50+ < TabContext value = { tab } >
51+ < TabList
52+ onChange = { handleTabChange }
53+ ref = { ( ref ) => ref && setTabsHeight ( ref . clientHeight ) }
54+ >
5055 { [ 'profile' , 'badges' , 'access' ] . map ( ( each ) => (
51- < Tab key = { each } label = { t ( each ) } />
56+ < Tab key = { each } label = { t ( each ) } value = { each } />
5257 ) ) }
53- </ Tabs >
54- </ AppBar >
55- < Box
56- overflow = "auto"
57- maxHeight = { {
58- xs : `calc(100% - ${ tabsHeight } px)` ,
59- sm : `calc(75vh - ${ tabsHeight } px)` ,
60- } }
61- minHeight = "70vh"
62- >
63- < TabPanel value = { tab } index = { 0 } >
64- < LinkAccounts />
65- < ExtraUserFields />
66- < UserBackups />
67- </ TabPanel >
68- < TabPanel value = { tab } index = { 1 } >
69- < UserGymBadges />
70- </ TabPanel >
71- < TabPanel value = { tab } index = { 2 } >
72- < UserPermissions />
73- </ TabPanel >
74- </ Box >
58+ </ TabList >
59+ < Box
60+ overflow = "auto"
61+ height = { {
62+ xs : `calc(100% - ${ tabsHeight } px)` ,
63+ sm : `calc(70vh - ${ tabsHeight } px)` ,
64+ } }
65+ >
66+ < TabPanel value = "profile" >
67+ < LinkAccounts />
68+ < ExtraUserFields />
69+ < UserBackups />
70+ </ TabPanel >
71+ < TabPanel value = "badges" sx = { { height : '100%' , px : 0 } } >
72+ < Box className = "profile-container" >
73+ < UserGymBadges />
74+ </ Box >
75+ </ TabPanel >
76+ < TabPanel value = "access" >
77+ < UserPermissions />
78+ </ TabPanel >
79+ </ Box >
80+ </ TabContext >
7581 </ DialogContent >
7682 < Footer
7783 options = { [
0 commit comments