mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 13:36:09 +05:00
adaptive design added
This commit is contained in:
@@ -6,14 +6,13 @@ import { FormControlLabel, useMediaQuery, useTheme } from '@material-ui/core'
|
|||||||
import { settingsHost } from 'utils/Hosts'
|
import { settingsHost } from 'utils/Hosts'
|
||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import { Header } from 'style/DialogStyles'
|
|
||||||
import AppBar from '@material-ui/core/AppBar'
|
import AppBar from '@material-ui/core/AppBar'
|
||||||
import Tabs from '@material-ui/core/Tabs'
|
import Tabs from '@material-ui/core/Tabs'
|
||||||
import Tab from '@material-ui/core/Tab'
|
import Tab from '@material-ui/core/Tab'
|
||||||
import SwipeableViews from 'react-swipeable-views'
|
import SwipeableViews from 'react-swipeable-views'
|
||||||
import CircularProgress from '@material-ui/core/CircularProgress'
|
import CircularProgress from '@material-ui/core/CircularProgress'
|
||||||
|
|
||||||
import { FooterSection, Content } from './style'
|
import { SettingsHeader, FooterSection, Content } from './style'
|
||||||
import defaultSettings from './defaultSettings'
|
import defaultSettings from './defaultSettings'
|
||||||
import { a11yProps, TabPanel } from './tabComponents'
|
import { a11yProps, TabPanel } from './tabComponents'
|
||||||
import PrimarySettingsComponent from './PrimarySettingsComponent'
|
import PrimarySettingsComponent from './PrimarySettingsComponent'
|
||||||
@@ -81,7 +80,23 @@ export default function SettingsDialog({ handleClose }) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog open onClose={handleClose} fullScreen={fullScreen} fullWidth maxWidth='md'>
|
<Dialog open onClose={handleClose} fullScreen={fullScreen} fullWidth maxWidth='md'>
|
||||||
<Header>{t('SettingsDialog.Settings')}</Header>
|
<SettingsHeader>
|
||||||
|
<div>{t('SettingsDialog.Settings')}</div>
|
||||||
|
<FormControlLabel
|
||||||
|
control={
|
||||||
|
<Checkbox
|
||||||
|
checked={isProMode}
|
||||||
|
onChange={({ target: { checked } }) => {
|
||||||
|
setIsProMode(checked)
|
||||||
|
localStorage.setItem('isProMode', checked)
|
||||||
|
if (!checked) setSelectedTab(0)
|
||||||
|
}}
|
||||||
|
style={{ color: 'white' }}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
label={t('SettingsDialog.ProMode')}
|
||||||
|
/>
|
||||||
|
</SettingsHeader>
|
||||||
|
|
||||||
<AppBar position='static' color='default'>
|
<AppBar position='static' color='default'>
|
||||||
<Tabs
|
<Tabs
|
||||||
@@ -133,42 +148,25 @@ export default function SettingsDialog({ handleClose }) {
|
|||||||
</Content>
|
</Content>
|
||||||
|
|
||||||
<FooterSection>
|
<FooterSection>
|
||||||
<FormControlLabel
|
<Button onClick={handleClose} color='secondary' variant='outlined'>
|
||||||
control={
|
{t('Cancel')}
|
||||||
<Checkbox
|
</Button>
|
||||||
checked={isProMode}
|
|
||||||
onChange={({ target: { checked } }) => {
|
|
||||||
setIsProMode(checked)
|
|
||||||
localStorage.setItem('isProMode', checked)
|
|
||||||
if (!checked) setSelectedTab(0)
|
|
||||||
}}
|
|
||||||
color='primary'
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
label={t('SettingsDialog.ProMode')}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<div>
|
<Button
|
||||||
<Button onClick={handleClose} color='secondary' variant='outlined'>
|
onClick={() => {
|
||||||
{t('Cancel')}
|
setCacheSize(defaultSettings.CacheSize)
|
||||||
</Button>
|
setCachePercentage(defaultSettings.ReaderReadAHead)
|
||||||
|
updateSettings(defaultSettings)
|
||||||
|
}}
|
||||||
|
color='secondary'
|
||||||
|
variant='outlined'
|
||||||
|
>
|
||||||
|
{t('SettingsDialog.ResetToDefault')}
|
||||||
|
</Button>
|
||||||
|
|
||||||
<Button
|
<Button variant='contained' onClick={handleSave} color='primary'>
|
||||||
onClick={() => {
|
{t('Save')}
|
||||||
setCacheSize(defaultSettings.CacheSize)
|
</Button>
|
||||||
setCachePercentage(defaultSettings.ReaderReadAHead)
|
|
||||||
updateSettings(defaultSettings)
|
|
||||||
}}
|
|
||||||
color='secondary'
|
|
||||||
variant='outlined'
|
|
||||||
>
|
|
||||||
Reset to default
|
|
||||||
</Button>
|
|
||||||
|
|
||||||
<Button variant='contained' onClick={handleSave} color='primary'>
|
|
||||||
{t('Save')}
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
</FooterSection>
|
</FooterSection>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,18 +1,33 @@
|
|||||||
import styled, { css } from 'styled-components'
|
import styled, { css } from 'styled-components'
|
||||||
import { mainColors } from 'style/colors'
|
import { mainColors } from 'style/colors'
|
||||||
|
import { Header } from 'style/DialogStyles'
|
||||||
|
|
||||||
export const cacheBeforeReaderColor = '#b3dfc9'
|
export const cacheBeforeReaderColor = '#b3dfc9'
|
||||||
export const cacheAfterReaderColor = mainColors.light.primary
|
export const cacheAfterReaderColor = mainColors.light.primary
|
||||||
|
|
||||||
export const FooterSection = styled.div`
|
export const SettingsHeader = styled(Header)`
|
||||||
padding: 20px;
|
display: grid;
|
||||||
display: flex;
|
grid-auto-flow: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
|
||||||
|
@media (max-width: 340px) {
|
||||||
|
grid-auto-flow: row;
|
||||||
|
}
|
||||||
|
`
|
||||||
|
|
||||||
|
export const FooterSection = styled.div`
|
||||||
|
padding: 20px;
|
||||||
|
display: grid;
|
||||||
|
grid-auto-flow: column;
|
||||||
|
justify-content: end;
|
||||||
|
gap: 10px;
|
||||||
|
align-items: center;
|
||||||
background: #e8e5eb;
|
background: #e8e5eb;
|
||||||
|
|
||||||
> :last-child > :not(:last-child) {
|
@media (max-width: 500px) {
|
||||||
margin-right: 10px;
|
grid-auto-flow: row;
|
||||||
|
justify-content: stretch;
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
export const Divider = styled.div`
|
export const Divider = styled.div`
|
||||||
@@ -24,11 +39,12 @@ export const Divider = styled.div`
|
|||||||
export const Content = styled.div`
|
export const Content = styled.div`
|
||||||
${({ isLoading }) => css`
|
${({ isLoading }) => css`
|
||||||
background: #f1eff3;
|
background: #f1eff3;
|
||||||
min-height: 500px;
|
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
|
flex: 1;
|
||||||
|
|
||||||
${isLoading &&
|
${isLoading &&
|
||||||
css`
|
css`
|
||||||
|
min-height: 500px;
|
||||||
display: grid;
|
display: grid;
|
||||||
place-items: center;
|
place-items: center;
|
||||||
`}
|
`}
|
||||||
@@ -74,6 +90,7 @@ export const StorageButton = styled.div`
|
|||||||
${({ small, selected }) => css`
|
${({ small, selected }) => css`
|
||||||
transition: 0.2s;
|
transition: 0.2s;
|
||||||
cursor: default;
|
cursor: default;
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
${!selected &&
|
${!selected &&
|
||||||
css`
|
css`
|
||||||
@@ -110,18 +127,22 @@ export const StorageIconWrapper = styled.div`
|
|||||||
svg {
|
svg {
|
||||||
transform: rotate(-45deg) scale(0.75);
|
transform: rotate(-45deg) scale(0.75);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (max-width: 930px) {
|
||||||
|
width: ${small ? '50px' : '90px'};
|
||||||
|
height: ${small ? '50px' : '90px'};
|
||||||
|
}
|
||||||
`}
|
`}
|
||||||
`
|
`
|
||||||
|
|
||||||
export const CacheStorageSelector = styled.div`
|
export const CacheStorageSelector = styled.div`
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-rows: max-content 1fr;
|
grid-template-rows: max-content 1fr;
|
||||||
grid-template-columns: 1fr 1fr;
|
|
||||||
grid-template-areas: 'label label';
|
grid-template-areas: 'label label';
|
||||||
place-items: center;
|
place-items: center;
|
||||||
|
|
||||||
@media (max-width: 930px) {
|
@media (max-width: 930px) {
|
||||||
grid-template-columns: repeat(2, max-content);
|
justify-content: start;
|
||||||
column-gap: 30px;
|
column-gap: 30px;
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|||||||
@@ -97,6 +97,7 @@
|
|||||||
"RemoveRetrackers": "Remove retrackers",
|
"RemoveRetrackers": "Remove retrackers",
|
||||||
"ReplaceRetrackers": "Replace retrackers",
|
"ReplaceRetrackers": "Replace retrackers",
|
||||||
"RetrackersMode": "Retrackers Mode",
|
"RetrackersMode": "Retrackers Mode",
|
||||||
|
"ResetToDefault": "Reset to default",
|
||||||
"Settings": "Settings",
|
"Settings": "Settings",
|
||||||
"TorrentDisconnectTimeout": "Torrent Disconnect Timeout",
|
"TorrentDisconnectTimeout": "Torrent Disconnect Timeout",
|
||||||
"TorrentsSavePath": "Torrents Save Path",
|
"TorrentsSavePath": "Torrents Save Path",
|
||||||
|
|||||||
@@ -97,6 +97,7 @@
|
|||||||
"RemoveRetrackers": "Удалять",
|
"RemoveRetrackers": "Удалять",
|
||||||
"ReplaceRetrackers": "Заменять",
|
"ReplaceRetrackers": "Заменять",
|
||||||
"RetrackersMode": "Ретрекеры",
|
"RetrackersMode": "Ретрекеры",
|
||||||
|
"ResetToDefault": "Сбросить по умолчанию",
|
||||||
"Settings": "Настройки",
|
"Settings": "Настройки",
|
||||||
"TorrentDisconnectTimeout": "Тайм-аут отключения торрента (секунды)",
|
"TorrentDisconnectTimeout": "Тайм-аут отключения торрента (секунды)",
|
||||||
"TorrentsSavePath": "Путь хранения кеша",
|
"TorrentsSavePath": "Путь хранения кеша",
|
||||||
|
|||||||
Reference in New Issue
Block a user