diff --git a/src/apps/dashboard/routes/users/add.tsx b/src/apps/dashboard/routes/users/add.tsx index ffb8d3dc0..c2ad8df5e 100644 --- a/src/apps/dashboard/routes/users/add.tsx +++ b/src/apps/dashboard/routes/users/add.tsx @@ -6,7 +6,7 @@ import globalize from '../../../../lib/globalize'; import loading from '../../../../components/loading/loading'; import toast from '../../../../components/toast/toast'; import SectionTitleContainer from '../../../../elements/SectionTitleContainer'; -import InputElement from '../../../../elements/InputElement'; +import Input from '../../../../elements/emby-input/Input'; import ButtonElement from '../../../../elements/ButtonElement'; import AccessContainer from '../../../../components/dashboard/users/AccessContainer'; import CheckBoxElement from '../../../../elements/CheckBoxElement'; @@ -194,18 +194,18 @@ const UserNew = () => {
-
-
{
-
@@ -416,11 +416,14 @@ const UserEdit = () => {
-
{globalize.translate('LabelRemoteClientBitrateLimitHelp')} @@ -517,11 +520,11 @@ const UserEdit = () => {
-
{globalize.translate('OptionLoginAttemptsBeforeLockout')} @@ -534,11 +537,11 @@ const UserEdit = () => {
-
{globalize.translate('OptionMaxActiveSessions')} diff --git a/src/apps/stable/routes/quickConnect/index.tsx b/src/apps/stable/routes/quickConnect/index.tsx index a76488d21..5429be9c8 100644 --- a/src/apps/stable/routes/quickConnect/index.tsx +++ b/src/apps/stable/routes/quickConnect/index.tsx @@ -1,10 +1,10 @@ import { getQuickConnectApi } from '@jellyfin/sdk/lib/utils/api/quick-connect-api'; -import React, { FC, FormEvent, useCallback, useMemo, useState } from 'react'; +import React, { FC, FormEvent, useCallback, useState } from 'react'; import { Link, useSearchParams } from 'react-router-dom'; import Page from 'components/Page'; import globalize from 'lib/globalize'; -import InputElement from 'elements/InputElement'; +import Input from 'elements/emby-input/Input'; import ButtonElement from 'elements/ButtonElement'; import { useApi } from 'hooks/useApi'; @@ -13,14 +13,12 @@ import './quickConnect.scss'; const QuickConnectPage: FC = () => { const { api, user } = useApi(); const [ searchParams ] = useSearchParams(); - // eslint-disable-next-line react-hooks/exhaustive-deps - const initialValue = useMemo(() => searchParams.get('code') ?? '', []); - const [ code, setCode ] = useState(initialValue); + const [ code, setCode ] = useState(searchParams.get('code') ?? ''); const [ error, setError ] = useState(); const [ success, setSuccess ] = useState(false); - const onCodeChange = useCallback((value: string) => { - setCode(value); + const onCodeChange = useCallback((event: React.ChangeEvent) => { + setCode(event.currentTarget.value); }, []); const onSubmitCode = useCallback((e: FormEvent) => { @@ -90,15 +88,20 @@ const QuickConnectPage: FC = () => {
) : ( <> - +
+ +
= ({ userId }: IProps) => { >
-
-
-

diff --git a/src/elements/InputElement.tsx b/src/elements/InputElement.tsx deleted file mode 100644 index ae7e757b6..000000000 --- a/src/elements/InputElement.tsx +++ /dev/null @@ -1,74 +0,0 @@ -import React, { type FC, useCallback, useEffect, useMemo, useRef } from 'react'; - -import globalize from 'lib/globalize'; - -interface CreateInputElementParams { - type?: string - id?: string - label?: string - initialValue?: string - options?: string -} - -const createInputElement = ({ type, id, label, initialValue, options }: CreateInputElementParams) => ({ - __html: `` -}); - -type InputElementProps = { - containerClassName?: string - onChange?: (value: string) => void -} & CreateInputElementParams; - -const InputElement: FC = ({ - containerClassName, - initialValue, - onChange = () => { /* no-op */ }, - type, - id, - label, - options = '' -}) => { - const container = useRef(null); - - // NOTE: We need to memoize the input html because any re-render will break the webcomponent - const inputHtml = useMemo(() => ( - createInputElement({ - type, - id, - label: globalize.translate(label), - initialValue, - options - }) - // eslint-disable-next-line react-hooks/exhaustive-deps - ), []); - - const onInput = useCallback((e: Event) => { - onChange((e.target as HTMLInputElement).value); - }, [ onChange ]); - - useEffect(() => { - const inputElement = container?.current?.querySelector('input'); - inputElement?.addEventListener('input', onInput); - - return () => { - inputElement?.removeEventListener('input', onInput); - }; - }, [ container, onInput ]); - - return ( -
- ); -}; - -export default InputElement;