Feature/global update settings update manga metadata (#441)
* Add "updateMangas" setting to global update settings * Sort "en.json" alphabetically
This commit is contained in:
@@ -9,13 +9,35 @@
|
|||||||
import List from '@mui/material/List';
|
import List from '@mui/material/List';
|
||||||
import ListSubheader from '@mui/material/ListSubheader';
|
import ListSubheader from '@mui/material/ListSubheader';
|
||||||
import { useTranslation } from 'react-i18next';
|
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 { GlobalUpdateSettingsCategories } from '@/components/settings/globalUpdate/GlobalUpdateSettingsCategories.tsx';
|
||||||
import { GlobalUpdateSettingsEntries } from '@/components/settings/globalUpdate/GlobalUpdateSettingsEntries.tsx';
|
import { GlobalUpdateSettingsEntries } from '@/components/settings/globalUpdate/GlobalUpdateSettingsEntries.tsx';
|
||||||
import { GlobalUpdateSettingsInterval } from '@/components/settings/globalUpdate/GlobalUpdateSettingsInterval.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 = () => {
|
export const GlobalUpdateSettings = () => {
|
||||||
const { t } = useTranslation();
|
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 (
|
return (
|
||||||
<List
|
<List
|
||||||
subheader={
|
subheader={
|
||||||
@@ -27,6 +49,19 @@ export const GlobalUpdateSettings = () => {
|
|||||||
<GlobalUpdateSettingsInterval />
|
<GlobalUpdateSettingsInterval />
|
||||||
<GlobalUpdateSettingsEntries />
|
<GlobalUpdateSettingsEntries />
|
||||||
<GlobalUpdateSettingsCategories />
|
<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>
|
</List>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -149,19 +149,21 @@
|
|||||||
},
|
},
|
||||||
"title": "Download Queue"
|
"title": "Download Queue"
|
||||||
},
|
},
|
||||||
"state": {
|
|
||||||
"label": {
|
|
||||||
"downloading": "Downloading",
|
|
||||||
"error": "Error",
|
|
||||||
"finished": "Finished",
|
|
||||||
"queued": "Queued"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"settings": {
|
"settings": {
|
||||||
"file_type": {
|
"auto_download": {
|
||||||
"label": {
|
"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": {
|
"download_path": {
|
||||||
"label": {
|
"label": {
|
||||||
@@ -169,23 +171,21 @@
|
|||||||
"title": "Download location"
|
"title": "Download location"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"auto_download": {
|
"file_type": {
|
||||||
"label": {
|
"label": {
|
||||||
"new_chapters": "Download new chapters",
|
"cbz": "Save as CBZ archive"
|
||||||
"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"
|
|
||||||
},
|
},
|
||||||
"title": "Download settings"
|
"title": "Download settings"
|
||||||
},
|
},
|
||||||
|
"state": {
|
||||||
|
"label": {
|
||||||
|
"downloading": "Downloading",
|
||||||
|
"error": "Error",
|
||||||
|
"finished": "Finished",
|
||||||
|
"queued": "Queued"
|
||||||
|
}
|
||||||
|
},
|
||||||
"title": "Downloads"
|
"title": "Downloads"
|
||||||
},
|
},
|
||||||
"extension": {
|
"extension": {
|
||||||
@@ -235,9 +235,6 @@
|
|||||||
"start": "Start",
|
"start": "Start",
|
||||||
"submit": "Submit"
|
"submit": "Submit"
|
||||||
},
|
},
|
||||||
"time": {
|
|
||||||
"hour_short": "h"
|
|
||||||
},
|
|
||||||
"date": {
|
"date": {
|
||||||
"label": {
|
"label": {
|
||||||
"today": "Today",
|
"today": "Today",
|
||||||
@@ -294,14 +291,17 @@
|
|||||||
"by_fetch_date": "By date fetched",
|
"by_fetch_date": "By date fetched",
|
||||||
"by_source": "By source"
|
"by_source": "By source"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"time": {
|
||||||
|
"hour_short": "h"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"library": {
|
"library": {
|
||||||
"error": {
|
"error": {
|
||||||
"label": {
|
"label": {
|
||||||
|
"add_to_library": "Could not add manga to library!",
|
||||||
"empty": "Your library is empty",
|
"empty": "Your library is empty",
|
||||||
"no_matches": "No manga matches this filter",
|
"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!"
|
"remove_from_library": "Could not remove manga from library!"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -338,6 +338,17 @@
|
|||||||
},
|
},
|
||||||
"settings": {
|
"settings": {
|
||||||
"global_update": {
|
"global_update": {
|
||||||
|
"auto_update": {
|
||||||
|
"interval": {
|
||||||
|
"label": {
|
||||||
|
"title": "Automatic update interval",
|
||||||
|
"value": "{{hours}}$t(global.time.hour_short)"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"label": {
|
||||||
|
"title": "Automatic updates"
|
||||||
|
}
|
||||||
|
},
|
||||||
"categories": {
|
"categories": {
|
||||||
"label": {
|
"label": {
|
||||||
"exclude": "Exclude: {{excludedCategoriesText}}",
|
"exclude": "Exclude: {{excludedCategoriesText}}",
|
||||||
@@ -346,22 +357,17 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"entries": {
|
"entries": {
|
||||||
"title": "Skip updating entries",
|
|
||||||
"label": {
|
"label": {
|
||||||
"completed": "With \"Completed\" status",
|
"completed": "With \"Completed\" status",
|
||||||
"not_started": "That haven't been started",
|
"not_started": "That haven't been started",
|
||||||
"unread_chapters": "With unread chapter(s)"
|
"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": {
|
"label": {
|
||||||
"title": "Automatic updates"
|
"description": "Check for new cover and details when updating library",
|
||||||
|
"title": "Automatically refresh metadata"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"title": "Global update"
|
"title": "Global update"
|
||||||
@@ -416,13 +422,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"label": {
|
"label": {
|
||||||
|
"fit_page_to_window": "Fit page to window",
|
||||||
"load_next_chapter": "Load next chapter at ending",
|
"load_next_chapter": "Load next chapter at ending",
|
||||||
|
"offset_first_page": "Offset first page",
|
||||||
"reader_type": "Reader type",
|
"reader_type": "Reader type",
|
||||||
"show_page_number": "Show page number",
|
"show_page_number": "Show page number",
|
||||||
"skip_dup_chapters": "Skip duplicate chapters",
|
"skip_dup_chapters": "Skip duplicate chapters",
|
||||||
"static_navigation": "Static navigation",
|
"static_navigation": "Static navigation"
|
||||||
"fit_page_to_window": "Fit page to window",
|
|
||||||
"offset_first_page": "Offset first page"
|
|
||||||
},
|
},
|
||||||
"reader_type": {
|
"reader_type": {
|
||||||
"label": {
|
"label": {
|
||||||
@@ -454,8 +460,8 @@
|
|||||||
"ignore_filters": "Ignore filters when searching"
|
"ignore_filters": "Ignore filters when searching"
|
||||||
},
|
},
|
||||||
"title": {
|
"title": {
|
||||||
"search": "Search",
|
"global_search": "Global Search",
|
||||||
"global_search": "Global Search"
|
"search": "Search"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"settings": {
|
"settings": {
|
||||||
|
|||||||
Reference in New Issue
Block a user