Merge pull request #74 from YouROK/use-auto-dark-palette-and-About

Use auto dark palette and about
This commit is contained in:
dancheskus
2021-06-18 13:40:55 +03:00
committed by GitHub
10 changed files with 399 additions and 339 deletions

View File

@@ -56,7 +56,7 @@ for PLATFORM in "${PLATFORMS[@]}"; do
set_goarm "$GOARCH"
BIN_FILENAME="${OUTPUT}-${GOOS}-${GOARCH}${GOARM}"
if [[ "${GOOS}" == "windows" ]]; then BIN_FILENAME="${BIN_FILENAME}.exe"; fi
CMD="GOOS=${GOOS} GOARCH=${GOARCH} ${GO_ARM} CGO_ENABLED=1 ${GOBIN} build ${BUILD_FLAGS} -o ${BIN_FILENAME} ./cmd"
CMD="GOOS=${GOOS} GOARCH=${GOARCH} ${GO_ARM} ${GOBIN} build ${BUILD_FLAGS} -o ${BIN_FILENAME} ./cmd"
echo "${CMD}"
eval "$CMD" || FAILURES="${FAILURES} ${GOOS}/${GOARCH}${GOARM}"
done

View File

@@ -11,6 +11,8 @@ import ListItemIcon from '@material-ui/core/ListItemIcon'
import ListItemText from '@material-ui/core/ListItemText'
import { useTranslation } from 'react-i18next'
import { echoHost } from 'utils/Hosts'
import { ThemeProvider } from '@material-ui/core/styles'
import { lightTheme } from 'components/App'
export default function AboutDialog() {
const { t } = useTranslation()
@@ -29,39 +31,55 @@ export default function AboutDialog() {
<ListItemText primary={t('About')} />
</ListItem>
<Dialog open={open} onClose={() => setOpen(false)} aria-labelledby='form-dialog-title' fullWidth maxWidth='lg'>
<DialogTitle id='form-dialog-title'>{t('About')}</DialogTitle>
<ThemeProvider theme={lightTheme}>
<Dialog open={open} onClose={() => setOpen(false)} aria-labelledby='form-dialog-title' fullWidth maxWidth='sm'>
<DialogTitle id='form-dialog-title'>{t('About')}</DialogTitle>
<DialogContent>
<center>
<h2>TorrServer {torrServerVersion}</h2>
<a href='https://github.com/YouROK/TorrServer'>https://github.com/YouROK/TorrServer</a>
</center>
<DialogContent>
<center>
<h2>{t('ThanksToEveryone')}</h2>
<h2>TorrServer {torrServerVersion}</h2>
<a style={{ color: '#00a572' }} href='https://github.com/YouROK/TorrServer'>
https://github.com/YouROK/TorrServer
</a>
</center>
<br />
<h2>{t('SpecialThanks')}</h2>
<b>anacrolix Matt Joiner</b> <a href='https://github.com/anacrolix/'>github.com/anacrolix</a>
<br />
<b>nikk</b> <a href='https://github.com/tsynik'>github.com/tsynik</a>
<br />
<b>dancheskus</b> <a href='https://github.com/dancheskus'>github.com/dancheskus</a>
<br />
<b>tw1cker Руслан Пахнев</b> <a href='https://github.com/Nemiroff'>github.com/Nemiroff</a>
<br />
<b>SpAwN_LMG</b>
<br />
<DialogContent>
<center>
<h2>{t('ThanksToEveryone')}</h2>
</center>
<br />
<h2>{t('SpecialThanks')}</h2>
<b>anacrolix Matt Joiner</b>&nbsp;
<a style={{ color: '#00a572' }} href='https://github.com/anacrolix/'>
github.com/anacrolix
</a>
<br />
<b>nikk</b>&nbsp;
<a style={{ color: '#00a572' }} href='https://github.com/tsynik'>
github.com/tsynik
</a>
<br />
<b>dancheskus</b>&nbsp;
<a style={{ color: '#00a572' }} href='https://github.com/dancheskus'>
github.com/dancheskus
</a>
<br />
<b>tw1cker Руслан Пахнев</b>&nbsp;
<a style={{ color: '#00a572' }} href='https://github.com/Nemiroff'>
github.com/Nemiroff
</a>
<br />
<b>SpAwN_LMG</b>
<br />
</DialogContent>
</DialogContent>
</DialogContent>
<DialogActions>
<Button onClick={() => setOpen(false)} color='primary' variant='outlined' autoFocus>
{t('Close')}
</Button>
</DialogActions>
</Dialog>
<DialogActions>
<Button onClick={() => setOpen(false)} color='primary' variant='outlined' autoFocus>
{t('Close')}
</Button>
</DialogActions>
</Dialog>
</ThemeProvider>
</div>
)
}

