diff --git a/src/components/MangaCard.tsx b/src/components/MangaCard.tsx
index 1366729a..0b67adcf 100644
--- a/src/components/MangaCard.tsx
+++ b/src/components/MangaCard.tsx
@@ -42,7 +42,7 @@ const getMangaLinkTo = (
export const MangaCard = (props: MangaCardProps) => {
const { manga, gridLayout, inLibraryIndicator, selected, handleSelection, mode = 'default' } = props;
- const { id, latestReadChapter, firstUnreadChapter, chapters, downloadCount, unreadCount } = manga;
+ const { id, firstUnreadChapter, downloadCount, unreadCount } = manga;
const {
options: { showContinueReadingButton },
} = useLibraryOptionsContext();
@@ -54,8 +54,7 @@ export const MangaCard = (props: MangaCardProps) => {
const mangaLinkTo = getMangaLinkTo(mode, manga.id, manga.sourceId, manga.title);
- const nextChapterIndexToRead = firstUnreadChapter?.sourceOrder ?? 1;
- const isLatestChapterRead = chapters?.totalCount === latestReadChapter?.sourceOrder;
+ const nextChapterIndexToRead = firstUnreadChapter?.sourceOrder;
const [isMigrateDialogOpen, setIsMigrateDialogOpen] = useState(false);
@@ -107,15 +106,12 @@ export const MangaCard = (props: MangaCardProps) => {
const continueReadingButton = useMemo(
() => (
),
- [showContinueReadingButton, isLatestChapterRead, nextChapterIndexToRead, mangaLinkTo],
+ [showContinueReadingButton, nextChapterIndexToRead, mangaLinkTo],
);
const mangaBadges = useMemo(
diff --git a/src/components/chapter/ChapterList.tsx b/src/components/chapter/ChapterList.tsx
index bfb32298..7a6d95c1 100644
--- a/src/components/chapter/ChapterList.tsx
+++ b/src/components/chapter/ChapterList.tsx
@@ -41,6 +41,7 @@ import { ChaptersDownloadActionMenuItems } from '@/components/chapter/ChaptersDo
import { defaultPromiseErrorHandler } from '@/util/defaultPromiseErrorHandler.ts';
import { LoadingPlaceholder } from '@/components/util/LoadingPlaceholder.tsx';
import { GET_CHAPTERS_MANGA } from '@/lib/graphql/queries/ChapterQuery.ts';
+import { Mangas } from '@/lib/data/Mangas';
const ChapterListHeader = styled(Stack)(({ theme }) => ({
margin: 8,
@@ -72,10 +73,7 @@ export const ChapterList = ({
manga,
isRefreshing,
}: {
- manga: Pick<
- MangaScreenFieldsFragment,
- 'id' | 'firstUnreadChapter' | 'chapters' | 'latestReadChapter' | 'unreadCount' | 'downloadCount'
- >;
+ manga: Pick;
isRefreshing: boolean;
}) => {
const { t } = useTranslation();
@@ -103,11 +101,10 @@ export const ChapterList = ({
const visibleChapters = useMemo(() => filterAndSortChapters(chapters, options), [chapters, options]);
- const nextChapterIndexToRead = manga.firstUnreadChapter?.sourceOrder ?? 1;
- const isLatestChapterRead = manga.chapters.totalCount === manga.latestReadChapter?.sourceOrder;
+ const nextChapterIndexToRead = manga.firstUnreadChapter?.sourceOrder;
- const areAllChaptersRead = manga.unreadCount === 0;
- const areAllChaptersDownloaded = manga.downloadCount === manga.chapters.totalCount;
+ const areAllChaptersRead = Mangas.isFullyRead(manga);
+ const areAllChaptersDownloaded = Mangas.isFullyDownloaded(manga);
const noChaptersFound = chapters.length === 0;
const noChaptersMatchingFilter = !noChaptersFound && visibleChapters.length === 0;
@@ -139,12 +136,12 @@ export const ChapterList = ({
);
}
- if (!isLatestChapterRead) {
+ if (nextChapterIndexToRead !== undefined) {
return ;
}
return null;
- }, [chaptersWithMeta, isLatestChapterRead]);
+ }, [chaptersWithMeta]);
if (isLoading || (noChaptersFound && isRefreshing)) {
return (
diff --git a/src/components/manga/ContinueReadingButton.tsx b/src/components/manga/ContinueReadingButton.tsx
index 4ed5af8b..b6c87407 100644
--- a/src/components/manga/ContinueReadingButton.tsx
+++ b/src/components/manga/ContinueReadingButton.tsx
@@ -15,20 +15,18 @@ import { Link } from 'react-router-dom';
export const ContinueReadingButton = ({
showContinueReadingButton,
- isLatestChapterRead,
nextChapterIndexToRead,
mangaLinkTo,
}: {
showContinueReadingButton: boolean;
- isLatestChapterRead: boolean;
- nextChapterIndexToRead: number;
+ nextChapterIndexToRead?: number;
mangaLinkTo: string;
}) => {
const { t } = useTranslation();
const isFirstChapter = nextChapterIndexToRead === 1;
- if (!showContinueReadingButton || isLatestChapterRead) {
+ if (!showContinueReadingButton || nextChapterIndexToRead === undefined) {
return null;
}
diff --git a/src/components/manga/MangaCard.types.tsx b/src/components/manga/MangaCard.types.tsx
index 62ce8c8b..01e03050 100644
--- a/src/components/manga/MangaCard.types.tsx
+++ b/src/components/manga/MangaCard.types.tsx
@@ -11,7 +11,7 @@ import { PopupState } from 'material-ui-popup-state/hooks';
import { GridLayout } from '@/components/context/LibraryOptionsContext.tsx';
import { SelectableCollectionReturnType } from '@/components/collection/useSelectableCollection.ts';
import { useManageMangaLibraryState } from '@/components/manga/useManageMangaLibraryState.tsx';
-import { MangaChapterCountInfo, MangaThumbnailInfo } from '@/lib/data/Mangas.ts';
+import { MangaThumbnailInfo } from '@/lib/data/Mangas.ts';
import { ChapterType, MangaType } from '@/lib/graphql/generated/graphql.ts';
import { SingleModeProps } from '@/components/manga/MangaActionMenuItems.tsx';
@@ -19,9 +19,7 @@ export type MangaCardMode = 'default' | 'source' | 'migrate.search' | 'migrate.s
type MangaCardBaseProps = Pick &
Omit &
- Partial> &
- Partial & {
- latestReadChapter?: Pick | null;
+ Partial> & {
firstUnreadChapter?: Pick | null;
};