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