View File

@@ -12,6 +12,8 @@ import usePreviousState from 'utils/usePreviousState'
import { useQuery } from 'react-query'
import { getTorrents } from 'utils/Utils'
import parseTorrent from 'parse-torrent'
import { ThemeProvider } from '@material-ui/core/styles'
import { lightTheme } from 'components/App'
import { checkImageURL, getMoviePosters, chechTorrentSource, parseTorrentTitle } from './helpers'
import { ButtonWrapper, Content, Header } from './style'
@@ -204,69 +206,75 @@ export default function AddDialog({
}
return (
<Dialog
open
onClose={handleClose}
aria-labelledby='form-dialog-title'
fullScreen={fullScreen}
fullWidth
maxWidth='md'
>
<Header>{t(isEditMode ? 'EditTorrent' : 'AddNewTorrent')}</Header>
<ThemeProvider theme={lightTheme}>
<Dialog
open
onClose={handleClose}
aria-labelledby='form-dialog-title'
fullScreen={fullScreen}
fullWidth
maxWidth='md'
>
<Header>{t(isEditMode ? 'EditTorrent' : 'AddNewTorrent')}</Header>
<Content isEditMode={isEditMode}>
{!isEditMode && (
<LeftSideComponent
<Content isEditMode={isEditMode}>
{!isEditMode && (
<LeftSideComponent
setIsUserInteractedWithPoster={setIsUserInteractedWithPoster}
setSelectedFile={setSelectedFile}
torrentSource={torrentSource}
setTorrentSource={setTorrentSource}
selectedFile={selectedFile}
/>
)}
<RightSideComponent
originalTorrentTitle={originalTorrentTitle}
setTitle={setTitle}
setPosterUrl={setPosterUrl}
setIsPosterUrlCorrect={setIsPosterUrlCorrect}
setIsUserInteractedWithPoster={setIsUserInteractedWithPoster}
setSelectedFile={setSelectedFile}
setPosterList={setPosterList}
isTorrentSourceCorrect={isTorrentSourceCorrect}
isHashAlreadyExists={isHashAlreadyExists}
title={title}
parsedTitle={parsedTitle}
posterUrl={posterUrl}
isPosterUrlCorrect={isPosterUrlCorrect}
posterList={posterList}
currentLang={currentLang}
posterSearchLanguage={posterSearchLanguage}
setPosterSearchLanguage={setPosterSearchLanguage}
posterSearch={posterSearch}
removePoster={removePoster}
updateTitleFromSource={updateTitleFromSource}
torrentSource={torrentSource}
setTorrentSource={setTorrentSource}
selectedFile={selectedFile}
isCustomTitleEnabled={isCustomTitleEnabled}
setIsCustomTitleEnabled={setIsCustomTitleEnabled}
isEditMode={isEditMode}
/>
)}
</Content>
<RightSideComponent
originalTorrentTitle={originalTorrentTitle}
setTitle={setTitle}
setPosterUrl={setPosterUrl}
setIsPosterUrlCorrect={setIsPosterUrlCorrect}
setIsUserInteractedWithPoster={setIsUserInteractedWithPoster}
setPosterList={setPosterList}
isTorrentSourceCorrect={isTorrentSourceCorrect}
isHashAlreadyExists={isHashAlreadyExists}
title={title}
parsedTitle={parsedTitle}
posterUrl={posterUrl}
isPosterUrlCorrect={isPosterUrlCorrect}
posterList={posterList}
currentLang={currentLang}
posterSearchLanguage={posterSearchLanguage}
setPosterSearchLanguage={setPosterSearchLanguage}
posterSearch={posterSearch}
removePoster={removePoster}
updateTitleFromSource={updateTitleFromSource}
torrentSource={torrentSource}
isCustomTitleEnabled={isCustomTitleEnabled}
setIsCustomTitleEnabled={setIsCustomTitleEnabled}
isEditMode={isEditMode}
/>
</Content>
<ButtonWrapper>
<Button onClick={handleClose} color='primary' variant='outlined'>
{t('Cancel')}
</Button>
<ButtonWrapper>
<Button onClick={handleClose} color='primary' variant='outlined'>
{t('Cancel')}
</Button>
<Button
variant='contained'
style={{ minWidth: '110px' }}
disabled={!torrentSource || (isHashAlreadyExists && !isEditMode) || !isTorrentSourceCorrect}
onClick={handleSave}
color='primary'
>
{isLoadingButton ? <CircularProgress style={{ color: 'white' }} size={20} /> : t(isEditMode ? 'Save' : 'Add')}
</Button>
</ButtonWrapper>
</Dialog>
<Button
variant='contained'
style={{ minWidth: '110px' }}
disabled={!torrentSource || (isHashAlreadyExists && !isEditMode) || !isTorrentSourceCorrect}
onClick={handleSave}
color='primary'
>
{isLoadingButton ? (
<CircularProgress style={{ color: 'white' }} size={20} />
) : (
t(isEditMode ? 'Save' : 'Add')
)}
</Button>
</ButtonWrapper>
</Dialog>
</ThemeProvider>
)
}

