diff --git a/src/routes/Settings/Settings.js b/src/routes/Settings/Settings.js index 0b3999ede..941ecb131 100644 --- a/src/routes/Settings/Settings.js +++ b/src/routes/Settings/Settings.js @@ -21,24 +21,28 @@ const Settings = () => { const { routeFocused } = useRouteFocused(); const profile = useProfile(); const streamingServer = useStreamingServer(); + const { + interfaceLanguageSelect, + subtitlesLanguageSelect, + subtitlesSizeSelect, + subtitlesTextColorInput, + subtitlesBackgroundColorInput, + subtitlesOutlineColorInput, + bingeWatchingCheckbox, + playInBackgroundCheckbox, + playInExternalPlayerCheckbox, + hardwareDecodingCheckbox, + streamingServerUrlInput + } = useProfileSettingsInputs(profile); + const { + cacheSizeSelect, + torrentProfileSelect + } = useStreamingServerSettingsInputs(streamingServer); const [editServerUrlModalOpen, openEditServerUrlModal, closeEditServerUrlModal] = useBinaryState(false); const editServerUrlInputRef = React.useRef(null); const editServerUrlOnSubmit = React.useCallback(() => { - if (editServerUrlInputRef.current !== null) { - core.dispatch({ - action: 'Ctx', - args: { - action: 'UpdateSettings', - args: { - ...profile.settings, - streaming_server_url: editServerUrlInputRef.current.value - } - } - }); - if (typeof closeEditServerUrlModal === 'function') { - closeEditServerUrlModal(); - } - } + streamingServerUrlInput.onChange(editServerUrlInputRef.current.value); + closeEditServerUrlModal(); }, []); const editServerUrlModalButtons = React.useMemo(() => { return [ @@ -50,29 +54,13 @@ const Settings = () => { } }, { - label: 'Edit', + label: 'Submit', props: { onClick: editServerUrlOnSubmit, } } ]; - }, [editServerUrlOnSubmit]); - const { - interfaceLanguageSelect, - subtitlesLanguageSelect, - subtitlesSizeSelect, - subtitlesTextColorInput, - subtitlesBackgroundColorInput, - subtitlesOutlineColorInput, - bingeWatchingCheckbox, - playInBackgroundCheckbox, - playInExternalPlayerCheckbox, - hardwareDecodingCheckbox - } = useProfileSettingsInputs(profile); - const { - cacheSizeSelect, - torrentProfileSelect - } = useStreamingServerSettingsInputs(streamingServer); + }, []); const logoutButtonOnClick = React.useCallback(() => { core.dispatch({ action: 'Ctx', @@ -392,7 +380,7 @@ const Settings = () => {