Always use "secondary page index" as "current page index" when available

There was an issue where one had to click twice at the end of a chapter in the "double page mode" to get to the chapter transition page.
This was caused due to setting the "primary page index" as the "current page index" and thus, when opening the next page, it got changed to the "secondary page index". However, this page was already visible and therefore, there was no visual change.
This commit is contained in:
schroda
2024-12-12 13:21:29 +01:00
parent 89b81de830
commit 9a8655db2f
4 changed files with 33 additions and 26 deletions

View File

@@ -13,7 +13,7 @@ import { useMemo } from 'react';
import FormControl from '@mui/material/FormControl';
import InputLabel from '@mui/material/InputLabel';
import { Select } from '@/modules/core/components/inputs/Select.tsx';
import { getPage } from '@/modules/reader/utils/ReaderProgressBar.utils.tsx';
import { getNextIndexFromPage, getPage } from '@/modules/reader/utils/ReaderProgressBar.utils.tsx';
import { ReaderStatePages } from '@/modules/reader/types/ReaderProgressBar.types.ts';
import { ReaderControls } from '@/modules/reader/services/ReaderControls.ts';
import { useGetOptionForDirection } from '@/modules/theme/services/ThemeCreator.ts';
@@ -50,7 +50,7 @@ export const ReaderNavBarDesktopPageNavigation = ({
<Select
labelId="reader-nav-bar-desktop-page-select"
label={t('reader.page_info.label.page')}
value={currentPage.primary.index}
value={getNextIndexFromPage(currentPage)}
onChange={(e) => openPage(e.target.value as number)}
>
{pages.map(({ primary: { index }, name }) => (