Use first unread chapter for continue read buttons (#689)
This commit is contained in:
@@ -94,7 +94,16 @@ export const MangaCard = (props: MangaCardProps) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const { manga, gridLayout, inLibraryIndicator, selected, handleSelection, mode = 'default' } = props;
|
||||
const { id, title, downloadCount, unreadCount: unread, inLibrary, latestReadChapter, chapters } = manga;
|
||||
const {
|
||||
id,
|
||||
title,
|
||||
downloadCount,
|
||||
unreadCount: unread,
|
||||
inLibrary,
|
||||
latestReadChapter,
|
||||
firstUnreadChapter,
|
||||
chapters,
|
||||
} = manga;
|
||||
const thumbnailUrl = Mangas.getThumbnailUrl(manga);
|
||||
const {
|
||||
options: { showContinueReadingButton, showUnreadBadge, showDownloadBadge },
|
||||
@@ -102,7 +111,7 @@ export const MangaCard = (props: MangaCardProps) => {
|
||||
|
||||
const mangaLinkTo = getMangaLinkTo(mode, manga.id, manga.source?.id, manga.title);
|
||||
|
||||
const nextChapterIndexToRead = (latestReadChapter?.sourceOrder ?? 0) + 1;
|
||||
const nextChapterIndexToRead = firstUnreadChapter?.sourceOrder ?? 1;
|
||||
const isLatestChapterRead = chapters?.totalCount === latestReadChapter?.sourceOrder;
|
||||
|
||||
const [isMigrateDialogOpen, setIsMigrateDialogOpen] = useState(false);
|
||||
|
||||
@@ -79,7 +79,7 @@ export const ChapterList: React.FC<IProps> = ({ manga, isRefreshing }) => {
|
||||
|
||||
const visibleChapters = useMemo(() => filterAndSortChapters(chapters, options), [chapters, options]);
|
||||
|
||||
const nextChapterIndexToRead = (manga.latestReadChapter?.sourceOrder ?? 0) + 1;
|
||||
const nextChapterIndexToRead = manga.firstUnreadChapter?.sourceOrder ?? 1;
|
||||
const isLatestChapterRead = manga.chapters.totalCount === manga.latestReadChapter?.sourceOrder;
|
||||
|
||||
const areAllChaptersRead = manga.unreadCount === 0;
|
||||
|
||||
@@ -351,6 +351,9 @@ export const FULL_MANGA_FIELDS = gql`
|
||||
latestUploadedChapter {
|
||||
...FULL_CHAPTER_FIELDS
|
||||
}
|
||||
firstUnreadChapter {
|
||||
...FULL_CHAPTER_FIELDS
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -113,6 +113,9 @@ export const UPDATE_CHAPTER = gql`
|
||||
latestReadChapter {
|
||||
id
|
||||
}
|
||||
firstUnreadChapter {
|
||||
id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -156,6 +159,9 @@ export const UPDATE_CHAPTERS = gql`
|
||||
latestReadChapter {
|
||||
id
|
||||
}
|
||||
firstUnreadChapter {
|
||||
id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user