-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: (preferences) migrate display settings to react components
- Loading branch information
1 parent
0c7fdd6
commit ce4c7ae
Showing
11 changed files
with
443 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
95 changes: 95 additions & 0 deletions
95
src/apps/experimental/routes/user/display/DisplayPreferences.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
import Checkbox from '@mui/material/Checkbox'; | ||
import FormControl from '@mui/material/FormControl'; | ||
import FormControlLabel from '@mui/material/FormControlLabel'; | ||
import FormHelperText from '@mui/material/FormHelperText'; | ||
import MenuItem from '@mui/material/MenuItem'; | ||
import Select from '@mui/material/Select'; | ||
import Stack from '@mui/material/Stack'; | ||
import TextField from '@mui/material/TextField'; | ||
import Typography from '@mui/material/Typography'; | ||
import React from 'react'; | ||
|
||
import globalize from 'scripts/globalize'; | ||
|
||
export function DisplayPreferences() { | ||
return ( | ||
<Stack spacing={2}> | ||
<Typography variant='h2'>{globalize.translate('Display')}</Typography> | ||
|
||
<FormControl fullWidth> | ||
<Select | ||
aria-describedby='display-settings-layout-description' | ||
label={globalize.translate('LabelDisplayMode')} | ||
> | ||
<MenuItem value='auto'>{globalize.translate('Auto')}</MenuItem> | ||
<MenuItem value='desktop'>{globalize.translate('Desktop')}</MenuItem> | ||
<MenuItem value='mobile'>{globalize.translate('Mobile')}</MenuItem> | ||
<MenuItem value='tv'>{globalize.translate('TV')}</MenuItem> | ||
<MenuItem value='experimental'>{globalize.translate('Experimental')}</MenuItem> | ||
</Select> | ||
<FormHelperText component={Stack} id='display-settings-layout-description'> | ||
<span>{globalize.translate('DisplayModeHelp')}</span> | ||
<span>{globalize.translate('LabelPleaseRestart')}</span> | ||
</FormHelperText> | ||
</FormControl> | ||
|
||
<FormControl fullWidth> | ||
<Select label={globalize.translate('LabelTheme')}> | ||
</Select> | ||
</FormControl> | ||
|
||
<FormControl fullWidth> | ||
<FormControlLabel | ||
aria-describedby='display-settings-disable-css-description' | ||
control={<Checkbox />} | ||
label={globalize.translate('DisableCustomCss')} | ||
/> | ||
<FormHelperText id='display-settings-disable-css-description'> | ||
{globalize.translate('LabelDisableCustomCss')} | ||
</FormHelperText> | ||
</FormControl> | ||
|
||
<FormControl fullWidth> | ||
<TextField | ||
aria-describedby='display-settings-custom-css-description' | ||
label={globalize.translate('LabelCustomCss')} | ||
multiline | ||
/> | ||
<FormHelperText id='display-settings-custom-css-description'> | ||
{globalize.translate('LabelLocalCustomCss')} | ||
</FormHelperText> | ||
</FormControl> | ||
|
||
{/* TODO: There are some admin-only options here */} | ||
{/* Server Dashboard Theme */} | ||
|
||
<FormControl fullWidth> | ||
<Select label={globalize.translate('LabelScreensaver')}></Select> | ||
</FormControl> | ||
|
||
{/* TODO: There are some extra options here related to screensavers */} | ||
|
||
<FormControl fullWidth> | ||
<FormControlLabel | ||
aria-describedby='display-settings-faster-animations-description' | ||
control={<Checkbox />} | ||
label={globalize.translate('EnableFasterAnimations')} | ||
/> | ||
<FormHelperText id='display-settings-faster-animations-description'> | ||
{globalize.translate('EnableFasterAnimationsHelp')} | ||
</FormHelperText> | ||
</FormControl> | ||
|
||
<FormControl fullWidth> | ||
<FormControlLabel | ||
aria-describedby='display-settings-blurhash-description' | ||
control={<Checkbox />} | ||
label={globalize.translate('EnableBlurHash')} | ||
/> | ||
<FormHelperText id='display-settings-blurhash-description'> | ||
{globalize.translate('EnableBlurHashHelp')} | ||
</FormHelperText> | ||
</FormControl> | ||
</Stack> | ||
); | ||
} |
28 changes: 28 additions & 0 deletions
28
src/apps/experimental/routes/user/display/ItemDetailPreferences.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import Checkbox from '@mui/material/Checkbox'; | ||
import FormControl from '@mui/material/FormControl'; | ||
import FormControlLabel from '@mui/material/FormControlLabel'; | ||
import FormHelperText from '@mui/material/FormHelperText'; | ||
import Stack from '@mui/material/Stack'; | ||
import Typography from '@mui/material/Typography'; | ||
import React from 'react'; | ||
|
||
import globalize from 'scripts/globalize'; | ||
|
||
export function ItemDetailPreferences() { | ||
return ( | ||
<Stack spacing={3}> | ||
<Typography variant='h2'>{globalize.translate('ItemDetails')}</Typography> | ||
|
||
<FormControl fullWidth> | ||
<FormControlLabel | ||
aria-describedby='display-settings-item-details-banner-description' | ||
control={<Checkbox />} | ||
label={globalize.translate('EnableDetailsBanner')} | ||
/> | ||
<FormHelperText id='display-settings-item-details-banner-description'> | ||
{globalize.translate('EnableDetailsBannerHelp')} | ||
</FormHelperText> | ||
</FormControl> | ||
</Stack> | ||
); | ||
} |
81 changes: 81 additions & 0 deletions
81
src/apps/experimental/routes/user/display/LibraryPreferences.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import Checkbox from '@mui/material/Checkbox'; | ||
import FormControl from '@mui/material/FormControl'; | ||
import FormControlLabel from '@mui/material/FormControlLabel'; | ||
import FormHelperText from '@mui/material/FormHelperText'; | ||
import Stack from '@mui/material/Stack'; | ||
import TextField from '@mui/material/TextField'; | ||
import Typography from '@mui/material/Typography'; | ||
import React from 'react'; | ||
|
||
import globalize from 'scripts/globalize'; | ||
|
||
export function LibraryPreferences() { | ||
return ( | ||
<Stack spacing={3}> | ||
<Typography variant='h2'>{globalize.translate('HeaderLibraries')}</Typography> | ||
|
||
<FormControl fullWidth> | ||
<TextField | ||
aria-describedby='display-settings-lib-pagesize-description' | ||
inputProps={{ | ||
type: 'number', | ||
inputMode: 'numeric', | ||
max: '1000', | ||
min: '0', | ||
pattern: '[0-9]', | ||
required: true, | ||
step: '1' | ||
}} | ||
label={globalize.translate('LabelLibraryPageSize')} | ||
/> | ||
<FormHelperText id='display-settings-lib-pagesize-description'> | ||
{globalize.translate('LabelLibraryPageSizeHelp')} | ||
</FormHelperText> | ||
</FormControl> | ||
|
||
<FormControl fullWidth> | ||
<FormControlLabel | ||
aria-describedby='display-settings-lib-backdrops-description' | ||
control={<Checkbox />} | ||
label={globalize.translate('Backdrops')} | ||
/> | ||
<FormHelperText id='display-settings-lib-backdrops-description'> | ||
{globalize.translate('EnableBackdropsHelp')} | ||
</FormHelperText> | ||
</FormControl> | ||
|
||
<FormControl fullWidth> | ||
<FormControlLabel | ||
aria-describedby='display-settings-lib-theme-songs-description' | ||
control={<Checkbox />} | ||
label={globalize.translate('ThemeSongs')} | ||
/> | ||
<FormHelperText id='display-settings-lib-theme-songs-description'> | ||
{globalize.translate('EnableThemeSongsHelp')} | ||
</FormHelperText> | ||
</FormControl> | ||
|
||
<FormControl fullWidth> | ||
<FormControlLabel | ||
aria-describedby='display-settings-lib-theme-videos-description' | ||
control={<Checkbox />} | ||
label={globalize.translate('ThemeVideos')} | ||
/> | ||
<FormHelperText id='display-settings-lib-theme-videos-description'> | ||
{globalize.translate('EnableThemeVideosHelp')} | ||
</FormHelperText> | ||
</FormControl> | ||
|
||
<FormControl fullWidth> | ||
<FormControlLabel | ||
aria-describedby='display-settings-show-missing-episodes-description' | ||
control={<Checkbox />} | ||
label={globalize.translate('DisplayMissingEpisodesWithinSeasons')} | ||
/> | ||
<FormHelperText id='display-settings-show-missing-episodes-description'> | ||
{globalize.translate('DisplayMissingEpisodesWithinSeasonsHelp')} | ||
</FormHelperText> | ||
</FormControl> | ||
</Stack> | ||
); | ||
} |
48 changes: 48 additions & 0 deletions
48
src/apps/experimental/routes/user/display/LocalizationPreferences.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import FormControl from '@mui/material/FormControl'; | ||
import FormHelperText from '@mui/material/FormHelperText'; | ||
import Link from '@mui/material/Link'; | ||
import MenuItem from '@mui/material/MenuItem'; | ||
import Select from '@mui/material/Select'; | ||
import Stack from '@mui/material/Stack'; | ||
import Typography from '@mui/material/Typography'; | ||
import React from 'react'; | ||
|
||
import globalize from 'scripts/globalize'; | ||
import { DATE_LOCALE_OPTIONS, LANGUAGE_OPTIONS } from './constants'; | ||
|
||
export function LocalizationPreferences() { | ||
return ( | ||
<Stack spacing={3}> | ||
<Typography variant='h2'>{globalize.translate('Localization')}</Typography> | ||
|
||
<FormControl fullWidth> | ||
<Select | ||
aria-describedby='display-settings-language-description' | ||
label={globalize.translate('LabelDisplayLanguage')} | ||
> | ||
{ ...LANGUAGE_OPTIONS.map(({ value, label }) => ( | ||
<MenuItem key={value } value={value}>{ label }</MenuItem> | ||
))} | ||
</Select> | ||
<FormHelperText component={Stack} id='display-settings-language-description'> | ||
<span>{globalize.translate('LabelDisplayLanguageHelp')}</span> | ||
<Link | ||
href='https://github.com/jellyfin/jellyfin' | ||
rel='noopener noreferrer' | ||
target='_blank' | ||
> | ||
{globalize.translate('LearnHowYouCanContribute')} | ||
</Link> | ||
</FormHelperText> | ||
</FormControl> | ||
|
||
<FormControl fullWidth> | ||
<Select label={globalize.translate('LabelDateTimeLocale')}> | ||
{...DATE_LOCALE_OPTIONS.map(({ value, label }) => ( | ||
<MenuItem key={value} value={value}>{label}</MenuItem> | ||
))} | ||
</Select> | ||
</FormControl> | ||
</Stack> | ||
); | ||
} |
59 changes: 59 additions & 0 deletions
59
src/apps/experimental/routes/user/display/NextUpPreferences.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import Checkbox from '@mui/material/Checkbox'; | ||
import FormControl from '@mui/material/FormControl'; | ||
import FormControlLabel from '@mui/material/FormControlLabel'; | ||
import FormHelperText from '@mui/material/FormHelperText'; | ||
import Stack from '@mui/material/Stack'; | ||
import TextField from '@mui/material/TextField'; | ||
import Typography from '@mui/material/Typography'; | ||
import React from 'react'; | ||
|
||
import globalize from 'scripts/globalize'; | ||
|
||
export function NextUpPreferences() { | ||
return ( | ||
<Stack spacing={3}> | ||
<Typography variant='h2'>{globalize.translate('NextUp')}</Typography> | ||
|
||
<FormControl fullWidth> | ||
<TextField | ||
aria-describedby='display-settings-max-days-next-up-description' | ||
inputProps={{ | ||
type: 'number', | ||
inputMode: 'numeric', | ||
max: '1000', | ||
min: '0', | ||
pattern: '[0-9]', | ||
required: true, | ||
step: '1' | ||
}} | ||
label={globalize.translate('LabelMaxDaysForNextUp')} | ||
/> | ||
<FormHelperText id='display-settings-max-days-next-up-description'> | ||
{globalize.translate('LabelMaxDaysForNextUpHelp')} | ||
</FormHelperText> | ||
</FormControl> | ||
|
||
<FormControl fullWidth> | ||
<FormControlLabel | ||
aria-describedby='display-settings-next-up-rewatching-description' | ||
control={<Checkbox />} | ||
label={globalize.translate('EnableRewatchingNextUp')} | ||
/> | ||
<FormHelperText id='display-settings-next-up-rewatching-description'> | ||
{globalize.translate('EnableRewatchingNextUpHelp')} | ||
</FormHelperText> | ||
</FormControl> | ||
|
||
<FormControl fullWidth> | ||
<FormControlLabel | ||
aria-describedby='display-settings-next-up-images-description' | ||
control={<Checkbox />} | ||
label={globalize.translate('UseEpisodeImagesInNextUp')} | ||
/> | ||
<FormHelperText id='display-settings-next-up-images-description'> | ||
{globalize.translate('UseEpisodeImagesInNextUpHelp')} | ||
</FormHelperText> | ||
</FormControl> | ||
</Stack> | ||
); | ||
} |
Oops, something went wrong.