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