1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

replace LinkEditUserPreferences with LinkButton

This commit is contained in:
David Stensland 2024-02-24 11:59:17 -08:00 committed by Bill Thornton
parent 0d90ac39f1
commit b27b559d21
2 changed files with 7 additions and 40 deletions

View file

@ -9,7 +9,7 @@ import LibraryMenu from '../../../../scripts/libraryMenu';
import ButtonElement from '../../../../elements/ButtonElement'; import ButtonElement from '../../../../elements/ButtonElement';
import CheckBoxElement from '../../../../elements/CheckBoxElement'; import CheckBoxElement from '../../../../elements/CheckBoxElement';
import InputElement from '../../../../elements/InputElement'; import InputElement from '../../../../elements/InputElement';
import LinkEditUserPreferences from '../../../../components/dashboard/users/LinkEditUserPreferences'; import LinkButton from '../../../../elements/emby-button/LinkButton';
import SectionTitleContainer from '../../../../elements/SectionTitleContainer'; import SectionTitleContainer from '../../../../elements/SectionTitleContainer';
import SectionTabs from '../../../../components/dashboard/users/SectionTabs'; import SectionTabs from '../../../../components/dashboard/users/SectionTabs';
import loading from '../../../../components/loading/loading'; import loading from '../../../../components/loading/loading';
@ -38,7 +38,7 @@ function onSaveComplete() {
const UserEdit = () => { const UserEdit = () => {
const [ searchParams ] = useSearchParams(); const [ searchParams ] = useSearchParams();
const userId = searchParams.get('userId'); const userId = searchParams.get('userId');
const [ userName, setUserName ] = useState(''); const [ userDto, setUserDto ] = useState<UserDto>();
const [ deleteFoldersAccess, setDeleteFoldersAccess ] = useState<ResetProvider[]>([]); const [ deleteFoldersAccess, setDeleteFoldersAccess ] = useState<ResetProvider[]>([]);
const [ authProviders, setAuthProviders ] = useState<NameIdPair[]>([]); const [ authProviders, setAuthProviders ] = useState<NameIdPair[]>([]);
const [ passwordResetProviders, setPasswordResetProviders ] = useState<NameIdPair[]>([]); const [ passwordResetProviders, setPasswordResetProviders ] = useState<NameIdPair[]>([]);
@ -147,10 +147,8 @@ const UserEdit = () => {
txtUserName.disabled = false; txtUserName.disabled = false;
txtUserName.removeAttribute('disabled'); txtUserName.removeAttribute('disabled');
const lnkEditUserPreferences = page.querySelector('.lnkEditUserPreferences') as HTMLDivElement;
lnkEditUserPreferences.setAttribute('href', 'mypreferencesmenu.html?userId=' + user.Id);
LibraryMenu.setTitle(user.Name); LibraryMenu.setTitle(user.Name);
setUserName(user.Name || ''); setUserDto(user);
(page.querySelector('#txtUserName') as HTMLInputElement).value = user.Name || ''; (page.querySelector('#txtUserName') as HTMLInputElement).value = user.Name || '';
(page.querySelector('.chkIsAdmin') as HTMLInputElement).checked = !!user.Policy?.IsAdministrator; (page.querySelector('.chkIsAdmin') as HTMLInputElement).checked = !!user.Policy?.IsAdministrator;
(page.querySelector('.chkDisabled') as HTMLInputElement).checked = !!user.Policy?.IsDisabled; (page.querySelector('.chkDisabled') as HTMLInputElement).checked = !!user.Policy?.IsDisabled;
@ -292,7 +290,7 @@ const UserEdit = () => {
<div ref={element} className='content-primary'> <div ref={element} className='content-primary'>
<div className='verticalSection'> <div className='verticalSection'>
<SectionTitleContainer <SectionTitleContainer
title={userName} title={userDto?.Name || ''}
url='https://jellyfin.org/docs/general/server/users/' url='https://jellyfin.org/docs/general/server/users/'
/> />
</div> </div>
@ -302,10 +300,9 @@ const UserEdit = () => {
className='lnkEditUserPreferencesContainer' className='lnkEditUserPreferencesContainer'
style={{ paddingBottom: '1em' }} style={{ paddingBottom: '1em' }}
> >
<LinkEditUserPreferences <LinkButton className='lnkEditUserPreferences button-link' href={userDto?.Id ? `mypreferencesmenu.html?userId=${userDto.Id}` : undefined}>
className= 'lnkEditUserPreferences button-link' {globalize.translate('ButtonEditOtherUserPreferences')}
title= 'ButtonEditOtherUserPreferences' </LinkButton>
/>
</div> </div>
<form className='editUserProfileForm'> <form className='editUserProfileForm'>
<div className='disabledUserBanner hide'> <div className='disabledUserBanner hide'>

View file

@ -1,30 +0,0 @@
import React, { FunctionComponent } from 'react';
import globalize from 'lib/globalize';
type IProps = {
title?: string;
className?: string;
};
const createLinkElement = ({ className, title }: IProps) => ({
__html: `<a
is="emby-linkbutton"
class="${className}"
href='#'
>
${title}
</a>`
});
const LinkEditUserPreferences: FunctionComponent<IProps> = ({ className, title }: IProps) => {
return (
<div
dangerouslySetInnerHTML={createLinkElement({
className: className,
title: globalize.translate(title)
})}
/>
);
};
export default LinkEditUserPreferences;