Files
suwayomi-material-you-webui/src/screens/Reader.tsx
T

580 lines
21 KiB
TypeScript
Raw Normal View History

/*
* Copyright (C) Contributors to the Suwayomi project
*
* This Source Code Form is subject to the terms of the Mozilla Public
2021-01-26 23:32:12 +03:30
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
2021-01-26 23:32:12 +03:30
2021-09-09 17:51:22 +04:30
import CircularProgress from '@mui/material/CircularProgress';
2023-09-30 16:55:35 +02:00
import { useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';
import { useLocation, useNavigate, useParams } from 'react-router-dom';
2024-04-14 15:50:12 +02:00
import Box from '@mui/material/Box';
2023-06-05 01:42:39 +02:00
import { useTranslation } from 'react-i18next';
2024-07-08 18:02:50 +02:00
import { AllowedMetadataValueTypes, ChapterOffset, IReaderSettings, ReaderType } from '@/typings';
2023-10-28 00:32:02 +02:00
import { requestManager } from '@/lib/requests/RequestManager.ts';
import {
checkAndHandleMissingStoredReaderSettings,
getReaderSettingsFor,
useDefaultReaderSettings,
} from '@/lib/metadata/readerSettings.ts';
import { requestUpdateMangaMetadata } from '@/lib/metadata/metadata.ts';
2023-10-28 00:32:02 +02:00
import { HorizontalPager } from '@/components/reader/pager/HorizontalPager';
import { PageNumber } from '@/components/reader/PageNumber';
import { PagedPager } from '@/components/reader/pager/PagedPager';
import { DoublePagedPager } from '@/components/reader/pager/DoublePagedPager';
import { VerticalPager } from '@/components/reader/pager/VerticalPager';
import { ReaderNavBar } from '@/components/navbar/ReaderNavBar';
import { makeToast } from '@/components/util/Toast';
import { NavBarContext } from '@/components/context/NavbarContext.tsx';
2023-12-30 14:30:04 +01:00
import { useDebounce } from '@/util/useDebounce.ts';
2024-07-02 16:20:28 +02:00
import {
GetChaptersReaderQuery,
GetChaptersReaderQueryVariables,
2024-07-08 18:02:50 +02:00
GetMangaReaderQuery,
2024-07-02 16:20:28 +02:00
UpdateChapterPatchInput,
} from '@/lib/graphql/generated/graphql.ts';
import { useMetadataServerSettings } from '@/lib/metadata/metadataServerSettings.ts';
import { defaultPromiseErrorHandler } from '@/util/defaultPromiseErrorHandler.ts';
import { ChapterIdInfo, Chapters } from '@/lib/data/Chapters.ts';
2024-04-29 15:29:33 +02:00
import { EmptyViewAbsoluteCentered } from '@/components/util/EmptyViewAbsoluteCentered.tsx';
2024-07-02 16:20:28 +02:00
import { GET_CHAPTERS_READER } from '@/lib/graphql/queries/ChapterQuery.ts';
2024-07-08 18:02:50 +02:00
import { GET_MANGA_READER } from '@/lib/graphql/queries/MangaQuery.ts';
import { TMangaReader } from '@/lib/data/Mangas.ts';
import { CHAPTER_READER_FIELDS } from '@/lib/graphql/fragments/ChapterFragments.ts';
2024-07-02 16:20:28 +02:00
type TChapter = GetChaptersReaderQuery['chapters']['nodes'][number];
const getChapterFromCache = (id: ChapterIdInfo['id']): TChapter | null =>
Chapters.getFromCache<TChapter>(id, CHAPTER_READER_FIELDS, 'CHAPTER_READER_FIELDS')!;
2021-05-15 23:22:37 +04:30
const getReaderComponent = (readerType: ReaderType) => {
switch (readerType) {
case 'ContinuesVertical':
case 'Webtoon':
2021-05-17 01:38:59 +04:30
return VerticalPager;
2021-05-15 23:22:37 +04:30
break;
case 'SingleVertical':
case 'SingleRTL':
case 'SingleLTR':
2021-05-28 05:36:55 -07:00
return PagedPager;
break;
case 'DoubleVertical':
case 'DoubleRTL':
case 'DoubleLTR':
return DoublePagedPager;
2021-05-15 23:22:37 +04:30
break;
2021-05-29 08:11:59 -07:00
case 'ContinuesHorizontalLTR':
case 'ContinuesHorizontalRTL':
2021-05-17 01:38:59 +04:30
return HorizontalPager;
2021-05-15 23:22:37 +04:30
default:
2021-05-17 01:38:59 +04:30
return VerticalPager;
2021-05-15 23:22:37 +04:30
break;
}
};
2023-02-06 10:06:33 +01:00
const range = (n: number) => Array.from({ length: n }, (value, key) => key);
const fallbackChapter = {
2021-12-01 03:03:52 +03:30
pageCount: -1,
2023-09-30 16:55:35 +02:00
sourceOrder: -1,
2021-12-01 03:03:52 +03:30
chapterCount: 0,
2022-11-24 21:05:05 +01:00
lastPageRead: 0,
2021-12-01 03:03:52 +03:30
name: 'Loading...',
manga: { id: -1 },
2023-10-15 16:03:08 +02:00
} as unknown as TChapter;
2021-01-22 17:00:33 +03:30
2023-10-28 00:32:02 +02:00
export function Reader() {
2023-03-23 13:59:32 +01:00
const { t } = useTranslation();
const navigate = useNavigate();
const location = useLocation();
2021-03-09 16:44:09 +03:30
2023-02-06 10:06:33 +01:00
const { chapterIndex, mangaId } = useParams<{ chapterIndex: string; mangaId: string }>();
2023-09-08 00:44:01 +02:00
const fallbackManga = useMemo(
2023-09-08 00:44:01 +02:00
() =>
({
id: +mangaId,
title: '',
thumbnailUrl: '',
genre: [],
inLibraryAt: 0,
lastReadAt: 0,
2023-09-30 16:55:35 +02:00
chapters: { totalCount: 0 },
2024-04-30 20:16:23 +02:00
trackRecords: { totalCount: 0 },
2024-07-08 18:02:50 +02:00
}) as unknown as TMangaReader,
2023-09-08 00:44:01 +02:00
[mangaId],
);
const {
data,
loading: isMangaLoading,
error: mangaError,
refetch: refetchManga,
2024-07-08 18:02:50 +02:00
} = requestManager.useGetManga<GetMangaReaderQuery>(GET_MANGA_READER, mangaId);
2023-10-15 16:03:08 +02:00
const loadedChapter = useRef<TChapter | null>(null);
2023-09-30 16:55:35 +02:00
const isChapterLoaded =
2024-07-02 16:20:28 +02:00
Number(mangaId) === loadedChapter.current?.mangaId &&
2023-09-30 16:55:35 +02:00
Number(chapterIndex) === loadedChapter.current?.sourceOrder &&
loadedChapter.current?.pageCount !== -1;
const manga = data?.manga ?? fallbackManga;
2024-04-27 22:28:55 +02:00
const {
2024-07-02 16:20:28 +02:00
data: chaptersData,
2024-04-27 22:28:55 +02:00
loading: isChapterLoading,
error: chapterError,
refetch: fetchChapter,
2024-07-02 16:20:28 +02:00
} = requestManager.useGetChapters<GetChaptersReaderQuery, GetChaptersReaderQueryVariables>(
GET_CHAPTERS_READER,
{
condition: { mangaId: Number(mangaId), sourceOrder: Number(chapterIndex) },
},
{
notifyOnNetworkStatusChange: true,
},
);
const chapterData = chaptersData?.chapters.nodes[0];
const arePagesUpdatedRef = useRef(false);
2023-09-30 16:55:35 +02:00
const {
settings: { downloadAheadLimit },
} = useMetadataServerSettings();
const isDownloadAheadEnabled = !!downloadAheadLimit;
2023-11-19 21:17:35 +01:00
2023-09-30 16:55:35 +02:00
const getLoadedChapter = () => {
const isAChapterLoaded = loadedChapter.current;
const isSameAsLoadedChapter = isAChapterLoaded && isChapterLoaded;
if (isSameAsLoadedChapter) {
2024-07-02 16:20:28 +02:00
const didPageCountChange = chapterData && loadedChapter.current?.pageCount !== chapterData.pageCount;
return didPageCountChange ? chapterData! : loadedChapter.current;
2023-09-30 16:55:35 +02:00
}
arePagesUpdatedRef.current = false;
2024-07-02 16:20:28 +02:00
if (chapterData) {
return chapterData;
2023-09-30 16:55:35 +02:00
}
return null;
};
loadedChapter.current = getLoadedChapter();
const chapter = loadedChapter.current ?? fallbackChapter;
const initialChapterRef = useRef<TChapter>(fallbackChapter);
if (initialChapterRef.current === fallbackChapter) {
initialChapterRef.current = chapter;
}
2024-07-02 16:20:28 +02:00
if (chapter.mangaId !== initialChapterRef.current?.mangaId) {
initialChapterRef.current = fallbackChapter;
}
2024-04-27 22:28:55 +02:00
const [fetchPages, { loading: arePagesLoading, error: pagesError }] = requestManager.useGetChapterPagesFetch(
chapter.id,
);
2023-09-30 16:55:35 +02:00
2024-04-27 22:28:55 +02:00
const doFetchPages = () => {
const shouldFetchPages = !isChapterLoading && !chapter.isDownloaded;
if (shouldFetchPages) {
2024-04-27 22:28:55 +02:00
fetchPages()
.then(() => {
arePagesUpdatedRef.current = true;
})
.catch(defaultPromiseErrorHandler('Reader::fetchPages'));
} else {
arePagesUpdatedRef.current = true;
2023-09-30 16:55:35 +02:00
}
2024-04-27 22:28:55 +02:00
};
useEffect(() => {
doFetchPages();
2023-09-30 16:55:35 +02:00
}, [chapter.id]);
const [wasLastPageReadSet, setWasLastPageReadSet] = useState(false);
2021-03-19 14:52:20 +03:30
const [curPage, setCurPage] = useState<number>(0);
2023-11-11 23:53:12 +01:00
const isLastPage = curPage === chapter.pageCount - 1;
const curPageDebounced = useDebounce(curPage, isLastPage ? 0 : 1000);
2023-02-12 16:12:17 +01:00
const [pageToScrollTo, setPageToScrollTo] = useState<number | undefined>(undefined);
2024-07-13 15:43:16 +02:00
const { setOverride, setTitle, navBarWidth: currentNavBarWidth } = useContext(NavBarContext);
const [retrievingNextChapter, setRetrievingNextChapter] = useState(false);
const {
data: mangaChaptersData,
loading: areChaptersLoading,
error: chaptersError,
refetch: refetchChapters,
2024-07-02 16:20:28 +02:00
} = requestManager.useGetMangaChapters<GetChaptersReaderQuery, GetChaptersReaderQueryVariables>(
GET_CHAPTERS_READER,
mangaId,
{ nextFetchPolicy: 'standby' },
);
const mangaChapters = mangaChaptersData?.chapters.nodes;
const isLoading =
isMangaLoading ||
isChapterLoading ||
areChaptersLoading ||
arePagesLoading ||
(!arePagesUpdatedRef.current && !chapterError && !pagesError);
const error = mangaError ?? chapterError ?? chaptersError ?? pagesError;
2023-02-08 18:19:26 +01:00
const { settings: defaultSettings, loading: areDefaultSettingsLoading } = useDefaultReaderSettings();
const [settings, setSettings] = useState(getReaderSettingsFor(manga, defaultSettings));
2021-05-17 01:38:59 +04:30
2023-11-19 21:17:35 +01:00
const { settings: metadataSettings } = useMetadataServerSettings();
2024-05-13 03:40:45 +02:00
const uniqueChapters = useMemo(
() =>
settings.skipDupChapters
? Chapters.removeDuplicates(initialChapterRef.current, mangaChapters ?? [])
: mangaChapters ?? [],
[initialChapterRef.current, mangaChapters, settings.skipDupChapters],
2024-05-13 03:40:45 +02:00
);
const prevChapters = useMemo(
() =>
Chapters.getNextChapters(chapter, mangaChapters ?? [], {
offset: ChapterOffset.PREV,
skipDupe: settings.skipDupChapters,
skipDupeChapter: initialChapterRef.current,
}),
[chapter, initialChapterRef.current, mangaChapters, settings.skipDupChapters],
);
const nextChapters = useMemo(
() =>
Chapters.getNextChapters(chapter, mangaChapters ?? [], {
skipDupe: settings.skipDupChapters,
skipDupeChapter: initialChapterRef.current,
}),
[chapter, initialChapterRef.current, mangaChapters, settings.skipDupChapters],
);
const prevChapter = useMemo(
() =>
Chapters.getNextChapter(chapter, mangaChapters ?? [], {
offset: ChapterOffset.PREV,
skipDupe: settings.skipDupChapters,
skipDupeChapter: initialChapterRef.current,
}),
[chapter, initialChapterRef.current, mangaChapters, settings.skipDupChapters],
);
const nextChapter = useMemo(
() =>
Chapters.getNextChapter(chapter, mangaChapters ?? [], {
skipDupe: settings.skipDupChapters,
skipDupeChapter: initialChapterRef.current,
}),
[chapter, initialChapterRef.current, mangaChapters, settings.skipDupChapters],
);
2023-11-19 21:17:35 +01:00
const updateChapter = (patch: UpdateChapterPatchInput) => {
if (chapter === fallbackChapter) {
return;
}
2024-04-23 18:08:34 +02:00
const getChapterIdsToDelete = () => {
const isAutoDeletionEnabled = !!patch.isRead && !!metadataSettings.deleteChaptersWhileReading;
if (!isAutoDeletionEnabled || !mangaChapters) {
2024-04-23 18:08:34 +02:00
return [];
}
const chapterToDelete = [chapter, ...prevChapters][metadataSettings.deleteChaptersWhileReading - 1];
if (!chapterToDelete) {
2024-04-23 18:08:34 +02:00
return [];
}
// chapter has to exist in the cache since the reader fetches all chapters of the manga
const chapterToDeleteUpToDateData = getChapterFromCache(chapterToDelete.id)!;
const shouldDeleteChapter =
chapterToDeleteUpToDateData.isRead &&
Chapters.isDeletable(chapterToDeleteUpToDateData, metadataSettings.deleteChaptersWithBookmark);
if (!shouldDeleteChapter) {
2024-04-23 18:08:34 +02:00
return [];
}
2024-04-23 18:08:34 +02:00
if (!settings.skipDupChapters) {
return Chapters.getIds([chapterToDelete]);
}
return Chapters.getIds(Chapters.addDuplicates([chapterToDelete], mangaChapters));
};
2023-11-19 21:17:35 +01:00
const downloadAhead = () => {
const currentChapter = getChapterFromCache(chapter.id);
const inDownloadRange = (patch.lastPageRead ?? 0) / chapter.pageCount > 0.25;
const shouldCheckDownloadAhead =
2024-07-02 16:20:28 +02:00
isDownloadAheadEnabled && manga.inLibrary && !!currentChapter?.isDownloaded && inDownloadRange;
if (shouldCheckDownloadAhead) {
const nextChapterUpToDate = nextChapter ? getChapterFromCache(nextChapter.id) : null;
if (!nextChapterUpToDate?.isDownloaded) {
return;
}
const nextChaptersUpToDate = Chapters.getNonRead(nextChapters).map(
// the chapters have to be in the cache since the reader fetches the whole chapter list of the manga
(mangaChapter) => getChapterFromCache(mangaChapter.id)!,
);
const chapterIdsToDownload = nextChaptersUpToDate
// "settingsData" can't be undefined since this would not get executed otherwise
.slice(-downloadAheadLimit)
.filter((mangaChapter) => !mangaChapter.isDownloaded)
.map((mangaChapter) => mangaChapter.id)
.filter((id) => !Chapters.isDownloading(id));
if (!chapterIdsToDownload.length) {
return;
}
2024-04-23 18:08:34 +02:00
Chapters.download(chapterIdsToDownload).catch(
defaultPromiseErrorHandler('Reader::updateChapter: shouldDownloadAhead'),
);
}
};
downloadAhead();
2024-04-27 02:17:53 +02:00
const chapterIds = settings.skipDupChapters
? Chapters.getIds(Chapters.addDuplicates([chapter], mangaChapters ?? [chapter]))
: [chapter.id];
requestManager
.updateChapters(
chapterIds,
{
...patch,
chapterIdsToDelete: getChapterIdsToDelete(),
trackProgressMangaId:
metadataSettings.updateProgressAfterReading && patch.isRead && manga.trackRecords.totalCount
? manga.id
: undefined,
},
{ errorPolicy: 'all' },
)
.response.catch(defaultPromiseErrorHandler('Reader::updateChapter'));
2023-11-19 21:17:35 +01:00
};
const setSettingValue = (key: keyof IReaderSettings, value: AllowedMetadataValueTypes, persist: boolean = true) => {
setSettings({ ...settings, [key]: value });
if (persist) {
requestUpdateMangaMetadata(manga, [[key, value]]).catch(() =>
makeToast(t('reader.settings.error.label.failed_to_save_settings'), 'warning'),
);
}
};
const openNextChapter = useCallback(
(offset: ChapterOffset) => {
const isOpenNextChapter = offset === ChapterOffset.NEXT;
const chapterToOpen = isOpenNextChapter ? nextChapter : prevChapter;
if (!chapterToOpen) {
makeToast(
t(
isOpenNextChapter
? 'reader.error.label.next_chapter_does_not_exist'
: 'reader.error.label.prev_chapter_does_not_exist',
),
'error',
);
return;
}
setRetrievingNextChapter(true);
setCurPage(0);
navigate(`/manga/${manga.id}/chapter/${chapterToOpen.sourceOrder}`, {
replace: true,
state: location.state,
});
setRetrievingNextChapter(false);
},
[manga.id, prevChapter?.id, nextChapter?.id],
);
2023-05-18 13:25:19 +02:00
useEffect(() => {
2023-09-30 16:55:35 +02:00
if (isLoading || !chapter) {
setCurPage(0);
2023-05-18 13:25:19 +02:00
return;
}
setWasLastPageReadSet(true);
2023-05-18 13:25:19 +02:00
if (chapter.lastPageRead === chapter.pageCount - 1) {
// last page, also probably read = true, we will load the first page.
setCurPage(0);
} else setCurPage(chapter.lastPageRead);
2023-09-30 16:55:35 +02:00
}, [chapter, isLoading]);
2023-05-18 13:25:19 +02:00
2023-01-07 16:44:00 +01:00
useEffect(() => {
2023-09-30 16:55:35 +02:00
if (!manga?.title || chapter.name === t('global.label.loading')) {
2023-03-23 13:59:32 +01:00
setTitle(t('reader.title'));
2023-01-07 16:44:00 +01:00
} else {
2023-09-30 16:55:35 +02:00
setTitle(`${manga.title}: ${chapter.name}`);
2023-01-07 16:44:00 +01:00
}
}, [t, manga, chapter]);
2023-01-07 16:44:00 +01:00
useEffect(() => {
if (!areDefaultSettingsLoading && !isMangaLoading) {
checkAndHandleMissingStoredReaderSettings(manga, 'manga', defaultSettings).catch(
defaultPromiseErrorHandler('Reader::checkAndHandleMissingStoredReaderSettings'),
);
setSettings(getReaderSettingsFor(manga, defaultSettings));
}
}, [areDefaultSettingsLoading, isMangaLoading]);
useEffect(() => {
2021-05-17 01:38:59 +04:30
// set the custom navbar
2023-02-06 10:06:33 +01:00
setOverride({
status: true,
value: (
<ReaderNavBar
settings={settings}
setSettingValue={setSettingValue}
manga={manga}
2023-09-30 16:55:35 +02:00
chapter={chapter}
2024-05-13 03:40:45 +02:00
chapters={uniqueChapters}
2023-02-06 10:06:33 +01:00
curPage={curPage}
2023-02-12 16:12:17 +01:00
scrollToPage={setPageToScrollTo}
openNextChapter={openNextChapter}
retrievingNextChapter={retrievingNextChapter}
2023-02-06 10:06:33 +01:00
/>
),
});
2021-03-18 21:46:24 +03:30
// clean up for when we leave the reader
return () => setOverride({ status: false, value: <div /> });
2024-05-13 03:40:45 +02:00
}, [manga, chapter, settings, curPage, chapterIndex, retrievingNextChapter, openNextChapter, uniqueChapters]);
2021-03-18 21:46:24 +03:30
2021-05-18 02:26:45 +04:30
useEffect(() => {
if (!wasLastPageReadSet) {
return;
}
if (chapter === fallbackChapter) {
return;
}
const chapterUpToDate = getChapterFromCache(chapter.id);
if (curPageDebounced === chapterUpToDate?.lastPageRead) {
return;
}
// do not mutate the chapter, this will cause the page to jump around due to always scrolling to the last read page
2023-11-11 23:53:12 +01:00
const updateLastPageRead = curPageDebounced !== -1;
const updateIsRead = curPageDebounced === chapter.pageCount - 1;
2023-11-19 21:17:35 +01:00
const shouldUpdateChapter = updateLastPageRead || updateIsRead;
if (!shouldUpdateChapter) {
return;
2021-05-18 02:26:45 +04:30
}
2023-11-19 21:17:35 +01:00
updateChapter({
lastPageRead: updateLastPageRead ? curPageDebounced : undefined,
isRead: updateIsRead ? true : undefined,
});
}, [curPageDebounced, isDownloadAheadEnabled]);
2021-05-18 02:26:45 +04:30
const loadNextChapter = useCallback(() => {
2023-11-19 21:17:35 +01:00
updateChapter({
lastPageRead: chapter.pageCount - 1,
isRead: true,
});
openNextChapter(ChapterOffset.NEXT);
2024-04-30 20:16:23 +02:00
}, [chapter.pageCount, openNextChapter, chapter, manga]);
2022-11-24 21:05:05 +01:00
const loadPrevChapter = useCallback(() => {
openNextChapter(ChapterOffset.PREV);
}, [openNextChapter]);
2022-11-24 21:05:05 +01:00
if (isLoading) {
2021-02-04 03:42:30 +03:30
return (
2023-02-06 10:06:33 +01:00
<Box
sx={{
height: '100vh',
width: '100vw',
display: 'grid',
placeItems: 'center',
}}
2021-12-04 10:29:36 +03:30
>
2021-03-18 21:46:24 +03:30
<CircularProgress thickness={5} />
2021-12-04 10:29:36 +03:30
</Box>
2021-02-04 03:42:30 +03:30
);
2021-01-20 01:05:24 +03:30
}
2021-05-15 17:18:57 +04:30
2024-04-27 22:28:55 +02:00
if (error) {
return (
2024-04-29 15:29:33 +02:00
<EmptyViewAbsoluteCentered
2024-04-27 22:28:55 +02:00
message={t('global.error.label.failed_to_load_data')}
messageExtra={error.message}
retry={() => {
if (mangaError) {
refetchManga().catch(defaultPromiseErrorHandler('Reader::refetchManga'));
}
2024-04-27 22:28:55 +02:00
if (chapterError) {
fetchChapter().catch(defaultPromiseErrorHandler('Reader::refetchChapter'));
}
if (chaptersError) {
refetchChapters().catch(defaultPromiseErrorHandler('Reader::refetchChapters'));
}
2024-04-27 22:28:55 +02:00
if (pagesError) {
doFetchPages();
}
}}
/>
);
}
2024-06-27 15:09:13 +02:00
if (!chapter.pageCount) {
return <EmptyViewAbsoluteCentered message={t('reader.error.label.no_pages_found')} retry={doFetchPages} />;
}
2021-05-15 17:18:57 +04:30
const pages = range(chapter.pageCount).map((index) => ({
index,
2023-05-18 13:25:19 +02:00
src: requestManager.getChapterPageUrl(mangaId, chapterIndex, index),
2021-05-15 17:18:57 +04:30
}));
2021-05-15 23:22:37 +04:30
const ReaderComponent = getReaderComponent(settings.readerType);
2023-02-12 16:12:17 +01:00
// last page, also probably read = true, we will load the first page.
const initialPage = pageToScrollTo ?? (chapter.lastPageRead === chapter.pageCount - 1 ? 0 : chapter.lastPageRead);
2024-07-13 15:43:16 +02:00
const navBarWidth = settings.staticNav ? currentNavBarWidth : 0;
2021-01-20 01:05:24 +03:30
return (
2023-02-12 16:12:17 +01:00
<Box
sx={{
2024-01-26 11:51:08 -08:00
display: 'flex',
flexDirection: 'column',
alignContent: 'center',
2024-02-21 23:39:12 +01:00
alignItems: 'center',
2024-01-26 11:51:08 -08:00
justifyContent: 'center',
2024-07-13 15:43:16 +02:00
minWidth: `calc((100vw - (100vw - 100%)) - ${navBarWidth}px)`, // 100vw = width excluding scrollbar; 100% = width including scrollbar
2024-01-26 11:51:08 -08:00
minHeight: '100vh',
2024-07-13 15:43:16 +02:00
marginLeft: `${navBarWidth}px`,
2023-02-12 16:12:17 +01:00
}}
>
2023-02-06 10:06:33 +01:00
<PageNumber settings={settings} curPage={curPage} pageCount={chapter.pageCount} />
<Box sx={{ alignSelf: 'stretch' }}>
<ReaderComponent
key={chapter.id}
pages={pages}
pageCount={chapter.pageCount}
setCurPage={setCurPage}
initialPage={initialPage}
curPage={curPage}
settings={settings}
manga={manga}
chapter={chapter}
nextChapter={loadNextChapter}
prevChapter={loadPrevChapter}
/>
</Box>
2021-12-04 10:29:36 +03:30
</Box>
2021-01-20 01:05:24 +03:30
);
}