Move "category settings" to "LibrarySettings"
This commit is contained in:
@@ -2,7 +2,8 @@
|
|||||||
"category": {
|
"category": {
|
||||||
"dialog": {
|
"dialog": {
|
||||||
"title": {
|
"title": {
|
||||||
"edit_category": "Edit category",
|
"edit_category_one": "Edit category",
|
||||||
|
"edit_category_other": "Edit categories",
|
||||||
"new_category": "New category"
|
"new_category": "New category"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ export function CategorySettings() {
|
|||||||
|
|
||||||
const { setTitle, setAction } = useNavBarContext();
|
const { setTitle, setAction } = useNavBarContext();
|
||||||
useLayoutEffect(() => {
|
useLayoutEffect(() => {
|
||||||
setTitle(t('category.title.category_other'));
|
setTitle(t('category.dialog.title.edit_category_other'));
|
||||||
setAction(null);
|
setAction(null);
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
@@ -169,7 +169,7 @@ export function CategorySettings() {
|
|||||||
<DialogTitle id="form-dialog-title">
|
<DialogTitle id="form-dialog-title">
|
||||||
{categoryToEdit === -1
|
{categoryToEdit === -1
|
||||||
? t('category.dialog.title.new_category')
|
? t('category.dialog.title.new_category')
|
||||||
: t('category.dialog.title.edit_category')}
|
: t('category.dialog.title.edit_category_one')}
|
||||||
</DialogTitle>
|
</DialogTitle>
|
||||||
<DialogContent>
|
<DialogContent>
|
||||||
<TextField
|
<TextField
|
||||||
|
|||||||
@@ -90,6 +90,9 @@ export function LibrarySettings() {
|
|||||||
makeToast(t('search.error.label.failed_to_save_settings'), 'error', getErrorMessage(e)),
|
makeToast(t('search.error.label.failed_to_save_settings'), 'error', getErrorMessage(e)),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// -1 for the DEFAULT category
|
||||||
|
const categoryCount = (categories.data?.categories.nodes.length ?? 1) - 1;
|
||||||
|
|
||||||
const loading = serverSettings.loading || areMetadataServerSettingsLoading || categories.loading;
|
const loading = serverSettings.loading || areMetadataServerSettingsLoading || categories.loading;
|
||||||
if (loading) {
|
if (loading) {
|
||||||
return <LoadingPlaceholder />;
|
return <LoadingPlaceholder />;
|
||||||
@@ -126,22 +129,20 @@ export function LibrarySettings() {
|
|||||||
<List sx={{ pt: 0 }}>
|
<List sx={{ pt: 0 }}>
|
||||||
<List
|
<List
|
||||||
subheader={
|
subheader={
|
||||||
<ListSubheader component="div" id="library-general-settings">
|
<ListSubheader component="div" id="library-category-settings">
|
||||||
{t('global.label.general')}
|
{t('category.title.category_other')}
|
||||||
</ListSubheader>
|
</ListSubheader>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<ListItem>
|
<ListItemLink to={AppRoutes.settings.childRoutes.categories.path}>
|
||||||
<ListItemText
|
<ListItemText
|
||||||
primary={t('library.settings.general.search.ignore_filters.label.title')}
|
primary={t('category.dialog.title.edit_category_other')}
|
||||||
secondary={t('library.settings.general.search.ignore_filters.label.description')}
|
secondary={t('global.value', {
|
||||||
|
value: categoryCount,
|
||||||
|
unit: ` ${t('category.title.category', { count: categoryCount })}`.toLocaleLowerCase(),
|
||||||
|
})}
|
||||||
/>
|
/>
|
||||||
<Switch
|
</ListItemLink>
|
||||||
edge="end"
|
|
||||||
checked={settings.ignoreFilters}
|
|
||||||
onChange={(e) => setSettingValue('ignoreFilters', e.target.checked)}
|
|
||||||
/>
|
|
||||||
</ListItem>
|
|
||||||
<ListItem>
|
<ListItem>
|
||||||
<ListItemText
|
<ListItemText
|
||||||
primary={t('library.settings.general.add_to_library.category_selection.label.title')}
|
primary={t('library.settings.general.add_to_library.category_selection.label.title')}
|
||||||
@@ -167,6 +168,25 @@ export function LibrarySettings() {
|
|||||||
/>
|
/>
|
||||||
</ListItem>
|
</ListItem>
|
||||||
</List>
|
</List>
|
||||||
|
<List
|
||||||
|
subheader={
|
||||||
|
<ListSubheader component="div" id="library-general-settings">
|
||||||
|
{t('global.label.general')}
|
||||||
|
</ListSubheader>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<ListItem>
|
||||||
|
<ListItemText
|
||||||
|
primary={t('library.settings.general.search.ignore_filters.label.title')}
|
||||||
|
secondary={t('library.settings.general.search.ignore_filters.label.description')}
|
||||||
|
/>
|
||||||
|
<Switch
|
||||||
|
edge="end"
|
||||||
|
checked={settings.ignoreFilters}
|
||||||
|
onChange={(e) => setSettingValue('ignoreFilters', e.target.checked)}
|
||||||
|
/>
|
||||||
|
</ListItem>
|
||||||
|
</List>
|
||||||
<GlobalUpdateSettings
|
<GlobalUpdateSettings
|
||||||
serverSettings={serverSettings.data!.settings}
|
serverSettings={serverSettings.data!.settings}
|
||||||
categories={categories.data!.categories.nodes}
|
categories={categories.data!.categories.nodes}
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
import { useLayoutEffect } from 'react';
|
import { useLayoutEffect } from 'react';
|
||||||
import AutoStoriesIcon from '@mui/icons-material/AutoStories';
|
import AutoStoriesIcon from '@mui/icons-material/AutoStories';
|
||||||
import List from '@mui/material/List';
|
import List from '@mui/material/List';
|
||||||
import ListAltIcon from '@mui/icons-material/ListAlt';
|
|
||||||
import BackupIcon from '@mui/icons-material/Backup';
|
import BackupIcon from '@mui/icons-material/Backup';
|
||||||
import ListItemIcon from '@mui/material/ListItemIcon';
|
import ListItemIcon from '@mui/material/ListItemIcon';
|
||||||
import ListItemText from '@mui/material/ListItemText';
|
import ListItemText from '@mui/material/ListItemText';
|
||||||
@@ -64,12 +63,6 @@ export function Settings() {
|
|||||||
</ListItemIcon>
|
</ListItemIcon>
|
||||||
<ListItemText primary={t('settings.appearance.title')} />
|
<ListItemText primary={t('settings.appearance.title')} />
|
||||||
</ListItemLink>
|
</ListItemLink>
|
||||||
<ListItemLink to={AppRoutes.settings.childRoutes.categories.path}>
|
|
||||||
<ListItemIcon>
|
|
||||||
<ListAltIcon />
|
|
||||||
</ListItemIcon>
|
|
||||||
<ListItemText primary={t('category.title.category_other')} />
|
|
||||||
</ListItemLink>
|
|
||||||
<ListItemLink to={AppRoutes.settings.childRoutes.reader.path}>
|
<ListItemLink to={AppRoutes.settings.childRoutes.reader.path}>
|
||||||
<ListItemIcon>
|
<ListItemIcon>
|
||||||
<AutoStoriesIcon />
|
<AutoStoriesIcon />
|
||||||
|
|||||||
Reference in New Issue
Block a user