Fix downloaded consideration of manga without any chapters
This commit is contained in:
@@ -59,7 +59,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|||||||
- (**Reader**) Fix infinite scrolling sometimes not opening previous/next chapter
|
- (**Reader**) Fix infinite scrolling sometimes not opening previous/next chapter
|
||||||
- (**Reader**) Fix preserving scroll position with RTL reading direction and a language that is read RTL
|
- (**Reader**) Fix preserving scroll position with RTL reading direction and a language that is read RTL
|
||||||
- (**Browse**) Fix showing only nsfw sources in the browse source page when the "show nsfw" setting is disabled
|
- (**Browse**) Fix showing only nsfw sources in the browse source page when the "show nsfw" setting is disabled
|
||||||
- (**Manga**) Fix mark as read/unread option not being disabled for manga without any chapters
|
- (**Manga/Library**) Fix mark as read/unread option not being disabled for manga without any chapters
|
||||||
|
- (**Manga/Library**) Fix delete/download option not being disabled for manga without any chapters
|
||||||
|
|
||||||
## [20260509.01] (r3147) - 2026-05-09
|
## [20260509.01] (r3147) - 2026-05-09
|
||||||
|
|
||||||
|
|||||||
@@ -82,10 +82,10 @@ export const MangaActionMenuItems = ({
|
|||||||
const shouldShowMenuItem = createShouldShowMenuItem(isSingleMode);
|
const shouldShowMenuItem = createShouldShowMenuItem(isSingleMode);
|
||||||
const isMenuItemDisabled = createIsMenuItemDisabled(isSingleMode);
|
const isMenuItemDisabled = createIsMenuItemDisabled(isSingleMode);
|
||||||
|
|
||||||
const isFullyDownloaded = !!manga && manga.downloadCount === manga.chapters.totalCount;
|
const isPartiallyDownloaded = !!manga && Mangas.isPartiallyDownloaded(manga);
|
||||||
const hasDownloadedChapters = !!manga?.downloadCount;
|
const hasDownloadedChapters = manga && Mangas.isPartiallyDownloaded(manga);
|
||||||
const hasUnreadChapters = !!manga?.unreadCount;
|
const hasUnreadChapters = manga && Mangas.isPartiallyRead(manga);
|
||||||
const hasReadChapters = !!manga && manga.unreadCount !== manga.chapters.totalCount;
|
const hasReadChapters = !!manga && Mangas.isPartiallyRead(manga);
|
||||||
|
|
||||||
const handleSelect = () => {
|
const handleSelect = () => {
|
||||||
handleSelection?.(manga.id, true);
|
handleSelection?.(manga.id, true);
|
||||||
@@ -121,7 +121,7 @@ export const MangaActionMenuItems = ({
|
|||||||
{!!handleSelection && isSingleMode && (
|
{!!handleSelection && isSingleMode && (
|
||||||
<MenuItem onClick={handleSelect} Icon={CheckBoxOutlineBlank} title={t`Select`} />
|
<MenuItem onClick={handleSelect} Icon={CheckBoxOutlineBlank} title={t`Select`} />
|
||||||
)}
|
)}
|
||||||
{shouldShowMenuItem(!isFullyDownloaded) && (
|
{shouldShowMenuItem(isPartiallyDownloaded) && (
|
||||||
<NestedMenuItem
|
<NestedMenuItem
|
||||||
disabled={isMenuItemDisabled(!downloadableMangas.length)}
|
disabled={isMenuItemDisabled(!downloadableMangas.length)}
|
||||||
LeftIcon={Download}
|
LeftIcon={Download}
|
||||||
|
|||||||
@@ -119,8 +119,8 @@ export class Mangas {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static isNotDownloaded({ downloadCount }: MangaDownloadInfo): boolean {
|
static isNotDownloaded({ downloadCount, chapters: { totalCount } }: MangaDownloadInfo): boolean {
|
||||||
return downloadCount === 0;
|
return totalCount > 0 && downloadCount === 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static getNotDownloaded<Mangas extends MangaDownloadInfo>(mangas: Mangas[]): Mangas[] {
|
static getNotDownloaded<Mangas extends MangaDownloadInfo>(mangas: Mangas[]): Mangas[] {
|
||||||
@@ -128,7 +128,7 @@ export class Mangas {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static isFullyDownloaded({ downloadCount, chapters: { totalCount } }: MangaDownloadInfo): boolean {
|
static isFullyDownloaded({ downloadCount, chapters: { totalCount } }: MangaDownloadInfo): boolean {
|
||||||
return downloadCount === totalCount;
|
return totalCount > 0 && downloadCount === totalCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
static getFullyDownloaded<Mangas extends MangaDownloadInfo>(mangas: Mangas[]): Mangas[] {
|
static getFullyDownloaded<Mangas extends MangaDownloadInfo>(mangas: Mangas[]): Mangas[] {
|
||||||
@@ -136,7 +136,11 @@ export class Mangas {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static isPartiallyDownloaded(manga: MangaDownloadInfo): boolean {
|
static isPartiallyDownloaded(manga: MangaDownloadInfo): boolean {
|
||||||
return !Mangas.isNotDownloaded(manga) && !Mangas.isFullyDownloaded(manga);
|
const {
|
||||||
|
chapters: { totalCount },
|
||||||
|
} = manga;
|
||||||
|
|
||||||
|
return totalCount > 0 && !Mangas.isNotDownloaded(manga) && !Mangas.isFullyDownloaded(manga);
|
||||||
}
|
}
|
||||||
|
|
||||||
static getPartiallyDownloaded<Mangas extends MangaDownloadInfo>(mangas: Mangas[]): Mangas[] {
|
static getPartiallyDownloaded<Mangas extends MangaDownloadInfo>(mangas: Mangas[]): Mangas[] {
|
||||||
|
|||||||
Reference in New Issue
Block a user