2022-01-02 02:40:11 +03:00
|
|
|
import React, { FunctionComponent } from 'react';
|
2024-02-24 11:45:48 -08:00
|
|
|
|
2024-08-15 02:33:50 -04:00
|
|
|
import globalize from 'lib/globalize';
|
2024-02-24 11:45:48 -08:00
|
|
|
import { navigate } from '../../../utils/dashboard';
|
|
|
|
import LinkButton from '../../../elements/emby-button/LinkButton';
|
2022-01-02 02:40:11 +03:00
|
|
|
|
|
|
|
type IProps = {
|
|
|
|
activeTab: string;
|
2023-05-02 15:54:53 -04:00
|
|
|
};
|
2022-01-02 02:40:11 +03:00
|
|
|
|
2024-02-24 11:45:48 -08:00
|
|
|
function useNavigate(url: string): () => void {
|
|
|
|
return React.useCallback(() => {
|
|
|
|
navigate(url, true).catch(err => {
|
|
|
|
console.warn('Error navigating to dashboard url', err);
|
|
|
|
});
|
|
|
|
}, [url]);
|
|
|
|
}
|
2022-01-02 02:40:11 +03:00
|
|
|
|
2023-03-29 00:38:22 -04:00
|
|
|
const SectionTabs: FunctionComponent<IProps> = ({ activeTab }: IProps) => {
|
2024-02-24 11:45:48 -08:00
|
|
|
const onClickProfile = useNavigate('/dashboard/users/profile');
|
|
|
|
const onClickAccess = useNavigate('/dashboard/users/access');
|
|
|
|
const onClickParentalControl = useNavigate('/dashboard/users/parentalcontrol');
|
|
|
|
const clickPassword = useNavigate('/dashboard/users/password');
|
2022-01-02 02:40:11 +03:00
|
|
|
return (
|
|
|
|
<div
|
|
|
|
data-role='controlgroup'
|
|
|
|
data-type='horizontal'
|
2024-02-24 11:45:48 -08:00
|
|
|
className='localnav'>
|
|
|
|
<LinkButton
|
|
|
|
href='#'
|
|
|
|
data-role='button'
|
|
|
|
className={activeTab === 'useredit' ? 'ui-btn-active' : ''}
|
|
|
|
onClick={onClickProfile}>
|
|
|
|
{globalize.translate('Profile')}
|
|
|
|
</LinkButton>
|
|
|
|
<LinkButton
|
|
|
|
href='#'
|
|
|
|
data-role='button'
|
|
|
|
className={activeTab === 'userlibraryaccess' ? 'ui-btn-active' : ''}
|
|
|
|
onClick={onClickAccess}>
|
|
|
|
{globalize.translate('TabAccess')}
|
|
|
|
</LinkButton>
|
|
|
|
<LinkButton
|
|
|
|
href='#'
|
|
|
|
data-role='button'
|
|
|
|
className={activeTab === 'userparentalcontrol' ? 'ui-btn-active' : ''}
|
|
|
|
onClick={onClickParentalControl}>
|
|
|
|
{globalize.translate('TabParentalControl')}
|
|
|
|
</LinkButton>
|
|
|
|
<LinkButton
|
|
|
|
href='#'
|
|
|
|
data-role='button'
|
|
|
|
className={activeTab === 'userpassword' ? 'ui-btn-active' : ''}
|
|
|
|
onClick={clickPassword}>
|
|
|
|
{globalize.translate('HeaderPassword')}
|
|
|
|
</LinkButton>
|
|
|
|
</div>
|
2022-01-02 02:40:11 +03:00
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default SectionTabs;
|