diff --git a/web/src/components/Settings.jsx b/web/src/components/Settings.jsx index 55d4c91..5a84228 100644 --- a/web/src/components/Settings.jsx +++ b/web/src/components/Settings.jsx @@ -13,26 +13,13 @@ import Button from '@material-ui/core/Button' import { FormControlLabel, InputLabel, Select, Switch } from '@material-ui/core' import { settingsHost, setTorrServerHost, getTorrServerHost } from 'utils/Hosts' import { useTranslation } from 'react-i18next' -import { ThemeProvider } from '@material-ui/core/styles' -import { lightTheme } from '../style/materialUISetup' - -export default function SettingsDialog() { +const SettingsDialog = ({ handleClose }) => { const { t } = useTranslation() - const [open, setOpen] = useState(false) + const [settings, setSets] = useState({}) const [show, setShow] = useState(false) const [tsHost, setTSHost] = useState(getTorrServerHost()) - - const handleClickOpen = () => setOpen(true) - const handleClose = () => setOpen(false) - const handleSave = () => { - setOpen(false) - const sets = JSON.parse(JSON.stringify(settings)) - sets.CacheSize *= 1024 * 1024 - axios.post(settingsHost(), { action: 'set', sets }) - } - useEffect(() => { axios .post(settingsHost(), { action: 'get' }) @@ -43,6 +30,12 @@ export default function SettingsDialog() { .catch(() => setShow(false)) }, [tsHost]) + const handleSave = () => { + handleClose() + const sets = JSON.parse(JSON.stringify(settings)) + sets.CacheSize *= 1024 * 1024 + axios.post(settingsHost(), { action: 'set', sets }) + } const onInputHost = ({ target: { value } }) => { const host = value.replace(/\/$/gi, '') setTorrServerHost(host) @@ -94,6 +87,204 @@ export default function SettingsDialog() { RemoveCacheOnDrop, } = settings + return ( + + ) +} + +export default function Settings() { + const { t } = useTranslation() + const [open, setOpen] = useState(false) + + const handleClickOpen = () => setOpen(true) + const handleClose = () => setOpen(false) + return (