import { useTranslation } from 'react-i18next' import { USBIcon, RAMIcon } from 'icons' import { FormControlLabel, Switch } from '@material-ui/core' import TextField from '@material-ui/core/TextField' import { PreloadCacheValue, MainSettingsContent, StorageButton, StorageIconWrapper, CacheStorageSelector, SettingSectionLabel, PreloadCachePercentage, cacheBeforeReaderColor, cacheAfterReaderColor, } from './style' import SliderInput from './SliderInput' const CacheStorageLocationLabel = ({ style }) => { const { t } = useTranslation() return ( {t('SettingsDialog.CacheStorageLocation')} {t('SettingsDialog.UseDiskDesc')} ) } export default function PrimarySettingsComponent({ settings, inputForm, cachePercentage, preloadCachePercentage, cacheSize, isProMode, setCacheSize, setCachePercentage, setPreloadCachePercentage, updateSettings, }) { const { t } = useTranslation() const { UseDisk, TorrentsSavePath, RemoveCacheOnDrop } = settings || {} const preloadCacheSize = Math.round((cacheSize / 100) * preloadCachePercentage) return (
{t('SettingsDialog.CacheSettings')}
{100 - cachePercentage}% ({Math.round((cacheSize / 100) * (100 - cachePercentage))} MB)
{t('SettingsDialog.CacheBeforeReaderDesc')}
{cachePercentage}% ({Math.round((cacheSize / 100) * cachePercentage)} MB)
{t('SettingsDialog.CacheAfterReaderDesc')}

setCacheSize(Math.round(value / 4) * 4)} />
{UseDisk ? (
updateSettings({ UseDisk: false })}>
{t('SettingsDialog.RAM')}
{t('SettingsDialog.Disk')}
} label={t('SettingsDialog.RemoveCacheOnDrop')} labelPlacement='start' />
{t('SettingsDialog.RemoveCacheOnDropDesc')}

) : (
{t('SettingsDialog.RAM')}
updateSettings({ UseDisk: true })}>
{t('SettingsDialog.Disk')}
)}
) }