View File

@@ -21,29 +21,19 @@ const Sidebar = ({ isDrawerOpen, setIsDonationDialogOpen, isOffline, isLoading }
<AppSidebarStyle isDrawerOpen={isDrawerOpen}>
<List>
<AddDialogButton isOffline={isOffline} isLoading={isLoading} />
<RemoveAll isOffline={isOffline} isLoading={isLoading} />
</List>
<Divider />
<List>
<SettingsDialog />
<CloseServer isOffline={isOffline} isLoading={isLoading} />
</List>
<Divider />
<List>
<AboutDialog />
<ListItem button onClick={() => setIsDonationDialogOpen(true)}>
<ListItemIcon>
<CreditCardIcon />
</ListItemIcon>
<ListItemText primary={t('Donate')} />
</ListItem>
<CloseServer isOffline={isOffline} isLoading={isLoading} />
</List>
</AppSidebarStyle>
)

View File

@@ -1,6 +1,7 @@
import CssBaseline from '@material-ui/core/CssBaseline'
import useMediaQuery from '@material-ui/core/useMediaQuery'
import { createMuiTheme, MuiThemeProvider } from '@material-ui/core'
import { useEffect, useState } from 'react'
import CssBaseline from '@material-ui/core/CssBaseline'
import { useEffect, useMemo, useState } from 'react'
import Typography from '@material-ui/core/Typography'
import IconButton from '@material-ui/core/IconButton'
import { Menu as MenuIcon, Close as CloseIcon } from '@material-ui/icons'
@@ -11,21 +12,50 @@ import TorrentList from 'components/TorrentList'
import DonateSnackbar from 'components/Donate'
import DonateDialog from 'components/Donate/DonateDialog'
import useChangeLanguage from 'utils/useChangeLanguage'
import { ThemeProvider } from '@material-ui/core/styles'
import { useQuery } from 'react-query'
import { getTorrents } from 'utils/Utils'
import { AppWrapper, AppHeader, LanguageSwitch } from './style'
import Sidebar from './Sidebar'
const baseTheme = createMuiTheme({
palette: { primary: { main: '#00a572' }, secondary: { main: '#ffa724' }, tonalOffset: 0.2 },
// https://material-ui.com/ru/customization/default-theme/
export const darkTheme = createMuiTheme({
palette: {
type: 'dark',
primary: { main: '#00a572' },
background: { paper: '#575757' },
},
typography: { fontFamily: 'Open Sans, sans-serif' },
})
export const lightTheme = createMuiTheme({
palette: {
type: 'light',
primary: { main: '#00a572' },
background: { paper: '#f1f1f1' },
},
typography: { fontFamily: 'Open Sans, sans-serif' },
})
export default function App() {
const prefersDarkMode = useMediaQuery('(prefers-color-scheme: dark)')
const [isDrawerOpen, setIsDrawerOpen] = useState(false)
const [isDonationDialogOpen, setIsDonationDialogOpen] = useState(false)
const [torrServerVersion, setTorrServerVersion] = useState('')
// https://material-ui.com/ru/customization/palette/
const baseTheme = useMemo(
() =>
createMuiTheme({
palette: {
type: prefersDarkMode ? 'dark' : 'light',
primary: { main: '#00a572' },
secondary: { main: '#ffa724' },
tonalOffset: 0.2,
},
typography: { fontFamily: 'Open Sans, sans-serif' },
}),
[prefersDarkMode],
)
const [currentLang, changeLang] = useChangeLanguage()
const [isOffline, setIsOffline] = useState(false)
const { data: torrents, isLoading } = useQuery('torrents', getTorrents, {
@@ -66,17 +96,18 @@ export default function App() {
</LanguageSwitch>
</div>
</AppHeader>
<Sidebar
isOffline={isOffline}
isLoading={isLoading}
isDrawerOpen={isDrawerOpen}
setIsDonationDialogOpen={setIsDonationDialogOpen}
/>
<ThemeProvider theme={darkTheme}>
<Sidebar
isOffline={isOffline}
isLoading={isLoading}
isDrawerOpen={isDrawerOpen}
setIsDonationDialogOpen={setIsDonationDialogOpen}
/>
</ThemeProvider>
<TorrentList isOffline={isOffline} torrents={torrents} isLoading={isLoading} />
{isDonationDialogOpen && <DonateDialog onClose={() => setIsDonationDialogOpen(false)} />}
<ThemeProvider theme={lightTheme}>
{isDonationDialogOpen && <DonateDialog onClose={() => setIsDonationDialogOpen(false)} />}
</ThemeProvider>
{!JSON.parse(localStorage.getItem('snackbarIsClosed')) && <DonateSnackbar />}
</AppWrapper>
</Div100vh>

View File

@@ -19,14 +19,14 @@ export const CenteredGrid = styled.div`
export const AppHeader = styled.div`
background: #00a572;
color: rgba(0, 0, 0, 0.87);
color: #fff;
grid-area: head;
display: grid;
grid-auto-flow: column;
align-items: center;
grid-template-columns: repeat(2, max-content) 1fr;
box-shadow: 0px 2px 4px -1px rgb(0 0 0 / 20%), 0px 4px 5px 0px rgb(0 0 0 / 14%), 0px 1px 10px 0px rgb(0 0 0 / 12%);
padding: 0 24px;
padding: 0 16px;
z-index: 3;
`
export const AppSidebarStyle = styled.div`
@@ -37,7 +37,8 @@ export const AppSidebarStyle = styled.div`
overflow-x: hidden;
transition: width 195ms cubic-bezier(0.4, 0, 0.6, 1) 0ms;
border-right: 1px solid rgba(0, 0, 0, 0.12);
background: #eee;
background: #575757;
color: #eee;
white-space: nowrap;
`}
`
@@ -76,7 +77,7 @@ export const LanguageSwitch = styled.div`
font-weight: 600;
display: grid;
place-items: center;
color: #44795e;
color: #fff;
:hover {
background: #7ec9a3;

View File

@@ -3,6 +3,8 @@ import { Button, Dialog, DialogActions, DialogTitle, ListItem, ListItemIcon, Lis
import { PowerSettingsNew as PowerSettingsNewIcon } from '@material-ui/icons'
import { shutdownHost } from 'utils/Hosts'
import { useTranslation } from 'react-i18next'
import { ThemeProvider } from '@material-ui/core/styles'
import { lightTheme } from 'components/App'
export default function CloseServer({ isOffline, isLoading }) {
const { t } = useTranslation()
@@ -20,26 +22,28 @@ export default function CloseServer({ isOffline, isLoading }) {
<ListItemText primary={t('CloseServer')} />
</ListItem>
<Dialog open={open} onClose={closeDialog}>
<DialogTitle>{t('CloseServer?')}</DialogTitle>
<DialogActions>
<Button variant='outlined' onClick={closeDialog} color='primary'>
{t('Cancel')}
</Button>
<ThemeProvider theme={lightTheme}>
<Dialog open={open} onClose={closeDialog}>
<DialogTitle>{t('CloseServer?')}</DialogTitle>
<DialogActions>
<Button variant='outlined' onClick={closeDialog} color='primary'>
{t('Cancel')}
</Button>
<Button
variant='contained'
onClick={() => {
fetch(shutdownHost())
closeDialog()
}}
color='primary'
autoFocus
>
{t('TurnOff')}
</Button>
</DialogActions>
</Dialog>
<Button
variant='contained'
onClick={() => {
fetch(shutdownHost())
closeDialog()
}}
color='primary'
autoFocus
>
{t('TurnOff')}
</Button>
</DialogActions>
</Dialog>
</ThemeProvider>
</>
)
}

View File

@@ -15,7 +15,7 @@ export default function DonateDialog({ onClose }) {
const { t } = useTranslation()
return (
<Dialog open onClose={onClose} aria-labelledby='form-dialog-title' fullWidth>
<Dialog open onClose={onClose} aria-labelledby='form-dialog-title' fullWidth maxWidth='xs'>
<DialogTitle id='form-dialog-title'>{t('Donate')}</DialogTitle>
<DialogContent>
<List>

View File

@@ -6,6 +6,8 @@ import DeleteIcon from '@material-ui/icons/Delete'
import { useState } from 'react'
import { torrentsHost } from 'utils/Hosts'
import { useTranslation } from 'react-i18next'
import { ThemeProvider } from '@material-ui/core/styles'
import { lightTheme } from 'components/App'
const fnRemoveAll = () => {
fetch(torrentsHost(), {
@@ -47,26 +49,28 @@ export default function RemoveAll({ isOffline, isLoading }) {
<ListItemText primary={t('RemoveAll')} />
</ListItem>
<Dialog open={open} onClose={closeDialog}>
<DialogTitle>{t('DeleteTorrents?')}</DialogTitle>
<DialogActions>
<Button variant='outlined' onClick={closeDialog} color='primary'>
{t('Cancel')}
</Button>
<ThemeProvider theme={lightTheme}>
<Dialog open={open} onClose={closeDialog}>
<DialogTitle>{t('DeleteTorrents?')}</DialogTitle>
<DialogActions>
<Button variant='outlined' onClick={closeDialog} color='primary'>
{t('Cancel')}
</Button>
<Button
variant='contained'
onClick={() => {
fnRemoveAll()
closeDialog()
}}
color='primary'
autoFocus
>
{t('OK')}
</Button>
</DialogActions>
</Dialog>
<Button
variant='contained'
onClick={() => {
fnRemoveAll()
closeDialog()
}}
color='primary'
autoFocus
>
{t('OK')}
</Button>
</DialogActions>
</Dialog>
</ThemeProvider>
</>
)
}

View File

@@ -13,6 +13,8 @@ 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 'components/App'
export default function SettingsDialog() {
const { t } = useTranslation()
@@ -100,193 +102,195 @@ export default function SettingsDialog() {
<ListItemText primary={t('Settings')} />
</ListItem>
<Dialog open={open} onClose={handleClose} aria-labelledby='form-dialog-title' fullWidth>
<DialogTitle id='form-dialog-title'>{t('Settings')}</DialogTitle>
<DialogContent>
<TextField
onChange={onInputHost}
margin='dense'
id='TorrServerHost'
label={t('Host')}
value={tsHost}
type='url'
fullWidth
/>
{show && (
<>
<TextField
onChange={inputForm}
margin='dense'
id='CacheSize'
label={t('CacheSize')}
value={CacheSize}
type='number'
fullWidth
/>
<br />
<TextField
onChange={inputForm}
margin='dense'
id='ReaderReadAHead'
label={t('ReaderReadAHead')}
value={ReaderReadAHead}
type='number'
fullWidth
/>
<br />
<FormControlLabel
control={<Switch checked={PreloadBuffer} onChange={inputForm} id='PreloadBuffer' color='primary' />}
label={t('PreloadBuffer')}
/>
<br />
<FormControlLabel
control={<Switch checked={UseDisk} onChange={inputForm} id='UseDisk' color='primary' />}
label={t('UseDisk')}
/>
<br />
<small>{t('UseDiskDesc')}</small>
<br />
<FormControlLabel
control={
<Switch checked={RemoveCacheOnDrop} onChange={inputForm} id='RemoveCacheOnDrop' color='primary' />
}
label={t('RemoveCacheOnDrop')}
/>
<br />
<small>{t('RemoveCacheOnDropDesc')}</small>
<br />
<TextField
onChange={inputForm}
margin='dense'
id='TorrentsSavePath'
label={t('TorrentsSavePath')}
value={TorrentsSavePath}
type='url'
fullWidth
/>
<br />
<FormControlLabel
control={<Switch checked={EnableIPv6} onChange={inputForm} id='EnableIPv6' color='primary' />}
label={t('EnableIPv6')}
/>
<br />
<FormControlLabel
control={<Switch checked={!DisableTCP} onChange={inputForm} id='DisableTCP' color='primary' />}
label={t('TCP')}
/>
<br />
<FormControlLabel
control={<Switch checked={!DisableUTP} onChange={inputForm} id='DisableUTP' color='primary' />}
label={t('UTP')}
/>
<br />
<FormControlLabel
control={<Switch checked={!DisablePEX} onChange={inputForm} id='DisablePEX' color='primary' />}
label={t('PEX')}
/>
<br />
<FormControlLabel
control={<Switch checked={ForceEncrypt} onChange={inputForm} id='ForceEncrypt' color='primary' />}
label={t('ForceEncrypt')}
/>
<br />
<TextField
onChange={inputForm}
margin='dense'
id='TorrentDisconnectTimeout'
label={t('TorrentDisconnectTimeout')}
value={TorrentDisconnectTimeout}
type='number'
fullWidth
/>
<br />
<TextField
onChange={inputForm}
margin='dense'
id='ConnectionsLimit'
label={t('ConnectionsLimit')}
value={ConnectionsLimit}
type='number'
fullWidth
/>
<br />
<FormControlLabel
control={<Switch checked={!DisableDHT} onChange={inputForm} id='DisableDHT' color='primary' />}
label={t('DHT')}
/>
<br />
<TextField
onChange={inputForm}
margin='dense'
id='DhtConnectionLimit'
label={t('DhtConnectionLimit')}
value={DhtConnectionLimit}
type='number'
fullWidth
/>
<br />
<TextField
onChange={inputForm}
margin='dense'
id='DownloadRateLimit'
label={t('DownloadRateLimit')}
value={DownloadRateLimit}
type='number'
fullWidth
/>
<br />
<FormControlLabel
control={<Switch checked={!DisableUpload} onChange={inputForm} id='DisableUpload' color='primary' />}
label={t('Upload')}
/>
<br />
<TextField
onChange={inputForm}
margin='dense'
id='UploadRateLimit'
label={t('UploadRateLimit')}
value={UploadRateLimit}
type='number'
fullWidth
/>
<br />
<TextField
onChange={inputForm}
margin='dense'
id='PeersListenPort'
label={t('PeersListenPort')}
value={PeersListenPort}
type='number'
fullWidth
/>
<br />
<FormControlLabel
control={<Switch checked={!DisableUPNP} onChange={inputForm} id='DisableUPNP' color='primary' />}
label={t('UPNP')}
/>
<br />
<InputLabel htmlFor='RetrackersMode'>{t('RetrackersMode')}</InputLabel>
<Select onChange={inputForm} type='number' native id='RetrackersMode' value={RetrackersMode}>
<option value={0}>{t('DontAddRetrackers')}</option>
<option value={1}>{t('AddRetrackers')}</option>
<option value={2}>{t('RemoveRetrackers')}</option>
<option value={3}>{t('ReplaceRetrackers')}</option>
</Select>
<br />
</>
)}
</DialogContent>
<ThemeProvider theme={lightTheme}>
<Dialog open={open} onClose={handleClose} aria-labelledby='form-dialog-title' fullWidth>
<DialogTitle id='form-dialog-title'>{t('Settings')}</DialogTitle>
<DialogContent>
<TextField
onChange={onInputHost}
margin='dense'
id='TorrServerHost'
label={t('Host')}
value={tsHost}
type='url'
fullWidth
/>
{show && (
<>
<TextField
onChange={inputForm}
margin='dense'
id='CacheSize'
label={t('CacheSize')}
value={CacheSize}
type='number'
fullWidth
/>
<br />
<TextField
onChange={inputForm}
margin='dense'
id='ReaderReadAHead'
label={t('ReaderReadAHead')}
value={ReaderReadAHead}
type='number'
fullWidth
/>
<br />
<FormControlLabel
control={<Switch checked={PreloadBuffer} onChange={inputForm} id='PreloadBuffer' color='primary' />}
label={t('PreloadBuffer')}
/>
<br />
<FormControlLabel
control={<Switch checked={UseDisk} onChange={inputForm} id='UseDisk' color='primary' />}
label={t('UseDisk')}
/>
<br />
<small>{t('UseDiskDesc')}</small>
<br />
<FormControlLabel
control={
<Switch checked={RemoveCacheOnDrop} onChange={inputForm} id='RemoveCacheOnDrop' color='primary' />
}
label={t('RemoveCacheOnDrop')}
/>
<br />
<small>{t('RemoveCacheOnDropDesc')}</small>
<br />
<TextField
onChange={inputForm}
margin='dense'
id='TorrentsSavePath'
label={t('TorrentsSavePath')}
value={TorrentsSavePath}
type='url'
fullWidth
/>
<br />
<FormControlLabel
control={<Switch checked={EnableIPv6} onChange={inputForm} id='EnableIPv6' color='primary' />}
label={t('EnableIPv6')}
/>
<br />
<FormControlLabel
control={<Switch checked={!DisableTCP} onChange={inputForm} id='DisableTCP' color='primary' />}
label={t('TCP')}
/>
<br />
<FormControlLabel
control={<Switch checked={!DisableUTP} onChange={inputForm} id='DisableUTP' color='primary' />}
label={t('UTP')}
/>
<br />
<FormControlLabel
control={<Switch checked={!DisablePEX} onChange={inputForm} id='DisablePEX' color='primary' />}
label={t('PEX')}
/>
<br />
<FormControlLabel
control={<Switch checked={ForceEncrypt} onChange={inputForm} id='ForceEncrypt' color='primary' />}
label={t('ForceEncrypt')}
/>
<br />
<TextField
onChange={inputForm}
margin='dense'
id='TorrentDisconnectTimeout'
label={t('TorrentDisconnectTimeout')}
value={TorrentDisconnectTimeout}
type='number'
fullWidth
/>
<br />
<TextField
onChange={inputForm}
margin='dense'
id='ConnectionsLimit'
label={t('ConnectionsLimit')}
value={ConnectionsLimit}
type='number'
fullWidth
/>
<br />
<FormControlLabel
control={<Switch checked={!DisableDHT} onChange={inputForm} id='DisableDHT' color='primary' />}
label={t('DHT')}
/>
<br />
<TextField
onChange={inputForm}
margin='dense'
id='DhtConnectionLimit'
label={t('DhtConnectionLimit')}
value={DhtConnectionLimit}
type='number'
fullWidth
/>
<br />
<TextField
onChange={inputForm}
margin='dense'
id='DownloadRateLimit'
label={t('DownloadRateLimit')}
value={DownloadRateLimit}
type='number'
fullWidth
/>
<br />
<FormControlLabel
control={<Switch checked={!DisableUpload} onChange={inputForm} id='DisableUpload' color='primary' />}
label={t('Upload')}
/>
<br />
<TextField
onChange={inputForm}
margin='dense'
id='UploadRateLimit'
label={t('UploadRateLimit')}
value={UploadRateLimit}
type='number'
fullWidth
/>
<br />
<TextField
onChange={inputForm}
margin='dense'
id='PeersListenPort'
label={t('PeersListenPort')}
value={PeersListenPort}
type='number'
fullWidth
/>
<br />
<FormControlLabel
control={<Switch checked={!DisableUPNP} onChange={inputForm} id='DisableUPNP' color='primary' />}
label={t('UPNP')}
/>
<br />
<InputLabel htmlFor='RetrackersMode'>{t('RetrackersMode')}</InputLabel>
<Select onChange={inputForm} type='number' native id='RetrackersMode' value={RetrackersMode}>
<option value={0}>{t('DontAddRetrackers')}</option>
<option value={1}>{t('AddRetrackers')}</option>
<option value={2}>{t('RemoveRetrackers')}</option>
<option value={3}>{t('ReplaceRetrackers')}</option>
</Select>
<br />
</>
)}
</DialogContent>
<DialogActions>
<Button onClick={handleClose} color='primary' variant='outlined'>
{t('Cancel')}
</Button>
<DialogActions>
<Button onClick={handleClose} color='primary' variant='outlined'>
{t('Cancel')}
</Button>
<Button onClick={handleSave} color='primary' variant='outlined'>
{t('Save')}
</Button>
</DialogActions>
</Dialog>
<Button onClick={handleSave} color='primary' variant='outlined'>
{t('Save')}
</Button>
</DialogActions>
</Dialog>
</ThemeProvider>
</div>
)
}