mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
apply suggestions
This commit is contained in:
parent
3c32e871ab
commit
b22a9ed632
5 changed files with 88 additions and 92 deletions
|
@ -1,8 +1,8 @@
|
|||
import React, { FunctionComponent } from 'react';
|
||||
import globalize from '../../../scripts/globalize';
|
||||
|
||||
const createCheckBoxElement = ({ type, className, title }) => ({
|
||||
__html: `<label>
|
||||
const createCheckBoxElement = ({ labelClassName, type, className, title }) => ({
|
||||
__html: `<label class="${labelClassName}">
|
||||
<input
|
||||
is="emby-checkbox"
|
||||
type="${type}"
|
||||
|
@ -13,15 +13,18 @@ const createCheckBoxElement = ({ type, className, title }) => ({
|
|||
});
|
||||
|
||||
type IProps = {
|
||||
labelClassName?: string;
|
||||
type?: string;
|
||||
className?: string;
|
||||
title?: string
|
||||
}
|
||||
|
||||
const CheckBoxElement: FunctionComponent<IProps> = ({ type, className, title }: IProps) => {
|
||||
const CheckBoxElement: FunctionComponent<IProps> = ({ labelClassName, type, className, title }: IProps) => {
|
||||
return (
|
||||
<div
|
||||
className='sectioncheckbox'
|
||||
dangerouslySetInnerHTML={createCheckBoxElement({
|
||||
labelClassName: labelClassName ? labelClassName : '',
|
||||
type: type,
|
||||
className: className,
|
||||
title: globalize.translate(title)
|
||||
|
|
52
src/components/dashboard/users/SectionTabs.tsx
Normal file
52
src/components/dashboard/users/SectionTabs.tsx
Normal file
|
@ -0,0 +1,52 @@
|
|||
import React, { FunctionComponent } from 'react';
|
||||
import globalize from '../../../scripts/globalize';
|
||||
|
||||
type IProps = {
|
||||
activeTab: string;
|
||||
}
|
||||
|
||||
const createLinkElement = ({ activeTab }) => ({
|
||||
__html: `<a href="#"
|
||||
is="emby-linkbutton"
|
||||
data-role="button"
|
||||
class="${activeTab === 'useredit' ? 'ui-btn-active' : ''}"
|
||||
onclick="Dashboard.navigate('useredit.html', true);">
|
||||
${globalize.translate('Profile')}
|
||||
</a>
|
||||
<a href="#"
|
||||
is="emby-linkbutton"
|
||||
data-role="button"
|
||||
class="${activeTab === 'userlibraryaccess' ? 'ui-btn-active' : ''}"
|
||||
onclick="Dashboard.navigate('userlibraryaccess.html', true);">
|
||||
${globalize.translate('TabAccess')}
|
||||
</a>
|
||||
<a href="#"
|
||||
is="emby-linkbutton"
|
||||
data-role="button"
|
||||
class="${activeTab === 'userparentalcontrol' ? 'ui-btn-active' : ''}"
|
||||
onclick="Dashboard.navigate('userparentalcontrol.html', true);">
|
||||
${globalize.translate('TabParentalControl')}
|
||||
</a>
|
||||
<a href="#"
|
||||
is="emby-linkbutton"
|
||||
data-role="button"
|
||||
class="${activeTab === 'userpassword' ? 'ui-btn-active' : ''}"
|
||||
onclick="Dashboard.navigate('userpassword.html', true);">
|
||||
${globalize.translate('HeaderPassword')}
|
||||
</a>`
|
||||
});
|
||||
|
||||
const SectionTabs: FunctionComponent<IProps> = ({activeTab}: IProps) => {
|
||||
return (
|
||||
<div
|
||||
data-role='controlgroup'
|
||||
data-type='horizontal'
|
||||
className='localnav'
|
||||
dangerouslySetInnerHTML={createLinkElement({
|
||||
activeTab: activeTab
|
||||
})}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export default SectionTabs;
|
|
@ -1,36 +0,0 @@
|
|||
// eslint-disable-next-line eslint-comments/disable-enable-pair
|
||||
/* eslint-disable jsx-a11y/no-static-element-interactions */
|
||||
import React, { FunctionComponent } from 'react';
|
||||
import globalize from '../../../scripts/globalize';
|
||||
|
||||
type IProps = {
|
||||
tabTitle?: string;
|
||||
activeTab?: boolean;
|
||||
onClick()
|
||||
}
|
||||
|
||||
const createLinkElement = ({ className, tabTitle }) => ({
|
||||
__html: `<a
|
||||
href="#"
|
||||
is="emby-linkbutton"
|
||||
data-role="button"
|
||||
class="${className}"
|
||||
>
|
||||
${tabTitle}
|
||||
</a>`
|
||||
});
|
||||
|
||||
const TabLinkElement: FunctionComponent<IProps> = ({ tabTitle, onClick, ...restactiveTab }: IProps) => {
|
||||
return (
|
||||
// eslint-disable-next-line jsx-a11y/click-events-have-key-events
|
||||
<div
|
||||
onClick={onClick}
|
||||
dangerouslySetInnerHTML={createLinkElement({
|
||||
className: restactiveTab.activeTab ? 'ui-btn-active' : '',
|
||||
tabTitle: globalize.translate(tabTitle)
|
||||
})}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export default TabLinkElement;
|
|
@ -11,7 +11,7 @@ import LinkEditUserPreferences from '../dashboard/users/LinkEditUserPreferences'
|
|||
import SectionTitleLinkElement from '../dashboard/users/SectionTitleLinkElement';
|
||||
import SelectElement from '../dashboard/users/SelectElement';
|
||||
import SelectSyncPlayAccessElement from '../dashboard/users/SelectSyncPlayAccessElement';
|
||||
import TabLinkElement from '../dashboard/users/TabLinkElement';
|
||||
import SectionTabs from '../dashboard/users/SectionTabs';
|
||||
import loading from '../loading/loading';
|
||||
import toast from '../toast/toast';
|
||||
|
||||
|
@ -212,9 +212,9 @@ const UserEditPage: FunctionComponent = () => {
|
|||
|
||||
element?.current?.querySelector('.chkEnableDeleteAllFolders').addEventListener('change', function (this: HTMLInputElement) {
|
||||
if (this.checked) {
|
||||
element?.current?.querySelector('.deleteAccessListContainer').classList.add('hide');
|
||||
element?.current?.querySelector('.deleteAccess').classList.add('hide');
|
||||
} else {
|
||||
element?.current?.querySelector('.deleteAccessListContainer').classList.remove('hide');
|
||||
element?.current?.querySelector('.deleteAccess').classList.remove('hide');
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -245,31 +245,7 @@ const UserEditPage: FunctionComponent = () => {
|
|||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
data-role='controlgroup'
|
||||
data-type='horizontal'
|
||||
className='localnav'
|
||||
id='userProfileNavigation'
|
||||
style={{display: 'flex'}}
|
||||
>
|
||||
<TabLinkElement
|
||||
activeTab={true}
|
||||
tabTitle='Profile'
|
||||
onClick={() => Dashboard.navigate('useredit.html', true)}
|
||||
/>
|
||||
<TabLinkElement
|
||||
tabTitle='TabAccess'
|
||||
onClick={() => Dashboard.navigate('userlibraryaccess.html', true)}
|
||||
/>
|
||||
<TabLinkElement
|
||||
tabTitle='TabParentalControl'
|
||||
onClick={() => Dashboard.navigate('userparentalcontrol.html', true)}
|
||||
/>
|
||||
<TabLinkElement
|
||||
tabTitle='HeaderPassword'
|
||||
onClick={() => Dashboard.navigate('userpassword.html', true)}
|
||||
/>
|
||||
</div>
|
||||
<SectionTabs activeTab='useredit'/>
|
||||
<div
|
||||
className='lnkEditUserPreferencesContainer'
|
||||
style={{paddingBottom: '1em'}}
|
||||
|
@ -331,6 +307,7 @@ const UserEditPage: FunctionComponent = () => {
|
|||
</div>
|
||||
</div>
|
||||
<CheckBoxElement
|
||||
labelClassName='checkboxContainer'
|
||||
type='checkbox'
|
||||
className='chkIsAdmin'
|
||||
title='OptionAllowUserToManageServer'
|
||||
|
@ -416,19 +393,18 @@ const UserEditPage: FunctionComponent = () => {
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className='verticalSection verticalSection-extrabottompadding'>
|
||||
<h2>{globalize.translate('HeaderAllowMediaDeletionFrom')}</h2>
|
||||
<div className='verticalSection'>
|
||||
<h2 className='checkboxListLabel' style={{marginBottom: '1em'}}>
|
||||
{globalize.translate('HeaderAllowMediaDeletionFrom')}
|
||||
</h2>
|
||||
<div className='checkboxList paperList checkboxList-paperList'>
|
||||
<CheckBoxElement
|
||||
labelClassName='checkboxContainer'
|
||||
type='checkbox'
|
||||
className='chkEnableDeleteAllFolders'
|
||||
title='AllLibraries'
|
||||
/>
|
||||
<div className='deleteAccessListContainer'>
|
||||
<div className='deleteAccess'>
|
||||
<h3 className='checkboxListLabel'>
|
||||
{globalize.translate('DeleteFoldersAccess')}
|
||||
</h3>
|
||||
<div className='checkboxList paperList' style={{padding: '.5em 1em'}}>
|
||||
{deleteFoldersAccess.map(Item => (
|
||||
<CheckBoxListItem
|
||||
key={Item.Id}
|
||||
|
@ -440,10 +416,6 @@ const UserEditPage: FunctionComponent = () => {
|
|||
))}
|
||||
</div>
|
||||
</div>
|
||||
<div className='fieldDescription'>
|
||||
{globalize.translate('DeleteFoldersAccessHelp')}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className='verticalSection'>
|
||||
<h2 className='checkboxListLabel'>
|
||||
|
|
|
@ -108,6 +108,11 @@
|
|||
width: 12em;
|
||||
}
|
||||
|
||||
.checkboxList > .sectioncheckbox > .emby-checkbox-label {
|
||||
display: flex;
|
||||
margin: 0.5em 0;
|
||||
}
|
||||
|
||||
.checkboxList-paperList {
|
||||
padding: 1em !important;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue