Feature/global update settings update manga metadata (#441)

* Add "updateMangas" setting to global update settings

* Sort "en.json" alphabetically
This commit is contained in:
schroda
2023-11-04 14:55:25 +01:00
committed by GitHub
parent 14e7af9a4a
commit a6cc757d50
2 changed files with 85 additions and 44 deletions

View File

@@ -9,13 +9,35 @@
import List from '@mui/material/List';
import ListSubheader from '@mui/material/ListSubheader';
import { useTranslation } from 'react-i18next';
import { ListItem, ListItemText, Switch } from '@mui/material';
import ListItemSecondaryAction from '@mui/material/ListItemSecondaryAction';
import { GlobalUpdateSettingsCategories } from '@/components/settings/globalUpdate/GlobalUpdateSettingsCategories.tsx';
import { GlobalUpdateSettingsEntries } from '@/components/settings/globalUpdate/GlobalUpdateSettingsEntries.tsx';
import { GlobalUpdateSettingsInterval } from '@/components/settings/globalUpdate/GlobalUpdateSettingsInterval.tsx';
import { requestManager } from '@/lib/requests/RequestManager.ts';
import { makeToast } from '@/components/util/Toast.tsx';
import { ServerSettings } from '@/typings.ts';
type LibrarySettingsType = Pick<ServerSettings, 'updateMangas'>;
export const GlobalUpdateSettings = () => {
const { t } = useTranslation();
const { data } = requestManager.useGetServerSettings();
const updateMangas = !!data?.settings.updateMangas;
const [mutateSettings] = requestManager.useUpdateServerSettings();
const updateSetting = async <Setting extends keyof LibrarySettingsType>(
setting: Setting,
value: LibrarySettingsType[Setting],
) => {
try {
await mutateSettings({ variables: { input: { settings: { [setting]: value } } } });
} catch (error) {
makeToast(t('global.error.label.failed_to_save_changes'), 'error');
}
};
return (
<List
subheader={
@@ -27,6 +49,19 @@ export const GlobalUpdateSettings = () => {
<GlobalUpdateSettingsInterval />
<GlobalUpdateSettingsEntries />
<GlobalUpdateSettingsCategories />
<ListItem>
<ListItemText
primary={t('library.settings.global_update.metadata.label.title')}
secondary={t('library.settings.global_update.metadata.label.description')}
/>
<ListItemSecondaryAction>
<Switch
edge="end"
checked={updateMangas}
onChange={(e) => updateSetting('updateMangas', e.target.checked)}
/>
</ListItemSecondaryAction>
</ListItem>
</List>
);
};

View File

@@ -149,19 +149,21 @@
},
"title": "Download Queue"
},
"state": {
"label": {
"downloading": "Downloading",
"error": "Error",
"finished": "Finished",
"queued": "Queued"
}
},
"settings": {
"file_type": {
"auto_download": {
"label": {
"cbz": "Save as CBZ archive"
}
"ignore_with_unread_chapters": "Ignore automatic chapter downloads for entries with unread chapters",
"new_chapters": "Download new chapters"
},
"title": "Auto-download"
},
"download_ahead": {
"label": {
"unread_chapters_to_download": "Number of unread chapters to download",
"value": "{{chapters}} $t(chapter.title)",
"while_reading": "Auto download while reading"
},
"title": "Download ahead"
},
"download_path": {
"label": {
@@ -169,23 +171,21 @@
"title": "Download location"
}
},
"auto_download": {
"file_type": {
"label": {
"new_chapters": "Download new chapters",
"ignore_with_unread_chapters": "Ignore automatic chapter downloads for entries with unread chapters"
},
"title": "Auto-download"
},
"download_ahead": {
"label": {
"while_reading": "Auto download while reading",
"unread_chapters_to_download": "Number of unread chapters to download",
"value": "{{chapters}} $t(chapter.title)"
},
"title": "Download ahead"
"cbz": "Save as CBZ archive"
}
},
"title": "Download settings"
},
"state": {
"label": {
"downloading": "Downloading",
"error": "Error",
"finished": "Finished",
"queued": "Queued"
}
},
"title": "Downloads"
},
"extension": {
@@ -235,9 +235,6 @@
"start": "Start",
"submit": "Submit"
},
"time": {
"hour_short": "h"
},
"date": {
"label": {
"today": "Today",
@@ -294,14 +291,17 @@
"by_fetch_date": "By date fetched",
"by_source": "By source"
}
},
"time": {
"hour_short": "h"
}
},
"library": {
"error": {
"label": {
"add_to_library": "Could not add manga to library!",
"empty": "Your library is empty",
"no_matches": "No manga matches this filter",
"add_to_library": "Could not add manga to library!",
"remove_from_library": "Could not remove manga from library!"
}
},
@@ -338,6 +338,17 @@
},
"settings": {
"global_update": {
"auto_update": {
"interval": {
"label": {
"title": "Automatic update interval",
"value": "{{hours}}$t(global.time.hour_short)"
}
},
"label": {
"title": "Automatic updates"
}
},
"categories": {
"label": {
"exclude": "Exclude: {{excludedCategoriesText}}",
@@ -346,22 +357,17 @@
}
},
"entries": {
"title": "Skip updating entries",
"label": {
"completed": "With \"Completed\" status",
"not_started": "That haven't been started",
"unread_chapters": "With unread chapter(s)"
}
},
"auto_update": {
"interval": {
"label": {
"value": "{{hours}}$t(global.time.hour_short)",
"title": "Automatic update interval"
}
},
"title": "Skip updating entries"
},
"metadata": {
"label": {
"title": "Automatic updates"
"description": "Check for new cover and details when updating library",
"title": "Automatically refresh metadata"
}
},
"title": "Global update"
@@ -416,13 +422,13 @@
}
},
"label": {
"fit_page_to_window": "Fit page to window",
"load_next_chapter": "Load next chapter at ending",
"offset_first_page": "Offset first page",
"reader_type": "Reader type",
"show_page_number": "Show page number",
"skip_dup_chapters": "Skip duplicate chapters",
"static_navigation": "Static navigation",
"fit_page_to_window": "Fit page to window",
"offset_first_page": "Offset first page"
"static_navigation": "Static navigation"
},
"reader_type": {
"label": {
@@ -454,8 +460,8 @@
"ignore_filters": "Ignore filters when searching"
},
"title": {
"search": "Search",
"global_search": "Global Search"
"global_search": "Global Search",
"search": "Search"
}
},
"settings": {
@@ -530,4 +536,4 @@
},
"title": "Updates"
}
}
}