Introduce "koration" duration api
This commit is contained in:
@@ -14,6 +14,7 @@ import Stack from '@mui/material/Stack';
|
||||
import TextField from '@mui/material/TextField';
|
||||
import InputAdornment from '@mui/material/InputAdornment';
|
||||
import { useRef } from 'react';
|
||||
import { d } from 'koration';
|
||||
import { IReaderSettings } from '@/features/reader/Reader.types.ts';
|
||||
import { AUTO_SCROLL_SPEED } from '@/features/reader/settings/ReaderSettings.constants.tsx';
|
||||
import { coerceIn } from '@/lib/HelperFunctions.ts';
|
||||
@@ -62,7 +63,10 @@ export const ReaderNavBarDesktopAutoScroll = ({
|
||||
setAutoScroll({ ...autoScroll, value }, false);
|
||||
|
||||
clearTimeout(updateTimeout.current);
|
||||
updateTimeout.current = setTimeout(() => setAutoScroll({ ...autoScroll, value }, true), 1000);
|
||||
updateTimeout.current = setTimeout(
|
||||
() => setAutoScroll({ ...autoScroll, value }, true),
|
||||
d(1).seconds.inWholeMilliseconds,
|
||||
);
|
||||
}}
|
||||
slotProps={{
|
||||
input: {
|
||||
|
||||
@@ -8,13 +8,14 @@
|
||||
|
||||
import { useEffect, useRef } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { d } from 'koration';
|
||||
import { IReaderSettings, IReaderSettingsWithDefaultFlag } from '@/features/reader/Reader.types.ts';
|
||||
import { makeToast } from '@/base/utils/Toast.ts';
|
||||
import { READING_MODE_VALUE_TO_DISPLAY_DATA } from '@/features/reader/settings/ReaderSettings.constants.tsx';
|
||||
import { TReaderTapZoneContext } from '@/features/reader/tap-zones/TapZoneLayout.types.ts';
|
||||
import { TranslationKey } from '@/base/Base.types.ts';
|
||||
|
||||
const HIDE_PREVIEW_TIMEOUT = 5000;
|
||||
const HIDE_PREVIEW_TIMEOUT = d(5).seconds.inWholeMilliseconds;
|
||||
|
||||
export const useReaderShowSettingPreviewOnChange = (
|
||||
isLoading: boolean,
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
import { MutableRefObject, RefObject, useCallback, useEffect } from 'react';
|
||||
import { Direction } from '@mui/material/styles';
|
||||
import { t as translate } from 'i18next';
|
||||
import { d } from 'koration';
|
||||
import {
|
||||
getNextIndexFromPage,
|
||||
getNextPageIndex,
|
||||
@@ -473,7 +474,10 @@ export class ReaderControls {
|
||||
|
||||
clearTimeout(ReaderControls.updateCurrentPageTimeout);
|
||||
if (debounceChapterUpdate) {
|
||||
ReaderControls.updateCurrentPageTimeout = setTimeout(handleCurrentPageIndexChange, 1000);
|
||||
ReaderControls.updateCurrentPageTimeout = setTimeout(
|
||||
handleCurrentPageIndexChange,
|
||||
d(1).seconds.inWholeMilliseconds,
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
*/
|
||||
|
||||
import { MutableRefObject, useEffect, useRef } from 'react';
|
||||
import { d } from 'koration';
|
||||
|
||||
export const useReaderHideCursorOnInactivity = (scrollElementRef: MutableRefObject<HTMLDivElement | null>) => {
|
||||
const mouseInactiveTimeout = useRef<NodeJS.Timeout>(undefined);
|
||||
@@ -26,7 +27,7 @@ export const useReaderHideCursorOnInactivity = (scrollElementRef: MutableRefObje
|
||||
clearTimeout(mouseInactiveTimeout.current);
|
||||
mouseInactiveTimeout.current = setTimeout(() => {
|
||||
setCursorVisibility(false);
|
||||
}, 5000);
|
||||
}, d(5).seconds.inWholeMilliseconds);
|
||||
};
|
||||
|
||||
handleMouseMove();
|
||||
|
||||
Reference in New Issue
Block a user