Show continue read button only when chapters are available

Manga can be added to the library while they have not been initialized yet.
Thus, for these cases, the reader is broken in case it gets opened.
To prevent this, the continue read button should not be shown in the library
This commit is contained in:
schroda
2024-07-26 13:39:43 +02:00
parent bb8b9096ee
commit 3fa96dfb8d
2 changed files with 5 additions and 3 deletions

View File

@@ -107,7 +107,9 @@ export const MangaCard = (props: MangaCardProps) => {
const continueReadingButton = useMemo(
() => (
<ContinueReadingButton
showContinueReadingButton={showContinueReadingButton && mode === 'default'}
showContinueReadingButton={
showContinueReadingButton && mode === 'default' && !!manga.chapters?.totalCount
}
isLatestChapterRead={isLatestChapterRead}
nextChapterIndexToRead={nextChapterIndexToRead}
mangaLinkTo={mangaLinkTo}

View File

@@ -18,9 +18,9 @@ import { SingleModeProps } from '@/components/manga/MangaActionMenuItems.tsx';
export type MangaCardMode = 'default' | 'source' | 'migrate.search' | 'migrate.select' | 'duplicate';
type MangaCardBaseProps = Pick<MangaType, 'id' | 'title' | 'sourceId'> &
SingleModeProps['manga'] &
Omit<SingleModeProps['manga'], 'downloadCount' | 'unreadCount' | 'chapters'> &
Partial<Pick<MangaType, 'inLibrary' | 'downloadCount' | 'unreadCount'>> &
MangaChapterCountInfo & {
Partial<MangaChapterCountInfo> & {
latestReadChapter?: Pick<ChapterType, 'id' | 'sourceOrder'> | null;
firstUnreadChapter?: Pick<ChapterType, 'id' | 'sourceOrder'> | null;
};