Use first unread chapter for continue read buttons (#689)

This commit is contained in:
schroda
2024-04-01 00:57:47 +02:00
committed by GitHub
parent 9674b18d28
commit fe2cb682b6
5 changed files with 28 additions and 10 deletions

View File

@@ -94,7 +94,16 @@ export const MangaCard = (props: MangaCardProps) => {
const { t } = useTranslation(); const { t } = useTranslation();
const { manga, gridLayout, inLibraryIndicator, selected, handleSelection, mode = 'default' } = props; 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 thumbnailUrl = Mangas.getThumbnailUrl(manga);
const { const {
options: { showContinueReadingButton, showUnreadBadge, showDownloadBadge }, 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 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 isLatestChapterRead = chapters?.totalCount === latestReadChapter?.sourceOrder;
const [isMigrateDialogOpen, setIsMigrateDialogOpen] = useState(false); const [isMigrateDialogOpen, setIsMigrateDialogOpen] = useState(false);

View File

@@ -79,7 +79,7 @@ export const ChapterList: React.FC<IProps> = ({ manga, isRefreshing }) => {
const visibleChapters = useMemo(() => filterAndSortChapters(chapters, options), [chapters, options]); 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 isLatestChapterRead = manga.chapters.totalCount === manga.latestReadChapter?.sourceOrder;
const areAllChaptersRead = manga.unreadCount === 0; const areAllChaptersRead = manga.unreadCount === 0;

View File

@@ -351,6 +351,9 @@ export const FULL_MANGA_FIELDS = gql`
latestUploadedChapter { latestUploadedChapter {
...FULL_CHAPTER_FIELDS ...FULL_CHAPTER_FIELDS
} }
firstUnreadChapter {
...FULL_CHAPTER_FIELDS
}
} }
`; `;

File diff suppressed because one or more lines are too long

View File

@@ -113,6 +113,9 @@ export const UPDATE_CHAPTER = gql`
latestReadChapter { latestReadChapter {
id id
} }
firstUnreadChapter {
id
}
} }
} }
} }
@@ -156,6 +159,9 @@ export const UPDATE_CHAPTERS = gql`
latestReadChapter { latestReadChapter {
id id
} }
firstUnreadChapter {
id
}
} }
} }
} }