From 99e5eb2dac388c11635b02ff9e006c3423811e01 Mon Sep 17 00:00:00 2001
From: schroda <50052685+schroda@users.noreply.github.com>
Date: Sat, 5 Jul 2025 15:51:07 +0200
Subject: [PATCH] Cleanup chapter download option menu
---
public/locales/en.json | 6 +-
.../ChaptersDownloadActionMenuItems.tsx | 56 +++++++++----------
2 files changed, 29 insertions(+), 33 deletions(-)
diff --git a/public/locales/en.json b/public/locales/en.json
index 93ece585..a4cea328 100644
--- a/public/locales/en.json
+++ b/public/locales/en.json
@@ -81,10 +81,8 @@
"confirmation_other": "You are about to download {{count}} chapters.\nSuwayomi is not a mass downloader and too many downloads can get you banned from sources and/or cause performance issues.",
"error_one": "Could not add the download",
"error_other": "Could not add downloads",
- "next": "$t(reader.button.next_chapter)",
- "next_five": "Next 5 chapters",
- "next_ten": "Next 10 chapters",
- "next_twentyfive": "Next 25 chapters",
+ "next_one": "Next chapter",
+ "next_other" : "Next {{count}} chapters",
"success_one": "Download added",
"success_other": "{{count}} downloads added",
"unread": "$t(global.filter.label.unread)"
diff --git a/src/modules/chapter/components/actions/ChaptersDownloadActionMenuItems.tsx b/src/modules/chapter/components/actions/ChaptersDownloadActionMenuItems.tsx
index f6bc4ec5..894f9f4c 100644
--- a/src/modules/chapter/components/actions/ChaptersDownloadActionMenuItems.tsx
+++ b/src/modules/chapter/components/actions/ChaptersDownloadActionMenuItems.tsx
@@ -12,14 +12,25 @@ import { useMetadataServerSettings } from '@/modules/settings/services/ServerSet
import { Mangas } from '@/modules/manga/services/Mangas.ts';
import { defaultPromiseErrorHandler } from '@/lib/DefaultPromiseErrorHandler.ts';
import { MangaType } from '@/lib/graphql/generated/graphql.ts';
+import { TranslationKey } from '@/Base.types.ts';
-const DownloadRange = {
- NEXT_1: 1,
- NEXT_5: 5,
- NEXT_10: 10,
- NEXT_25: 25,
- ALL: undefined,
-};
+const DOWNLOAD_OPTIONS: {
+ title: TranslationKey;
+ getCount: (downloadAheadLimit: number) => number | undefined;
+ onlyUnread?: boolean;
+}[] = [
+ { title: 'chapter.action.download.add.label.next', getCount: () => 1 },
+ { title: 'chapter.action.download.add.label.next', getCount: () => 5 },
+ { title: 'chapter.action.download.add.label.next', getCount: () => 10 },
+ { title: 'chapter.action.download.add.label.next', getCount: () => 25 },
+ {
+ title: 'chapter.action.download.add.label.ahead',
+ getCount: (downloadAheadLimit) => downloadAheadLimit,
+ onlyUnread: true,
+ },
+ { title: 'chapter.action.download.add.label.unread', getCount: () => undefined, onlyUnread: true },
+ { title: 'chapter.action.download.add.label.all', getCount: () => undefined, onlyUnread: false },
+];
export const ChaptersDownloadActionMenuItems = ({
mangaIds,
@@ -39,33 +50,20 @@ export const ChaptersDownloadActionMenuItems = ({
downloadAhead,
onlyUnread,
size,
- }).catch(defaultPromiseErrorHandler('ChapterDownloadButton::handleSelect'));
+ }).catch(defaultPromiseErrorHandler('ChaptersDownloadActionMenuItems::handleSelect'));
closeMenu?.();
};
return (
<>
-
-
-
-
-
-
-
+ {DOWNLOAD_OPTIONS.map(({ title, getCount, onlyUnread }) => (
+
+ ))}
>
);
};