Move chapter types and constants to corresponding files
This commit is contained in:
@@ -7,7 +7,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { TranslationKey } from '@/Base.types.ts';
|
import { TranslationKey } from '@/Base.types.ts';
|
||||||
import { ChapterListOptions, ChapterSortMode } from '@/modules/chapter/Chapter.types.ts';
|
import { ChapterAction, ChapterListOptions, ChapterSortMode } from '@/modules/chapter/Chapter.types.ts';
|
||||||
|
|
||||||
export const FALLBACK_CHAPTER = { id: -1, name: '', realUrl: '', isBookmarked: false };
|
export const FALLBACK_CHAPTER = { id: -1, name: '', realUrl: '', isBookmarked: false };
|
||||||
|
|
||||||
@@ -26,3 +26,63 @@ export const CHAPTER_SORT_OPTIONS_TO_TRANSLATION_KEY: Record<ChapterSortMode, Tr
|
|||||||
uploadedAt: 'global.sort.label.by_upload_date',
|
uploadedAt: 'global.sort.label.by_upload_date',
|
||||||
fetchedAt: 'global.sort.label.by_fetch_date',
|
fetchedAt: 'global.sort.label.by_fetch_date',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const CHAPTER_ACTION_TO_TRANSLATION: {
|
||||||
|
[key in ChapterAction]: {
|
||||||
|
action: {
|
||||||
|
single: TranslationKey;
|
||||||
|
selected: TranslationKey;
|
||||||
|
};
|
||||||
|
success: TranslationKey;
|
||||||
|
error: TranslationKey;
|
||||||
|
};
|
||||||
|
} = {
|
||||||
|
download: {
|
||||||
|
action: {
|
||||||
|
single: 'chapter.action.download.add.label.action',
|
||||||
|
selected: 'chapter.action.download.add.button.selected',
|
||||||
|
},
|
||||||
|
success: 'chapter.action.download.add.label.success',
|
||||||
|
error: 'chapter.action.download.add.label.error',
|
||||||
|
},
|
||||||
|
delete: {
|
||||||
|
action: {
|
||||||
|
single: 'chapter.action.download.delete.label.action',
|
||||||
|
selected: 'chapter.action.download.delete.button.selected',
|
||||||
|
},
|
||||||
|
success: 'chapter.action.download.delete.label.success',
|
||||||
|
error: 'chapter.action.download.delete.label.error',
|
||||||
|
},
|
||||||
|
bookmark: {
|
||||||
|
action: {
|
||||||
|
single: 'chapter.action.bookmark.add.label.action',
|
||||||
|
selected: 'chapter.action.bookmark.add.button.selected',
|
||||||
|
},
|
||||||
|
success: 'chapter.action.bookmark.add.label.success',
|
||||||
|
error: 'chapter.action.bookmark.add.label.error',
|
||||||
|
},
|
||||||
|
unbookmark: {
|
||||||
|
action: {
|
||||||
|
single: 'chapter.action.bookmark.remove.label.action',
|
||||||
|
selected: 'chapter.action.bookmark.remove.button.selected',
|
||||||
|
},
|
||||||
|
success: 'chapter.action.bookmark.remove.label.success',
|
||||||
|
error: 'chapter.action.bookmark.remove.label.error',
|
||||||
|
},
|
||||||
|
mark_as_read: {
|
||||||
|
action: {
|
||||||
|
single: 'chapter.action.mark_as_read.add.label.action.current',
|
||||||
|
selected: 'chapter.action.mark_as_read.add.button.selected',
|
||||||
|
},
|
||||||
|
success: 'chapter.action.mark_as_read.add.label.success',
|
||||||
|
error: 'chapter.action.mark_as_read.add.label.error',
|
||||||
|
},
|
||||||
|
mark_as_unread: {
|
||||||
|
action: {
|
||||||
|
single: 'chapter.action.mark_as_read.remove.label.action',
|
||||||
|
selected: 'chapter.action.mark_as_read.remove.button.selected',
|
||||||
|
},
|
||||||
|
success: 'chapter.action.mark_as_read.remove.label.success',
|
||||||
|
error: 'chapter.action.mark_as_read.remove.label.error',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|||||||
@@ -7,7 +7,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { NullAndUndefined } from '@/Base.types.ts';
|
import { NullAndUndefined } from '@/Base.types.ts';
|
||||||
import { ChapterReaderFieldsFragment } from '@/lib/graphql/generated/graphql.ts';
|
import {
|
||||||
|
ChapterReaderFieldsFragment,
|
||||||
|
ChapterType,
|
||||||
|
DownloadStatusFieldsFragment,
|
||||||
|
} from '@/lib/graphql/generated/graphql.ts';
|
||||||
|
|
||||||
export type ChapterSortMode = 'fetchedAt' | 'source' | 'chapterNumber' | 'uploadedAt';
|
export type ChapterSortMode = 'fetchedAt' | 'source' | 'chapterNumber' | 'uploadedAt';
|
||||||
|
|
||||||
@@ -21,3 +25,25 @@ export interface ChapterListOptions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export type TChapterReader = ChapterReaderFieldsFragment;
|
export type TChapterReader = ChapterReaderFieldsFragment;
|
||||||
|
|
||||||
|
export type ChapterAction = 'download' | 'delete' | 'bookmark' | 'unbookmark' | 'mark_as_read' | 'mark_as_unread';
|
||||||
|
|
||||||
|
export type ChapterDownloadStatus = DownloadStatusFieldsFragment['queue'][number];
|
||||||
|
|
||||||
|
export type ChapterIdInfo = Pick<ChapterType, 'id'>;
|
||||||
|
|
||||||
|
export type ChapterMangaInfo = Pick<ChapterType, 'mangaId'>;
|
||||||
|
|
||||||
|
export type ChapterDownloadInfo = ChapterIdInfo & Pick<ChapterType, 'isDownloaded'>;
|
||||||
|
|
||||||
|
export type ChapterBookmarkInfo = ChapterIdInfo & Pick<ChapterType, 'isBookmarked'>;
|
||||||
|
|
||||||
|
export type ChapterReadInfo = ChapterIdInfo & Pick<ChapterType, 'isRead'>;
|
||||||
|
|
||||||
|
export type ChapterNumberInfo = ChapterIdInfo & Pick<ChapterType, 'chapterNumber'>;
|
||||||
|
|
||||||
|
export type ChapterSourceOrderInfo = ChapterIdInfo & Pick<ChapterType, 'sourceOrder'>;
|
||||||
|
|
||||||
|
export type ChapterScanlatorInfo = ChapterIdInfo & Pick<ChapterType, 'scanlator'>;
|
||||||
|
|
||||||
|
export type ChapterRealUrlInfo = Pick<ChapterType, 'realUrl'>;
|
||||||
|
|||||||
@@ -18,17 +18,7 @@ import DoneAll from '@mui/icons-material/DoneAll';
|
|||||||
import { ComponentProps, useMemo } from 'react';
|
import { ComponentProps, useMemo } from 'react';
|
||||||
import LaunchIcon from '@mui/icons-material/Launch';
|
import LaunchIcon from '@mui/icons-material/Launch';
|
||||||
import { SelectableCollectionReturnType } from '@/modules/collection/hooks/useSelectableCollection.ts';
|
import { SelectableCollectionReturnType } from '@/modules/collection/hooks/useSelectableCollection.ts';
|
||||||
import {
|
import { Chapters } from '@/modules/chapter/services/Chapters.ts';
|
||||||
CHAPTER_ACTION_TO_TRANSLATION,
|
|
||||||
ChapterAction,
|
|
||||||
ChapterBookmarkInfo,
|
|
||||||
ChapterDownloadInfo,
|
|
||||||
ChapterIdInfo,
|
|
||||||
ChapterMangaInfo,
|
|
||||||
ChapterReadInfo,
|
|
||||||
ChapterRealUrlInfo,
|
|
||||||
Chapters,
|
|
||||||
} from '@/modules/chapter/services/Chapters.ts';
|
|
||||||
import { MenuItem } from '@/modules/core/components/menu/MenuItem.tsx';
|
import { MenuItem } from '@/modules/core/components/menu/MenuItem.tsx';
|
||||||
import {
|
import {
|
||||||
createGetMenuItemTitle,
|
createGetMenuItemTitle,
|
||||||
@@ -41,6 +31,16 @@ import { ChapterCard } from '@/modules/chapter/components/cards/ChapterCard.tsx'
|
|||||||
import { requestManager } from '@/lib/requests/RequestManager.ts';
|
import { requestManager } from '@/lib/requests/RequestManager.ts';
|
||||||
import { GetChaptersMangaQuery } from '@/lib/graphql/generated/graphql.ts';
|
import { GetChaptersMangaQuery } from '@/lib/graphql/generated/graphql.ts';
|
||||||
import { GET_CHAPTERS_MANGA } from '@/lib/graphql/queries/ChapterQuery.ts';
|
import { GET_CHAPTERS_MANGA } from '@/lib/graphql/queries/ChapterQuery.ts';
|
||||||
|
import { CHAPTER_ACTION_TO_TRANSLATION } from '@/modules/chapter/Chapter.constants.ts';
|
||||||
|
import {
|
||||||
|
ChapterAction,
|
||||||
|
ChapterBookmarkInfo,
|
||||||
|
ChapterDownloadInfo,
|
||||||
|
ChapterIdInfo,
|
||||||
|
ChapterMangaInfo,
|
||||||
|
ChapterReadInfo,
|
||||||
|
ChapterRealUrlInfo,
|
||||||
|
} from '@/modules/chapter/Chapter.types.ts';
|
||||||
|
|
||||||
type BaseProps = { onClose: () => void; selectable?: boolean };
|
type BaseProps = { onClose: () => void; selectable?: boolean };
|
||||||
|
|
||||||
|
|||||||
@@ -10,11 +10,12 @@ import IconButton from '@mui/material/IconButton';
|
|||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import DownloadIcon from '@mui/icons-material/Download';
|
import DownloadIcon from '@mui/icons-material/Download';
|
||||||
import { CustomTooltip } from '@/modules/core/components/CustomTooltip.tsx';
|
import { CustomTooltip } from '@/modules/core/components/CustomTooltip.tsx';
|
||||||
import { ChapterIdInfo, Chapters } from '@/modules/chapter/services/Chapters.ts';
|
import { Chapters } from '@/modules/chapter/services/Chapters.ts';
|
||||||
import { requestManager } from '@/lib/requests/RequestManager.ts';
|
import { requestManager } from '@/lib/requests/RequestManager.ts';
|
||||||
import { makeToast } from '@/modules/core/utils/Toast.ts';
|
import { makeToast } from '@/modules/core/utils/Toast.ts';
|
||||||
import { getErrorMessage } from '@/lib/HelperFunctions.ts';
|
import { getErrorMessage } from '@/lib/HelperFunctions.ts';
|
||||||
import { MUIUtil } from '@/lib/mui/MUI.util.ts';
|
import { MUIUtil } from '@/lib/mui/MUI.util.ts';
|
||||||
|
import { ChapterIdInfo } from '@/modules/chapter/Chapter.types.ts';
|
||||||
|
|
||||||
export const ChapterDownloadButton = ({
|
export const ChapterDownloadButton = ({
|
||||||
chapterId,
|
chapterId,
|
||||||
|
|||||||
@@ -11,11 +11,12 @@ import IconButton from '@mui/material/IconButton';
|
|||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { DownloadState } from '@/lib/graphql/generated/graphql.ts';
|
import { DownloadState } from '@/lib/graphql/generated/graphql.ts';
|
||||||
import { CustomTooltip } from '@/modules/core/components/CustomTooltip.tsx';
|
import { CustomTooltip } from '@/modules/core/components/CustomTooltip.tsx';
|
||||||
import { ChapterIdInfo, Chapters } from '@/modules/chapter/services/Chapters.ts';
|
import { Chapters } from '@/modules/chapter/services/Chapters.ts';
|
||||||
import { requestManager } from '@/lib/requests/RequestManager.ts';
|
import { requestManager } from '@/lib/requests/RequestManager.ts';
|
||||||
import { makeToast } from '@/modules/core/utils/Toast.ts';
|
import { makeToast } from '@/modules/core/utils/Toast.ts';
|
||||||
import { getErrorMessage } from '@/lib/HelperFunctions.ts';
|
import { getErrorMessage } from '@/lib/HelperFunctions.ts';
|
||||||
import { MUIUtil } from '@/lib/mui/MUI.util.ts';
|
import { MUIUtil } from '@/lib/mui/MUI.util.ts';
|
||||||
|
import { ChapterIdInfo } from '@/modules/chapter/Chapter.types.ts';
|
||||||
|
|
||||||
export const ChapterDownloadRetryButton = ({ chapterId }: { chapterId: ChapterIdInfo['id'] }) => {
|
export const ChapterDownloadRetryButton = ({ chapterId }: { chapterId: ChapterIdInfo['id'] }) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|||||||
@@ -25,6 +25,11 @@ import { DownloadStateIndicator } from '@/modules/core/components/downloads/Down
|
|||||||
import { ChapterType } from '@/lib/graphql/generated/graphql.ts';
|
import { ChapterType } from '@/lib/graphql/generated/graphql.ts';
|
||||||
import { ChapterActionMenuItems } from '@/modules/chapter/components/actions/ChapterActionMenuItems.tsx';
|
import { ChapterActionMenuItems } from '@/modules/chapter/components/actions/ChapterActionMenuItems.tsx';
|
||||||
import { Menu } from '@/modules/core/components/menu/Menu.tsx';
|
import { Menu } from '@/modules/core/components/menu/Menu.tsx';
|
||||||
|
import { Chapters } from '@/modules/chapter/services/Chapters.ts';
|
||||||
|
import { applyStyles } from '@/modules/core/utils/ApplyStyles.ts';
|
||||||
|
import { ChapterCardMetadata } from '@/modules/chapter/components/cards/ChapterCardMetadata.tsx';
|
||||||
|
import { MUIUtil } from '@/lib/mui/MUI.util.ts';
|
||||||
|
import { ListCardContent } from '@/modules/core/components/lists/cards/ListCardContent.tsx';
|
||||||
import {
|
import {
|
||||||
ChapterBookmarkInfo,
|
ChapterBookmarkInfo,
|
||||||
ChapterDownloadInfo,
|
ChapterDownloadInfo,
|
||||||
@@ -32,13 +37,8 @@ import {
|
|||||||
ChapterMangaInfo,
|
ChapterMangaInfo,
|
||||||
ChapterNumberInfo,
|
ChapterNumberInfo,
|
||||||
ChapterReadInfo,
|
ChapterReadInfo,
|
||||||
Chapters,
|
|
||||||
ChapterScanlatorInfo,
|
ChapterScanlatorInfo,
|
||||||
} from '@/modules/chapter/services/Chapters.ts';
|
} from '@/modules/chapter/Chapter.types.ts';
|
||||||
import { applyStyles } from '@/modules/core/utils/ApplyStyles.ts';
|
|
||||||
import { ChapterCardMetadata } from '@/modules/chapter/components/cards/ChapterCardMetadata.tsx';
|
|
||||||
import { MUIUtil } from '@/lib/mui/MUI.util.ts';
|
|
||||||
import { ListCardContent } from '@/modules/core/components/lists/cards/ListCardContent.tsx';
|
|
||||||
|
|
||||||
type TChapter = ChapterIdInfo &
|
type TChapter = ChapterIdInfo &
|
||||||
ChapterMangaInfo &
|
ChapterMangaInfo &
|
||||||
|
|||||||
@@ -15,92 +15,28 @@ import {
|
|||||||
ChapterListFieldsFragment,
|
ChapterListFieldsFragment,
|
||||||
ChapterType,
|
ChapterType,
|
||||||
DownloadState,
|
DownloadState,
|
||||||
DownloadStatusFieldsFragment,
|
|
||||||
DownloadTypeFieldsFragment,
|
DownloadTypeFieldsFragment,
|
||||||
} from '@/lib/graphql/generated/graphql.ts';
|
} from '@/lib/graphql/generated/graphql.ts';
|
||||||
import { CHAPTER_LIST_FIELDS } from '@/lib/graphql/fragments/ChapterFragments.ts';
|
import { CHAPTER_LIST_FIELDS } from '@/lib/graphql/fragments/ChapterFragments.ts';
|
||||||
|
|
||||||
import { DirectionOffset, TranslationKey } from '@/Base.types.ts';
|
import { DirectionOffset } from '@/Base.types.ts';
|
||||||
import { MangaIdInfo } from '@/modules/manga/Manga.types.ts';
|
import { MangaIdInfo } from '@/modules/manga/Manga.types.ts';
|
||||||
import { ReaderOpenChapterLocationState, ReaderResumeMode } from '@/modules/reader/types/Reader.types.ts';
|
import { ReaderOpenChapterLocationState, ReaderResumeMode } from '@/modules/reader/types/Reader.types.ts';
|
||||||
import { AppRoutes } from '@/modules/core/AppRoute.constants.ts';
|
import { AppRoutes } from '@/modules/core/AppRoute.constants.ts';
|
||||||
import { getErrorMessage } from '@/lib/HelperFunctions.ts';
|
import { getErrorMessage } from '@/lib/HelperFunctions.ts';
|
||||||
import { DOWNLOAD_TYPE_FIELDS } from '@/lib/graphql/fragments/DownloadFragments.ts';
|
import { DOWNLOAD_TYPE_FIELDS } from '@/lib/graphql/fragments/DownloadFragments.ts';
|
||||||
import { epochToDate, getDateString } from '@/util/DateHelper.ts';
|
import { epochToDate, getDateString } from '@/util/DateHelper.ts';
|
||||||
|
import { CHAPTER_ACTION_TO_TRANSLATION } from '@/modules/chapter/Chapter.constants.ts';
|
||||||
export type ChapterAction = 'download' | 'delete' | 'bookmark' | 'unbookmark' | 'mark_as_read' | 'mark_as_unread';
|
import {
|
||||||
|
ChapterAction,
|
||||||
export const CHAPTER_ACTION_TO_TRANSLATION: {
|
ChapterBookmarkInfo,
|
||||||
[key in ChapterAction]: {
|
ChapterDownloadInfo,
|
||||||
action: {
|
ChapterMangaInfo,
|
||||||
single: TranslationKey;
|
ChapterNumberInfo,
|
||||||
selected: TranslationKey;
|
ChapterReadInfo,
|
||||||
};
|
ChapterScanlatorInfo,
|
||||||
success: TranslationKey;
|
ChapterSourceOrderInfo,
|
||||||
error: TranslationKey;
|
} from '@/modules/chapter/Chapter.types.ts';
|
||||||
};
|
|
||||||
} = {
|
|
||||||
download: {
|
|
||||||
action: {
|
|
||||||
single: 'chapter.action.download.add.label.action',
|
|
||||||
selected: 'chapter.action.download.add.button.selected',
|
|
||||||
},
|
|
||||||
success: 'chapter.action.download.add.label.success',
|
|
||||||
error: 'chapter.action.download.add.label.error',
|
|
||||||
},
|
|
||||||
delete: {
|
|
||||||
action: {
|
|
||||||
single: 'chapter.action.download.delete.label.action',
|
|
||||||
selected: 'chapter.action.download.delete.button.selected',
|
|
||||||
},
|
|
||||||
success: 'chapter.action.download.delete.label.success',
|
|
||||||
error: 'chapter.action.download.delete.label.error',
|
|
||||||
},
|
|
||||||
bookmark: {
|
|
||||||
action: {
|
|
||||||
single: 'chapter.action.bookmark.add.label.action',
|
|
||||||
selected: 'chapter.action.bookmark.add.button.selected',
|
|
||||||
},
|
|
||||||
success: 'chapter.action.bookmark.add.label.success',
|
|
||||||
error: 'chapter.action.bookmark.add.label.error',
|
|
||||||
},
|
|
||||||
unbookmark: {
|
|
||||||
action: {
|
|
||||||
single: 'chapter.action.bookmark.remove.label.action',
|
|
||||||
selected: 'chapter.action.bookmark.remove.button.selected',
|
|
||||||
},
|
|
||||||
success: 'chapter.action.bookmark.remove.label.success',
|
|
||||||
error: 'chapter.action.bookmark.remove.label.error',
|
|
||||||
},
|
|
||||||
mark_as_read: {
|
|
||||||
action: {
|
|
||||||
single: 'chapter.action.mark_as_read.add.label.action.current',
|
|
||||||
selected: 'chapter.action.mark_as_read.add.button.selected',
|
|
||||||
},
|
|
||||||
success: 'chapter.action.mark_as_read.add.label.success',
|
|
||||||
error: 'chapter.action.mark_as_read.add.label.error',
|
|
||||||
},
|
|
||||||
mark_as_unread: {
|
|
||||||
action: {
|
|
||||||
single: 'chapter.action.mark_as_read.remove.label.action',
|
|
||||||
selected: 'chapter.action.mark_as_read.remove.button.selected',
|
|
||||||
},
|
|
||||||
success: 'chapter.action.mark_as_read.remove.label.success',
|
|
||||||
error: 'chapter.action.mark_as_read.remove.label.error',
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export type ChapterDownloadStatus = DownloadStatusFieldsFragment['queue'][number];
|
|
||||||
|
|
||||||
export type ChapterIdInfo = Pick<ChapterType, 'id'>;
|
|
||||||
export type ChapterMangaInfo = Pick<ChapterType, 'mangaId'>;
|
|
||||||
export type ChapterDownloadInfo = ChapterIdInfo & Pick<ChapterType, 'isDownloaded'>;
|
|
||||||
export type ChapterBookmarkInfo = ChapterIdInfo & Pick<ChapterType, 'isBookmarked'>;
|
|
||||||
export type ChapterReadInfo = ChapterIdInfo & Pick<ChapterType, 'isRead'>;
|
|
||||||
export type ChapterNumberInfo = ChapterIdInfo & Pick<ChapterType, 'chapterNumber'>;
|
|
||||||
export type ChapterSourceOrderInfo = ChapterIdInfo & Pick<ChapterType, 'sourceOrder'>;
|
|
||||||
export type ChapterScanlatorInfo = ChapterIdInfo & Pick<ChapterType, 'scanlator'>;
|
|
||||||
export type ChapterRealUrlInfo = Pick<ChapterType, 'realUrl'>;
|
|
||||||
|
|
||||||
export class Chapters {
|
export class Chapters {
|
||||||
static getIds(chapters: { id: number }[]): number[] {
|
static getIds(chapters: { id: number }[]): number[] {
|
||||||
|
|||||||
@@ -7,10 +7,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
import { ChapterBookmarkInfo, ChapterDownloadInfo, ChapterReadInfo } from '@/modules/chapter/services/Chapters.ts';
|
|
||||||
import { ChapterType } from '@/lib/graphql/generated/graphql.ts';
|
import { ChapterType } from '@/lib/graphql/generated/graphql.ts';
|
||||||
import { NullAndUndefined } from '@/Base.types.ts';
|
import { NullAndUndefined } from '@/Base.types.ts';
|
||||||
import { ChapterListOptions } from '@/modules/chapter/Chapter.types.ts';
|
import {
|
||||||
|
ChapterBookmarkInfo,
|
||||||
|
ChapterDownloadInfo,
|
||||||
|
ChapterListOptions,
|
||||||
|
ChapterReadInfo,
|
||||||
|
} from '@/modules/chapter/Chapter.types.ts';
|
||||||
import { MangaIdInfo } from '@/modules/manga/Manga.types.ts';
|
import { MangaIdInfo } from '@/modules/manga/Manga.types.ts';
|
||||||
import { GqlMetaHolder } from '@/modules/metadata/Metadata.types.ts';
|
import { GqlMetaHolder } from '@/modules/metadata/Metadata.types.ts';
|
||||||
import { createUpdateMangaMetadata, useGetMangaMetadata } from '@/modules/manga/services/MangaMetadata.ts';
|
import { createUpdateMangaMetadata, useGetMangaMetadata } from '@/modules/manga/services/MangaMetadata.ts';
|
||||||
|
|||||||
@@ -8,7 +8,8 @@
|
|||||||
|
|
||||||
import { SourceType } from '@/lib/graphql/generated/graphql.ts';
|
import { SourceType } from '@/lib/graphql/generated/graphql.ts';
|
||||||
import { MangaIdInfo } from '@/modules/manga/Manga.types.ts';
|
import { MangaIdInfo } from '@/modules/manga/Manga.types.ts';
|
||||||
import { ChapterSourceOrderInfo } from '@/modules/chapter/services/Chapters.ts';
|
|
||||||
|
import { ChapterSourceOrderInfo } from '@/modules/chapter/Chapter.types.ts';
|
||||||
|
|
||||||
type AppRouteInfo = {
|
type AppRouteInfo = {
|
||||||
match: string;
|
match: string;
|
||||||
|
|||||||
@@ -11,8 +11,9 @@ import Box from '@mui/material/Box';
|
|||||||
import Typography from '@mui/material/Typography';
|
import Typography from '@mui/material/Typography';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { DownloadState } from '@/lib/graphql/generated/graphql.ts';
|
import { DownloadState } from '@/lib/graphql/generated/graphql.ts';
|
||||||
import { ChapterIdInfo, Chapters } from '@/modules/chapter/services/Chapters.ts';
|
import { Chapters } from '@/modules/chapter/services/Chapters.ts';
|
||||||
import { TranslationKey } from '@/Base.types.ts';
|
import { TranslationKey } from '@/Base.types.ts';
|
||||||
|
import { ChapterIdInfo } from '@/modules/chapter/Chapter.types.ts';
|
||||||
|
|
||||||
const DOWNLOAD_STATE_TO_TRANSLATION_KEY_MAP: { [state in DownloadState]: TranslationKey } = {
|
const DOWNLOAD_STATE_TO_TRANSLATION_KEY_MAP: { [state in DownloadState]: TranslationKey } = {
|
||||||
DOWNLOADING: 'download.state.label.downloading',
|
DOWNLOADING: 'download.state.label.downloading',
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import { getErrorMessage } from '@/lib/HelperFunctions.ts';
|
|||||||
import { makeToast } from '@/modules/core/utils/Toast.ts';
|
import { makeToast } from '@/modules/core/utils/Toast.ts';
|
||||||
import { requestManager } from '@/lib/requests/RequestManager.ts';
|
import { requestManager } from '@/lib/requests/RequestManager.ts';
|
||||||
import { DownloaderState } from '@/lib/graphql/generated/graphql.ts';
|
import { DownloaderState } from '@/lib/graphql/generated/graphql.ts';
|
||||||
import { ChapterDownloadStatus, ChapterIdInfo } from '@/modules/chapter/services/Chapters.ts';
|
import { ChapterDownloadStatus, ChapterIdInfo } from '@/modules/chapter/Chapter.types.ts';
|
||||||
|
|
||||||
export const DownloadQueueChapterCard = memo(
|
export const DownloadQueueChapterCard = memo(
|
||||||
({ item, status }: { item: ChapterDownloadStatus; status: DownloaderState }) => {
|
({ item, status }: { item: ChapterDownloadStatus; status: DownloaderState }) => {
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ import { makeToast } from '@/modules/core/utils/Toast.ts';
|
|||||||
import { EmptyViewAbsoluteCentered } from '@/modules/core/components/feedback/EmptyViewAbsoluteCentered.tsx';
|
import { EmptyViewAbsoluteCentered } from '@/modules/core/components/feedback/EmptyViewAbsoluteCentered.tsx';
|
||||||
import { LoadingPlaceholder } from '@/modules/core/components/feedback/LoadingPlaceholder.tsx';
|
import { LoadingPlaceholder } from '@/modules/core/components/feedback/LoadingPlaceholder.tsx';
|
||||||
import { defaultPromiseErrorHandler } from '@/lib/DefaultPromiseErrorHandler.ts';
|
import { defaultPromiseErrorHandler } from '@/lib/DefaultPromiseErrorHandler.ts';
|
||||||
import { ChapterDownloadStatus } from '@/modules/chapter/services/Chapters.ts';
|
|
||||||
import { DownloaderState } from '@/lib/graphql/generated/graphql.ts';
|
import { DownloaderState } from '@/lib/graphql/generated/graphql.ts';
|
||||||
import { getErrorMessage } from '@/lib/HelperFunctions.ts';
|
import { getErrorMessage } from '@/lib/HelperFunctions.ts';
|
||||||
import { DndSortableItem } from '@/lib/dnd-kit/DndSortableItem.tsx';
|
import { DndSortableItem } from '@/lib/dnd-kit/DndSortableItem.tsx';
|
||||||
@@ -32,6 +31,7 @@ import { DndOverlayItem } from '@/lib/dnd-kit/DndOverlayItem.tsx';
|
|||||||
import { DownloadQueueChapterCard } from '@/modules/downloads/components/DownloadQueueChapterCard.tsx';
|
import { DownloadQueueChapterCard } from '@/modules/downloads/components/DownloadQueueChapterCard.tsx';
|
||||||
import { useAppTitle } from '@/modules/navigation-bar/hooks/useAppTitle.ts';
|
import { useAppTitle } from '@/modules/navigation-bar/hooks/useAppTitle.ts';
|
||||||
import { useAppAction } from '@/modules/navigation-bar/hooks/useAppAction.ts';
|
import { useAppAction } from '@/modules/navigation-bar/hooks/useAppAction.ts';
|
||||||
|
import { ChapterDownloadStatus } from '@/modules/chapter/Chapter.types.ts';
|
||||||
|
|
||||||
export const DownloadQueue: React.FC = () => {
|
export const DownloadQueue: React.FC = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|||||||
@@ -11,8 +11,9 @@ import Button from '@mui/material/Button';
|
|||||||
import PlayArrowIcon from '@mui/icons-material/PlayArrow';
|
import PlayArrowIcon from '@mui/icons-material/PlayArrow';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import { CustomTooltip } from '@/modules/core/components/CustomTooltip.tsx';
|
import { CustomTooltip } from '@/modules/core/components/CustomTooltip.tsx';
|
||||||
import { ChapterReadInfo, Chapters, ChapterSourceOrderInfo } from '@/modules/chapter/services/Chapters.ts';
|
import { Chapters } from '@/modules/chapter/services/Chapters.ts';
|
||||||
import { MUIUtil } from '@/lib/mui/MUI.util.ts';
|
import { MUIUtil } from '@/lib/mui/MUI.util.ts';
|
||||||
|
import { ChapterReadInfo, ChapterSourceOrderInfo } from '@/modules/chapter/Chapter.types.ts';
|
||||||
|
|
||||||
export const ContinueReadingButton = ({
|
export const ContinueReadingButton = ({
|
||||||
showContinueReadingButton,
|
showContinueReadingButton,
|
||||||
|
|||||||
@@ -10,12 +10,8 @@ import { Link } from 'react-router-dom';
|
|||||||
import PlayArrow from '@mui/icons-material/PlayArrow';
|
import PlayArrow from '@mui/icons-material/PlayArrow';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { StyledFab } from '@/modules/core/components/buttons/StyledFab.tsx';
|
import { StyledFab } from '@/modules/core/components/buttons/StyledFab.tsx';
|
||||||
import {
|
import { Chapters } from '@/modules/chapter/services/Chapters.ts';
|
||||||
ChapterMangaInfo,
|
import { ChapterMangaInfo, ChapterReadInfo, ChapterSourceOrderInfo } from '@/modules/chapter/Chapter.types.ts';
|
||||||
ChapterReadInfo,
|
|
||||||
Chapters,
|
|
||||||
ChapterSourceOrderInfo,
|
|
||||||
} from '@/modules/chapter/services/Chapters.ts';
|
|
||||||
|
|
||||||
export function ResumeFab({ chapter }: { chapter: ChapterMangaInfo & ChapterSourceOrderInfo & ChapterReadInfo }) {
|
export function ResumeFab({ chapter }: { chapter: ChapterMangaInfo & ChapterSourceOrderInfo & ChapterReadInfo }) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|||||||
@@ -22,11 +22,11 @@ import {
|
|||||||
} from '@/modules/metadata/Metadata.types.ts';
|
} from '@/modules/metadata/Metadata.types.ts';
|
||||||
import { extractOriginalKey, getMetadataKey } from '@/modules/metadata/Metadata.utils.ts';
|
import { extractOriginalKey, getMetadataKey } from '@/modules/metadata/Metadata.utils.ts';
|
||||||
import { MangaIdInfo } from '@/modules/manga/Manga.types.ts';
|
import { MangaIdInfo } from '@/modules/manga/Manga.types.ts';
|
||||||
import { ChapterIdInfo } from '@/modules/chapter/services/Chapters.ts';
|
|
||||||
import { CategoryIdInfo } from '@/modules/category/Category.types.ts';
|
import { CategoryIdInfo } from '@/modules/category/Category.types.ts';
|
||||||
import { defaultPromiseErrorHandler } from '@/lib/DefaultPromiseErrorHandler.ts';
|
import { defaultPromiseErrorHandler } from '@/lib/DefaultPromiseErrorHandler.ts';
|
||||||
import { getMetadataDeleteFunction, getMetadataUpdateFunction } from '@/modules/metadata/services/MetadataUpdater.ts';
|
import { getMetadataDeleteFunction, getMetadataUpdateFunction } from '@/modules/metadata/services/MetadataUpdater.ts';
|
||||||
import { SourceIdInfo } from '@/modules/source/Source.types.ts';
|
import { SourceIdInfo } from '@/modules/source/Source.types.ts';
|
||||||
|
import { ChapterIdInfo } from '@/modules/chapter/Chapter.types.ts';
|
||||||
|
|
||||||
const getAppKeyPrefixForMigration = (migrationId: number): string => {
|
const getAppKeyPrefixForMigration = (migrationId: number): string => {
|
||||||
const appKeyPrefix = METADATA_MIGRATIONS.slice(0, migrationId)
|
const appKeyPrefix = METADATA_MIGRATIONS.slice(0, migrationId)
|
||||||
|
|||||||
@@ -17,11 +17,11 @@ import {
|
|||||||
} from '@/modules/metadata/Metadata.types.ts';
|
} from '@/modules/metadata/Metadata.types.ts';
|
||||||
import { MangaIdInfo } from '@/modules/manga/Manga.types.ts';
|
import { MangaIdInfo } from '@/modules/manga/Manga.types.ts';
|
||||||
|
|
||||||
import { ChapterIdInfo } from '@/modules/chapter/services/Chapters.ts';
|
|
||||||
import { CategoryIdInfo } from '@/modules/category/Category.types.ts';
|
import { CategoryIdInfo } from '@/modules/category/Category.types.ts';
|
||||||
import { doesMetadataKeyExistIn, getMetadataKey } from '@/modules/metadata/Metadata.utils.ts';
|
import { doesMetadataKeyExistIn, getMetadataKey } from '@/modules/metadata/Metadata.utils.ts';
|
||||||
import { applyMetadataMigrations } from '@/modules/metadata/services/MetadataMigrations.ts';
|
import { applyMetadataMigrations } from '@/modules/metadata/services/MetadataMigrations.ts';
|
||||||
import { SourceIdInfo } from '@/modules/source/Source.types.ts';
|
import { SourceIdInfo } from '@/modules/source/Source.types.ts';
|
||||||
|
import { ChapterIdInfo } from '@/modules/chapter/Chapter.types.ts';
|
||||||
|
|
||||||
const getMetadataValueFrom = <Key extends AppMetadataKeys, Value extends AllowedMetadataValueTypes>(
|
const getMetadataValueFrom = <Key extends AppMetadataKeys, Value extends AllowedMetadataValueTypes>(
|
||||||
metadata: Metadata | undefined,
|
metadata: Metadata | undefined,
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { requestManager } from '@/lib/requests/RequestManager.ts';
|
import { requestManager } from '@/lib/requests/RequestManager.ts';
|
||||||
import { ChapterIdInfo } from '@/modules/chapter/services/Chapters.ts';
|
|
||||||
import { CategoryIdInfo } from '@/modules/category/Category.types.ts';
|
import { CategoryIdInfo } from '@/modules/category/Category.types.ts';
|
||||||
import {
|
import {
|
||||||
AllowedMetadataValueTypes,
|
AllowedMetadataValueTypes,
|
||||||
@@ -21,6 +20,7 @@ import { MangaIdInfo } from '@/modules/manga/Manga.types.ts';
|
|||||||
import { getMetadataKey } from '@/modules/metadata/Metadata.utils.ts';
|
import { getMetadataKey } from '@/modules/metadata/Metadata.utils.ts';
|
||||||
import { convertToGqlMeta } from '@/modules/metadata/services/MetadataConverter.ts';
|
import { convertToGqlMeta } from '@/modules/metadata/services/MetadataConverter.ts';
|
||||||
import { SourceIdInfo } from '@/modules/source/Source.types.ts';
|
import { SourceIdInfo } from '@/modules/source/Source.types.ts';
|
||||||
|
import { ChapterIdInfo } from '@/modules/chapter/Chapter.types.ts';
|
||||||
|
|
||||||
const requestUpdateMetadataValue = async (
|
const requestUpdateMetadataValue = async (
|
||||||
metadataHolder: GqlMetaHolder,
|
metadataHolder: GqlMetaHolder,
|
||||||
|
|||||||
@@ -12,8 +12,9 @@ import { memo } from 'react';
|
|||||||
import BookmarkIcon from '@mui/icons-material/Bookmark';
|
import BookmarkIcon from '@mui/icons-material/Bookmark';
|
||||||
import BookmarkBorderIcon from '@mui/icons-material/BookmarkBorder';
|
import BookmarkBorderIcon from '@mui/icons-material/BookmarkBorder';
|
||||||
import { CustomTooltip } from '@/modules/core/components/CustomTooltip.tsx';
|
import { CustomTooltip } from '@/modules/core/components/CustomTooltip.tsx';
|
||||||
import { CHAPTER_ACTION_TO_TRANSLATION, ChapterAction, Chapters } from '@/modules/chapter/services/Chapters.ts';
|
import { Chapters } from '@/modules/chapter/services/Chapters.ts';
|
||||||
import { TChapterReader } from '@/modules/chapter/Chapter.types.ts';
|
import { ChapterAction, TChapterReader } from '@/modules/chapter/Chapter.types.ts';
|
||||||
|
import { CHAPTER_ACTION_TO_TRANSLATION } from '@/modules/chapter/Chapter.constants.ts';
|
||||||
|
|
||||||
const BaseReaderBookmarkButton = ({ id, isBookmarked }: Pick<TChapterReader, 'id' | 'isBookmarked'>) => {
|
const BaseReaderBookmarkButton = ({ id, isBookmarked }: Pick<TChapterReader, 'id' | 'isBookmarked'>) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import ReplayIcon from '@mui/icons-material/Replay';
|
|||||||
import { memo, useMemo, useRef } from 'react';
|
import { memo, useMemo, useRef } from 'react';
|
||||||
import DeleteIcon from '@mui/icons-material/Delete';
|
import DeleteIcon from '@mui/icons-material/Delete';
|
||||||
import { CustomTooltip } from '@/modules/core/components/CustomTooltip.tsx';
|
import { CustomTooltip } from '@/modules/core/components/CustomTooltip.tsx';
|
||||||
import { CHAPTER_ACTION_TO_TRANSLATION, Chapters } from '@/modules/chapter/services/Chapters.ts';
|
import { Chapters } from '@/modules/chapter/services/Chapters.ts';
|
||||||
import { ReaderStateChapters } from '@/modules/reader/types/Reader.types.ts';
|
import { ReaderStateChapters } from '@/modules/reader/types/Reader.types.ts';
|
||||||
import { DownloadStateIndicator } from '@/modules/core/components/downloads/DownloadStateIndicator.tsx';
|
import { DownloadStateIndicator } from '@/modules/core/components/downloads/DownloadStateIndicator.tsx';
|
||||||
import { ReaderStatePages } from '@/modules/reader/types/ReaderProgressBar.types.ts';
|
import { ReaderStatePages } from '@/modules/reader/types/ReaderProgressBar.types.ts';
|
||||||
@@ -24,7 +24,7 @@ import { useReaderStateChaptersContext } from '@/modules/reader/contexts/state/R
|
|||||||
import { userReaderStatePagesContext } from '@/modules/reader/contexts/state/ReaderStatePagesContext.tsx';
|
import { userReaderStatePagesContext } from '@/modules/reader/contexts/state/ReaderStatePagesContext.tsx';
|
||||||
import { ReaderLibraryButton } from '@/modules/reader/components/overlay/navigation/ReaderLibraryButton.tsx';
|
import { ReaderLibraryButton } from '@/modules/reader/components/overlay/navigation/ReaderLibraryButton.tsx';
|
||||||
import { ReaderBookmarkButton } from '@/modules/reader/components/overlay/navigation/ReaderBookmarkButton.tsx';
|
import { ReaderBookmarkButton } from '@/modules/reader/components/overlay/navigation/ReaderBookmarkButton.tsx';
|
||||||
import { FALLBACK_CHAPTER } from '@/modules/chapter/Chapter.constants.ts';
|
import { CHAPTER_ACTION_TO_TRANSLATION, FALLBACK_CHAPTER } from '@/modules/chapter/Chapter.constants.ts';
|
||||||
|
|
||||||
const DownloadButton = ({ currentChapter }: Required<Pick<ReaderStateChapters, 'currentChapter'>>) => {
|
const DownloadButton = ({ currentChapter }: Required<Pick<ReaderStateChapters, 'currentChapter'>>) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ import {
|
|||||||
import { useReaderConvertPagesForReadingMode } from '@/modules/reader/hooks/useReaderConvertPagesForReadingMode.ts';
|
import { useReaderConvertPagesForReadingMode } from '@/modules/reader/hooks/useReaderConvertPagesForReadingMode.ts';
|
||||||
import { ReaderTransitionPage } from '@/modules/reader/components/viewer/ReaderTransitionPage.tsx';
|
import { ReaderTransitionPage } from '@/modules/reader/components/viewer/ReaderTransitionPage.tsx';
|
||||||
import { applyStyles } from '@/modules/core/utils/ApplyStyles.ts';
|
import { applyStyles } from '@/modules/core/utils/ApplyStyles.ts';
|
||||||
import { ChapterIdInfo } from '@/modules/chapter/services/Chapters.ts';
|
|
||||||
import { READER_STATE_PAGES_DEFAULTS } from '@/modules/reader/constants/ReaderContext.constants.ts';
|
import { READER_STATE_PAGES_DEFAULTS } from '@/modules/reader/constants/ReaderContext.constants.ts';
|
||||||
import { requestManager } from '@/lib/requests/RequestManager.ts';
|
import { requestManager } from '@/lib/requests/RequestManager.ts';
|
||||||
import { defaultPromiseErrorHandler } from '@/lib/DefaultPromiseErrorHandler.ts';
|
import { defaultPromiseErrorHandler } from '@/lib/DefaultPromiseErrorHandler.ts';
|
||||||
@@ -47,6 +46,7 @@ import { getErrorMessage, noOp } from '@/lib/HelperFunctions.ts';
|
|||||||
import { LoadingPlaceholder } from '@/modules/core/components/feedback/LoadingPlaceholder.tsx';
|
import { LoadingPlaceholder } from '@/modules/core/components/feedback/LoadingPlaceholder.tsx';
|
||||||
import { ReaderInfiniteScrollUpdateChapter } from '@/modules/reader/components/viewer/ReaderInfiniteScrollUpdateChapter.tsx';
|
import { ReaderInfiniteScrollUpdateChapter } from '@/modules/reader/components/viewer/ReaderInfiniteScrollUpdateChapter.tsx';
|
||||||
import { useResizeObserver } from '@/modules/core/hooks/useResizeObserver.tsx';
|
import { useResizeObserver } from '@/modules/core/hooks/useResizeObserver.tsx';
|
||||||
|
import { ChapterIdInfo } from '@/modules/chapter/Chapter.types.ts';
|
||||||
|
|
||||||
const BaseReaderChapterViewer = ({
|
const BaseReaderChapterViewer = ({
|
||||||
currentPageIndex,
|
currentPageIndex,
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ import { withPropsFrom } from '@/modules/core/hoc/withPropsFrom.tsx';
|
|||||||
import { useReaderInfiniteScrollUpdateChapter } from '@/modules/reader/hooks/useReaderInfiniteScrollUpdateChapter.ts';
|
import { useReaderInfiniteScrollUpdateChapter } from '@/modules/reader/hooks/useReaderInfiniteScrollUpdateChapter.ts';
|
||||||
import { IReaderSettings, TReaderScrollbarContext } from '@/modules/reader/types/Reader.types.ts';
|
import { IReaderSettings, TReaderScrollbarContext } from '@/modules/reader/types/Reader.types.ts';
|
||||||
import { ReaderControls } from '@/modules/reader/services/ReaderControls.ts';
|
import { ReaderControls } from '@/modules/reader/services/ReaderControls.ts';
|
||||||
import { ChapterIdInfo } from '@/modules/chapter/services/Chapters.ts';
|
|
||||||
import { ReaderService } from '@/modules/reader/services/ReaderService.ts';
|
import { ReaderService } from '@/modules/reader/services/ReaderService.ts';
|
||||||
|
import { ChapterIdInfo } from '@/modules/chapter/Chapter.types.ts';
|
||||||
|
|
||||||
const BaseReaderInfiniteScrollUpdateChapter = ({
|
const BaseReaderInfiniteScrollUpdateChapter = ({
|
||||||
readingMode,
|
readingMode,
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ import { ComponentProps, memo, useMemo } from 'react';
|
|||||||
import { alpha, useTheme } from '@mui/material/styles';
|
import { alpha, useTheme } from '@mui/material/styles';
|
||||||
import { useReaderScrollbarContext } from '@/modules/reader/contexts/ReaderScrollbarContext.tsx';
|
import { useReaderScrollbarContext } from '@/modules/reader/contexts/ReaderScrollbarContext.tsx';
|
||||||
import { useReaderStateChaptersContext } from '@/modules/reader/contexts/state/ReaderStateChaptersContext.tsx';
|
import { useReaderStateChaptersContext } from '@/modules/reader/contexts/state/ReaderStateChaptersContext.tsx';
|
||||||
import { ChapterIdInfo } from '@/modules/chapter/services/Chapters.ts';
|
|
||||||
import {
|
import {
|
||||||
IReaderSettings,
|
IReaderSettings,
|
||||||
ReaderTransitionPageMode,
|
ReaderTransitionPageMode,
|
||||||
@@ -41,6 +40,7 @@ import { ReaderService } from '@/modules/reader/services/ReaderService.ts';
|
|||||||
import { ReaderStatePages } from '@/modules/reader/types/ReaderProgressBar.types.ts';
|
import { ReaderStatePages } from '@/modules/reader/types/ReaderProgressBar.types.ts';
|
||||||
import { userReaderStatePagesContext } from '@/modules/reader/contexts/state/ReaderStatePagesContext.tsx';
|
import { userReaderStatePagesContext } from '@/modules/reader/contexts/state/ReaderStatePagesContext.tsx';
|
||||||
import { ChapterType } from '@/lib/graphql/generated/graphql.ts';
|
import { ChapterType } from '@/lib/graphql/generated/graphql.ts';
|
||||||
|
import { ChapterIdInfo } from '@/modules/chapter/Chapter.types.ts';
|
||||||
|
|
||||||
const ChapterInfo = ({
|
const ChapterInfo = ({
|
||||||
title,
|
title,
|
||||||
|
|||||||
@@ -67,7 +67,8 @@ import { coerceIn, noOp } from '@/lib/HelperFunctions.ts';
|
|||||||
import { useNavBarContext } from '@/modules/navigation-bar/contexts/NavbarContext.tsx';
|
import { useNavBarContext } from '@/modules/navigation-bar/contexts/NavbarContext.tsx';
|
||||||
import { NavbarContextType } from '@/modules/navigation-bar/NavigationBar.types.ts';
|
import { NavbarContextType } from '@/modules/navigation-bar/NavigationBar.types.ts';
|
||||||
import { useReaderPreserveScrollPosition } from '@/modules/reader/hooks/useReaderPreserveScrollPosition.ts';
|
import { useReaderPreserveScrollPosition } from '@/modules/reader/hooks/useReaderPreserveScrollPosition.ts';
|
||||||
import { ChapterIdInfo } from '@/modules/chapter/services/Chapters';
|
|
||||||
|
import { ChapterIdInfo } from '@/modules/chapter/Chapter.types.ts';
|
||||||
|
|
||||||
const READING_MODE_TO_IN_VIEWPORT_TYPE: Record<ReadingMode, PageInViewportType> = {
|
const READING_MODE_TO_IN_VIEWPORT_TYPE: Record<ReadingMode, PageInViewportType> = {
|
||||||
[ReadingMode.SINGLE_PAGE]: PageInViewportType.X,
|
[ReadingMode.SINGLE_PAGE]: PageInViewportType.X,
|
||||||
|
|||||||
@@ -22,8 +22,7 @@ import {
|
|||||||
isReaderWidthEditable,
|
isReaderWidthEditable,
|
||||||
} from '@/modules/reader/utils/ReaderSettings.utils.tsx';
|
} from '@/modules/reader/utils/ReaderSettings.utils.tsx';
|
||||||
import { getPreviousNextChapterVisibility } from '@/modules/reader/utils/Reader.utils.ts';
|
import { getPreviousNextChapterVisibility } from '@/modules/reader/utils/Reader.utils.ts';
|
||||||
import { ChapterIdInfo } from '@/modules/chapter/services/Chapters.ts';
|
import { ChapterIdInfo, TChapterReader } from '@/modules/chapter/Chapter.types.ts';
|
||||||
import { TChapterReader } from '@/modules/chapter/Chapter.types.ts';
|
|
||||||
|
|
||||||
const shouldPreserveOnResizeChange = (
|
const shouldPreserveOnResizeChange = (
|
||||||
readingMode: ReadingMode,
|
readingMode: ReadingMode,
|
||||||
|
|||||||
@@ -48,10 +48,10 @@ import {
|
|||||||
getReaderOpenChapterResumeMode,
|
getReaderOpenChapterResumeMode,
|
||||||
updateReaderStateVisibleChapters,
|
updateReaderStateVisibleChapters,
|
||||||
} from '@/modules/reader/utils/Reader.utils.ts';
|
} from '@/modules/reader/utils/Reader.utils.ts';
|
||||||
import { ChapterIdInfo, Chapters } from '@/modules/chapter/services/Chapters.ts';
|
import { Chapters } from '@/modules/chapter/services/Chapters.ts';
|
||||||
import { DirectionOffset, TranslationKey } from '@/Base.types.ts';
|
import { DirectionOffset, TranslationKey } from '@/Base.types.ts';
|
||||||
import { useMetadataServerSettings } from '@/modules/settings/services/ServerSettingsMetadata.ts';
|
import { useMetadataServerSettings } from '@/modules/settings/services/ServerSettingsMetadata.ts';
|
||||||
import { TChapterReader } from '@/modules/chapter/Chapter.types.ts';
|
import { ChapterIdInfo, TChapterReader } from '@/modules/chapter/Chapter.types.ts';
|
||||||
import { awaitConfirmation } from '@/modules/core/utils/AwaitableDialog.tsx';
|
import { awaitConfirmation } from '@/modules/core/utils/AwaitableDialog.tsx';
|
||||||
import { defaultPromiseErrorHandler } from '@/lib/DefaultPromiseErrorHandler.ts';
|
import { defaultPromiseErrorHandler } from '@/lib/DefaultPromiseErrorHandler.ts';
|
||||||
import { TReaderOverlayContext } from '@/modules/reader/types/ReaderOverlay.types.ts';
|
import { TReaderOverlayContext } from '@/modules/reader/types/ReaderOverlay.types.ts';
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ import { useCallback, useMemo } from 'react';
|
|||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
import { Direction, useTheme } from '@mui/material/styles';
|
import { Direction, useTheme } from '@mui/material/styles';
|
||||||
import { t as translate } from 'i18next';
|
import { t as translate } from 'i18next';
|
||||||
import { TChapterReader } from '@/modules/chapter/Chapter.types.ts';
|
import { ChapterIdInfo, TChapterReader } from '@/modules/chapter/Chapter.types.ts';
|
||||||
import { ChapterIdInfo, Chapters } from '@/modules/chapter/services/Chapters.ts';
|
import { Chapters } from '@/modules/chapter/services/Chapters.ts';
|
||||||
import {
|
import {
|
||||||
IReaderSettings,
|
IReaderSettings,
|
||||||
IReaderSettingsWithDefaultFlag,
|
IReaderSettingsWithDefaultFlag,
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ import {
|
|||||||
ReadingMode,
|
ReadingMode,
|
||||||
} from '@/modules/reader/types/Reader.types.ts';
|
} from '@/modules/reader/types/Reader.types.ts';
|
||||||
import { UpdateChapterPatchInput } from '@/lib/graphql/generated/graphql.ts';
|
import { UpdateChapterPatchInput } from '@/lib/graphql/generated/graphql.ts';
|
||||||
import { TChapterReader } from '@/modules/chapter/Chapter.types.ts';
|
import { ChapterIdInfo, TChapterReader } from '@/modules/chapter/Chapter.types.ts';
|
||||||
import { ChapterIdInfo, Chapters } from '@/modules/chapter/services/Chapters.ts';
|
import { Chapters } from '@/modules/chapter/services/Chapters.ts';
|
||||||
import { CHAPTER_READER_FIELDS } from '@/lib/graphql/fragments/ChapterFragments.ts';
|
import { CHAPTER_READER_FIELDS } from '@/lib/graphql/fragments/ChapterFragments.ts';
|
||||||
import { isPageOfOutdatedPageLoadStates, isSpreadPage } from '@/modules/reader/utils/ReaderPager.utils.tsx';
|
import { isPageOfOutdatedPageLoadStates, isSpreadPage } from '@/modules/reader/utils/ReaderPager.utils.tsx';
|
||||||
import { ReaderStatePages } from '@/modules/reader/types/ReaderProgressBar.types.ts';
|
import { ReaderStatePages } from '@/modules/reader/types/ReaderProgressBar.types.ts';
|
||||||
|
|||||||
Reference in New Issue
Block a user