Cleanup reader store slices hooks
This commit is contained in:
@@ -69,15 +69,15 @@ const BaseReaderNavBarDesktop = ({
|
||||
previousChapter,
|
||||
nextChapter,
|
||||
} = useReaderChaptersStore((state) => ({
|
||||
chapters: state.chapters.chapters,
|
||||
currentChapterId: state.chapters.currentChapter?.id,
|
||||
currentChapterName: state.chapters.currentChapter?.name,
|
||||
currentChapterNumber: state.chapters.currentChapter?.chapterNumber,
|
||||
currentChapterScanlator: state.chapters.currentChapter?.scanlator,
|
||||
previousChapter: state.chapters.previousChapter,
|
||||
nextChapter: state.chapters.nextChapter,
|
||||
chapters: state.chapters,
|
||||
currentChapterId: state.currentChapter?.id,
|
||||
currentChapterName: state.currentChapter?.name,
|
||||
currentChapterNumber: state.currentChapter?.chapterNumber,
|
||||
currentChapterScanlator: state.currentChapter?.scanlator,
|
||||
previousChapter: state.previousChapter,
|
||||
nextChapter: state.nextChapter,
|
||||
}));
|
||||
const isStaticNav = useReaderSettingsStore((state) => state.settings.isStaticNav);
|
||||
const isStaticNav = useReaderSettingsStore((state) => state.isStaticNav);
|
||||
|
||||
const [navBarElement, setNavBarElement] = useState<HTMLDivElement | null>();
|
||||
useResizeObserver(
|
||||
|
||||
@@ -65,14 +65,14 @@ const DownloadButton = ({ id = -1, isDownloaded }: ChapterIdInfo & ChapterDownlo
|
||||
|
||||
export const ReaderNavBarDesktopActions = memo(() => {
|
||||
const { id, isDownloaded, isBookmarked, realUrl } = useReaderChaptersStore((state) => ({
|
||||
id: state.chapters.currentChapter?.id ?? FALLBACK_CHAPTER.id,
|
||||
isDownloaded: state.chapters.currentChapter?.isDownloaded ?? FALLBACK_CHAPTER.isDownloaded,
|
||||
isBookmarked: state.chapters.currentChapter?.isBookmarked ?? FALLBACK_CHAPTER.isBookmarked,
|
||||
realUrl: state.chapters.currentChapter?.realUrl ?? FALLBACK_CHAPTER.realUrl,
|
||||
id: state.currentChapter?.id ?? FALLBACK_CHAPTER.id,
|
||||
isDownloaded: state.currentChapter?.isDownloaded ?? FALLBACK_CHAPTER.isDownloaded,
|
||||
isBookmarked: state.currentChapter?.isBookmarked ?? FALLBACK_CHAPTER.isBookmarked,
|
||||
realUrl: state.currentChapter?.realUrl ?? FALLBACK_CHAPTER.realUrl,
|
||||
}));
|
||||
|
||||
const { t } = useLingui();
|
||||
const pageLoadStates = useReaderPagesStore((state) => state.pages.pageLoadStates);
|
||||
const pageLoadStates = useReaderPagesStore((state) => state.pageLoadStates);
|
||||
|
||||
const pageRetryKeyPrefix = useRef<number>(0);
|
||||
|
||||
|
||||
@@ -24,10 +24,10 @@ const BaseReaderNavBarDesktopPageNavigation = () => {
|
||||
const { t } = useLingui();
|
||||
const getOptionForDirection = useGetOptionForDirection();
|
||||
const { currentPageIndex, pages } = useReaderPagesStore((state) => ({
|
||||
currentPageIndex: state.pages.currentPageIndex,
|
||||
pages: state.pages.pages,
|
||||
currentPageIndex: state.currentPageIndex,
|
||||
pages: state.pages,
|
||||
}));
|
||||
const readingDirection = useReaderSettingsStore((state) => state.settings.readingDirection.value);
|
||||
const readingDirection = useReaderSettingsStore((state) => state.readingDirection.value);
|
||||
|
||||
const currentPage = useMemo(() => getPage(currentPageIndex, pages), [currentPageIndex, pages]);
|
||||
const direction = READING_DIRECTION_TO_THEME_DIRECTION[readingDirection];
|
||||
|
||||
@@ -24,12 +24,12 @@ const BaseReaderNavBarDesktopQuickSettings = ({ openSettings }: Pick<ReaderNavBa
|
||||
const { t } = useLingui();
|
||||
const { readingMode, shouldOffsetDoubleSpreads, pageScaleMode, shouldStretchPage, readingDirection, autoScroll } =
|
||||
useReaderSettingsStore((state) => ({
|
||||
readingMode: state.settings.readingMode,
|
||||
shouldOffsetDoubleSpreads: state.settings.shouldOffsetDoubleSpreads,
|
||||
pageScaleMode: state.settings.pageScaleMode,
|
||||
shouldStretchPage: state.settings.shouldStretchPage,
|
||||
readingDirection: state.settings.readingDirection,
|
||||
autoScroll: state.settings.autoScroll,
|
||||
readingMode: state.readingMode,
|
||||
shouldOffsetDoubleSpreads: state.shouldOffsetDoubleSpreads,
|
||||
pageScaleMode: state.pageScaleMode,
|
||||
shouldStretchPage: state.shouldStretchPage,
|
||||
readingDirection: state.readingDirection,
|
||||
autoScroll: state.autoScroll,
|
||||
}));
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user