Remove unnecessary TFunction parameter
This commit is contained in:
@@ -8,8 +8,7 @@
|
|||||||
|
|
||||||
import { MutableRefObject, RefObject, useCallback, useEffect } from 'react';
|
import { MutableRefObject, RefObject, useCallback, useEffect } from 'react';
|
||||||
import { Direction, useTheme } from '@mui/material/styles';
|
import { Direction, useTheme } from '@mui/material/styles';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { t as translate } from 'i18next';
|
||||||
import { TFunction } from 'i18next';
|
|
||||||
import {
|
import {
|
||||||
getNextIndexFromPage,
|
getNextIndexFromPage,
|
||||||
getNextPageIndex,
|
getNextPageIndex,
|
||||||
@@ -164,10 +163,7 @@ export class ReaderControls {
|
|||||||
doTransitionCheck?: boolean,
|
doTransitionCheck?: boolean,
|
||||||
scrollIntoView?: boolean,
|
scrollIntoView?: boolean,
|
||||||
) => void {
|
) => void {
|
||||||
const { t } = useTranslation();
|
return useCallback((offset, doTransitionCheck = true, scrollIntoView = true) => {
|
||||||
|
|
||||||
return useCallback(
|
|
||||||
(offset, doTransitionCheck = true, scrollIntoView = true) => {
|
|
||||||
const {
|
const {
|
||||||
chapters: {
|
chapters: {
|
||||||
currentChapter,
|
currentChapter,
|
||||||
@@ -221,7 +217,6 @@ export class ReaderControls {
|
|||||||
try {
|
try {
|
||||||
if (doTransitionCheck) {
|
if (doTransitionCheck) {
|
||||||
await ReaderControls.checkNextChapterConsistency(
|
await ReaderControls.checkNextChapterConsistency(
|
||||||
t,
|
|
||||||
isPreviousChapter ? 'previous' : 'next',
|
isPreviousChapter ? 'previous' : 'next',
|
||||||
currentChapter,
|
currentChapter,
|
||||||
chapterToOpen,
|
chapterToOpen,
|
||||||
@@ -261,13 +256,10 @@ export class ReaderControls {
|
|||||||
};
|
};
|
||||||
|
|
||||||
doOpenChapter().catch(defaultPromiseErrorHandler('ReaderControls#useOpenChapter'));
|
doOpenChapter().catch(defaultPromiseErrorHandler('ReaderControls#useOpenChapter'));
|
||||||
},
|
}, []);
|
||||||
[t],
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async checkNextChapterConsistency(
|
private static async checkNextChapterConsistency(
|
||||||
t: TFunction,
|
|
||||||
offset: 'previous' | 'next',
|
offset: 'previous' | 'next',
|
||||||
currentChapter: TChapterReader | null | undefined,
|
currentChapter: TChapterReader | null | undefined,
|
||||||
chapterToOpen: TChapterReader | null | undefined,
|
chapterToOpen: TChapterReader | null | undefined,
|
||||||
@@ -301,13 +293,13 @@ export class ReaderControls {
|
|||||||
|
|
||||||
const sameScanlator = isSameScanlator
|
const sameScanlator = isSameScanlator
|
||||||
? ''
|
? ''
|
||||||
: t(offsetToTranslationKeys[offset].scanlator, {
|
: translate(offsetToTranslationKeys[offset].scanlator, {
|
||||||
nextScanlator: chapterToOpen.scanlator,
|
nextScanlator: chapterToOpen.scanlator,
|
||||||
currentScanlator: currentChapter.scanlator,
|
currentScanlator: currentChapter.scanlator,
|
||||||
});
|
});
|
||||||
const continuousChapter = isContinuousChapter
|
const continuousChapter = isContinuousChapter
|
||||||
? ''
|
? ''
|
||||||
: t(offsetToTranslationKeys[offset].chapter_number, {
|
: translate(offsetToTranslationKeys[offset].chapter_number, {
|
||||||
count: missingChapters,
|
count: missingChapters,
|
||||||
nextChapter: `#${chapterToOpen.chapterNumber} ${chapterToOpen.name}`,
|
nextChapter: `#${chapterToOpen.chapterNumber} ${chapterToOpen.name}`,
|
||||||
currentChapter: `#${currentChapter.chapterNumber} ${currentChapter.name}`,
|
currentChapter: `#${currentChapter.chapterNumber} ${currentChapter.name}`,
|
||||||
@@ -316,11 +308,11 @@ export class ReaderControls {
|
|||||||
const warning = `${sameScanlator}${warningLineBreak}${continuousChapter}`;
|
const warning = `${sameScanlator}${warningLineBreak}${continuousChapter}`;
|
||||||
|
|
||||||
await awaitConfirmation({
|
await awaitConfirmation({
|
||||||
title: t('reader.chapter_transition.warning.title'),
|
title: translate('reader.chapter_transition.warning.title'),
|
||||||
message: warning,
|
message: warning,
|
||||||
actions: {
|
actions: {
|
||||||
confirm: {
|
confirm: {
|
||||||
title: t('global.button.open'),
|
title: translate('global.button.open'),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user