diff --git a/src/modules/chapter/Chapter.constants.ts b/src/modules/chapter/Chapter.constants.ts index 8d78547f..22d75713 100644 --- a/src/modules/chapter/Chapter.constants.ts +++ b/src/modules/chapter/Chapter.constants.ts @@ -7,7 +7,7 @@ */ 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 }; @@ -26,3 +26,63 @@ export const CHAPTER_SORT_OPTIONS_TO_TRANSLATION_KEY: Record; + +export type ChapterMangaInfo = Pick; + +export type ChapterDownloadInfo = ChapterIdInfo & Pick; + +export type ChapterBookmarkInfo = ChapterIdInfo & Pick; + +export type ChapterReadInfo = ChapterIdInfo & Pick; + +export type ChapterNumberInfo = ChapterIdInfo & Pick; + +export type ChapterSourceOrderInfo = ChapterIdInfo & Pick; + +export type ChapterScanlatorInfo = ChapterIdInfo & Pick; + +export type ChapterRealUrlInfo = Pick; diff --git a/src/modules/chapter/components/actions/ChapterActionMenuItems.tsx b/src/modules/chapter/components/actions/ChapterActionMenuItems.tsx index fe39ac00..d18fc9fb 100644 --- a/src/modules/chapter/components/actions/ChapterActionMenuItems.tsx +++ b/src/modules/chapter/components/actions/ChapterActionMenuItems.tsx @@ -18,17 +18,7 @@ import DoneAll from '@mui/icons-material/DoneAll'; import { ComponentProps, useMemo } from 'react'; import LaunchIcon from '@mui/icons-material/Launch'; import { SelectableCollectionReturnType } from '@/modules/collection/hooks/useSelectableCollection.ts'; -import { - CHAPTER_ACTION_TO_TRANSLATION, - ChapterAction, - ChapterBookmarkInfo, - ChapterDownloadInfo, - ChapterIdInfo, - ChapterMangaInfo, - ChapterReadInfo, - ChapterRealUrlInfo, - Chapters, -} from '@/modules/chapter/services/Chapters.ts'; +import { Chapters } from '@/modules/chapter/services/Chapters.ts'; import { MenuItem } from '@/modules/core/components/menu/MenuItem.tsx'; import { createGetMenuItemTitle, @@ -41,6 +31,16 @@ import { ChapterCard } from '@/modules/chapter/components/cards/ChapterCard.tsx' import { requestManager } from '@/lib/requests/RequestManager.ts'; import { GetChaptersMangaQuery } from '@/lib/graphql/generated/graphql.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 }; diff --git a/src/modules/chapter/components/buttons/ChapterDownloadButton.tsx b/src/modules/chapter/components/buttons/ChapterDownloadButton.tsx index 207ac016..f123eb40 100644 --- a/src/modules/chapter/components/buttons/ChapterDownloadButton.tsx +++ b/src/modules/chapter/components/buttons/ChapterDownloadButton.tsx @@ -10,11 +10,12 @@ import IconButton from '@mui/material/IconButton'; import { useTranslation } from 'react-i18next'; import DownloadIcon from '@mui/icons-material/Download'; 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 { makeToast } from '@/modules/core/utils/Toast.ts'; import { getErrorMessage } from '@/lib/HelperFunctions.ts'; import { MUIUtil } from '@/lib/mui/MUI.util.ts'; +import { ChapterIdInfo } from '@/modules/chapter/Chapter.types.ts'; export const ChapterDownloadButton = ({ chapterId, diff --git a/src/modules/chapter/components/buttons/ChapterDownloadRetryButton.tsx b/src/modules/chapter/components/buttons/ChapterDownloadRetryButton.tsx index eea48598..b785ab19 100644 --- a/src/modules/chapter/components/buttons/ChapterDownloadRetryButton.tsx +++ b/src/modules/chapter/components/buttons/ChapterDownloadRetryButton.tsx @@ -11,11 +11,12 @@ import IconButton from '@mui/material/IconButton'; import { useTranslation } from 'react-i18next'; import { DownloadState } from '@/lib/graphql/generated/graphql.ts'; 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 { makeToast } from '@/modules/core/utils/Toast.ts'; import { getErrorMessage } from '@/lib/HelperFunctions.ts'; import { MUIUtil } from '@/lib/mui/MUI.util.ts'; +import { ChapterIdInfo } from '@/modules/chapter/Chapter.types.ts'; export const ChapterDownloadRetryButton = ({ chapterId }: { chapterId: ChapterIdInfo['id'] }) => { const { t } = useTranslation(); diff --git a/src/modules/chapter/components/cards/ChapterCard.tsx b/src/modules/chapter/components/cards/ChapterCard.tsx index af3e3f44..34564dc1 100644 --- a/src/modules/chapter/components/cards/ChapterCard.tsx +++ b/src/modules/chapter/components/cards/ChapterCard.tsx @@ -25,6 +25,11 @@ import { DownloadStateIndicator } from '@/modules/core/components/downloads/Down import { ChapterType } from '@/lib/graphql/generated/graphql.ts'; import { ChapterActionMenuItems } from '@/modules/chapter/components/actions/ChapterActionMenuItems.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 { ChapterBookmarkInfo, ChapterDownloadInfo, @@ -32,13 +37,8 @@ import { ChapterMangaInfo, ChapterNumberInfo, ChapterReadInfo, - Chapters, ChapterScanlatorInfo, -} 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'; +} from '@/modules/chapter/Chapter.types.ts'; type TChapter = ChapterIdInfo & ChapterMangaInfo & diff --git a/src/modules/chapter/services/Chapters.ts b/src/modules/chapter/services/Chapters.ts index ceb44af7..8799d388 100644 --- a/src/modules/chapter/services/Chapters.ts +++ b/src/modules/chapter/services/Chapters.ts @@ -15,92 +15,28 @@ import { ChapterListFieldsFragment, ChapterType, DownloadState, - DownloadStatusFieldsFragment, DownloadTypeFieldsFragment, } from '@/lib/graphql/generated/graphql.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 { ReaderOpenChapterLocationState, ReaderResumeMode } from '@/modules/reader/types/Reader.types.ts'; import { AppRoutes } from '@/modules/core/AppRoute.constants.ts'; import { getErrorMessage } from '@/lib/HelperFunctions.ts'; import { DOWNLOAD_TYPE_FIELDS } from '@/lib/graphql/fragments/DownloadFragments.ts'; import { epochToDate, getDateString } from '@/util/DateHelper.ts'; - -export type ChapterAction = 'download' | 'delete' | 'bookmark' | 'unbookmark' | 'mark_as_read' | 'mark_as_unread'; - -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', - }, -}; - -export type ChapterDownloadStatus = DownloadStatusFieldsFragment['queue'][number]; - -export type ChapterIdInfo = Pick; -export type ChapterMangaInfo = Pick; -export type ChapterDownloadInfo = ChapterIdInfo & Pick; -export type ChapterBookmarkInfo = ChapterIdInfo & Pick; -export type ChapterReadInfo = ChapterIdInfo & Pick; -export type ChapterNumberInfo = ChapterIdInfo & Pick; -export type ChapterSourceOrderInfo = ChapterIdInfo & Pick; -export type ChapterScanlatorInfo = ChapterIdInfo & Pick; -export type ChapterRealUrlInfo = Pick; +import { CHAPTER_ACTION_TO_TRANSLATION } from '@/modules/chapter/Chapter.constants.ts'; +import { + ChapterAction, + ChapterBookmarkInfo, + ChapterDownloadInfo, + ChapterMangaInfo, + ChapterNumberInfo, + ChapterReadInfo, + ChapterScanlatorInfo, + ChapterSourceOrderInfo, +} from '@/modules/chapter/Chapter.types.ts'; export class Chapters { static getIds(chapters: { id: number }[]): number[] { diff --git a/src/modules/chapter/utils/ChapterList.util.tsx b/src/modules/chapter/utils/ChapterList.util.tsx index 74cd1403..0ae86f0d 100644 --- a/src/modules/chapter/utils/ChapterList.util.tsx +++ b/src/modules/chapter/utils/ChapterList.util.tsx @@ -7,10 +7,14 @@ */ import { useMemo } from 'react'; -import { ChapterBookmarkInfo, ChapterDownloadInfo, ChapterReadInfo } from '@/modules/chapter/services/Chapters.ts'; import { ChapterType } from '@/lib/graphql/generated/graphql.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 { GqlMetaHolder } from '@/modules/metadata/Metadata.types.ts'; import { createUpdateMangaMetadata, useGetMangaMetadata } from '@/modules/manga/services/MangaMetadata.ts'; diff --git a/src/modules/core/AppRoute.constants.ts b/src/modules/core/AppRoute.constants.ts index 1797e29b..3a3559fd 100644 --- a/src/modules/core/AppRoute.constants.ts +++ b/src/modules/core/AppRoute.constants.ts @@ -8,7 +8,8 @@ import { SourceType } from '@/lib/graphql/generated/graphql.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 = { match: string; diff --git a/src/modules/core/components/downloads/DownloadStateIndicator.tsx b/src/modules/core/components/downloads/DownloadStateIndicator.tsx index 09a062af..f8799c33 100644 --- a/src/modules/core/components/downloads/DownloadStateIndicator.tsx +++ b/src/modules/core/components/downloads/DownloadStateIndicator.tsx @@ -11,8 +11,9 @@ import Box from '@mui/material/Box'; import Typography from '@mui/material/Typography'; import { useTranslation } from 'react-i18next'; 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 { ChapterIdInfo } from '@/modules/chapter/Chapter.types.ts'; const DOWNLOAD_STATE_TO_TRANSLATION_KEY_MAP: { [state in DownloadState]: TranslationKey } = { DOWNLOADING: 'download.state.label.downloading', diff --git a/src/modules/downloads/components/DownloadQueueChapterCard.tsx b/src/modules/downloads/components/DownloadQueueChapterCard.tsx index afb17dda..0e590856 100644 --- a/src/modules/downloads/components/DownloadQueueChapterCard.tsx +++ b/src/modules/downloads/components/DownloadQueueChapterCard.tsx @@ -27,7 +27,7 @@ import { getErrorMessage } from '@/lib/HelperFunctions.ts'; import { makeToast } from '@/modules/core/utils/Toast.ts'; import { requestManager } from '@/lib/requests/RequestManager.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( ({ item, status }: { item: ChapterDownloadStatus; status: DownloaderState }) => { diff --git a/src/modules/downloads/screens/DownloadQueue.tsx b/src/modules/downloads/screens/DownloadQueue.tsx index 33c0a7d4..b4ebeda5 100644 --- a/src/modules/downloads/screens/DownloadQueue.tsx +++ b/src/modules/downloads/screens/DownloadQueue.tsx @@ -23,7 +23,6 @@ import { makeToast } from '@/modules/core/utils/Toast.ts'; import { EmptyViewAbsoluteCentered } from '@/modules/core/components/feedback/EmptyViewAbsoluteCentered.tsx'; import { LoadingPlaceholder } from '@/modules/core/components/feedback/LoadingPlaceholder.tsx'; import { defaultPromiseErrorHandler } from '@/lib/DefaultPromiseErrorHandler.ts'; -import { ChapterDownloadStatus } from '@/modules/chapter/services/Chapters.ts'; import { DownloaderState } from '@/lib/graphql/generated/graphql.ts'; import { getErrorMessage } from '@/lib/HelperFunctions.ts'; 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 { useAppTitle } from '@/modules/navigation-bar/hooks/useAppTitle.ts'; import { useAppAction } from '@/modules/navigation-bar/hooks/useAppAction.ts'; +import { ChapterDownloadStatus } from '@/modules/chapter/Chapter.types.ts'; export const DownloadQueue: React.FC = () => { const { t } = useTranslation(); diff --git a/src/modules/manga/components/ContinueReadingButton.tsx b/src/modules/manga/components/ContinueReadingButton.tsx index 8a7943a9..260f68b8 100644 --- a/src/modules/manga/components/ContinueReadingButton.tsx +++ b/src/modules/manga/components/ContinueReadingButton.tsx @@ -11,8 +11,9 @@ import Button from '@mui/material/Button'; import PlayArrowIcon from '@mui/icons-material/PlayArrow'; import { Link } from 'react-router-dom'; 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 { ChapterReadInfo, ChapterSourceOrderInfo } from '@/modules/chapter/Chapter.types.ts'; export const ContinueReadingButton = ({ showContinueReadingButton, diff --git a/src/modules/manga/components/ResumeFAB.tsx b/src/modules/manga/components/ResumeFAB.tsx index d2b03fef..bd83e60e 100644 --- a/src/modules/manga/components/ResumeFAB.tsx +++ b/src/modules/manga/components/ResumeFAB.tsx @@ -10,12 +10,8 @@ import { Link } from 'react-router-dom'; import PlayArrow from '@mui/icons-material/PlayArrow'; import { useTranslation } from 'react-i18next'; import { StyledFab } from '@/modules/core/components/buttons/StyledFab.tsx'; -import { - ChapterMangaInfo, - ChapterReadInfo, - Chapters, - ChapterSourceOrderInfo, -} from '@/modules/chapter/services/Chapters.ts'; +import { Chapters } from '@/modules/chapter/services/Chapters.ts'; +import { ChapterMangaInfo, ChapterReadInfo, ChapterSourceOrderInfo } from '@/modules/chapter/Chapter.types.ts'; export function ResumeFab({ chapter }: { chapter: ChapterMangaInfo & ChapterSourceOrderInfo & ChapterReadInfo }) { const { t } = useTranslation(); diff --git a/src/modules/metadata/services/MetadataMigrations.ts b/src/modules/metadata/services/MetadataMigrations.ts index a2899d06..640d024f 100644 --- a/src/modules/metadata/services/MetadataMigrations.ts +++ b/src/modules/metadata/services/MetadataMigrations.ts @@ -22,11 +22,11 @@ import { } from '@/modules/metadata/Metadata.types.ts'; import { extractOriginalKey, getMetadataKey } from '@/modules/metadata/Metadata.utils.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 { defaultPromiseErrorHandler } from '@/lib/DefaultPromiseErrorHandler.ts'; import { getMetadataDeleteFunction, getMetadataUpdateFunction } from '@/modules/metadata/services/MetadataUpdater.ts'; import { SourceIdInfo } from '@/modules/source/Source.types.ts'; +import { ChapterIdInfo } from '@/modules/chapter/Chapter.types.ts'; const getAppKeyPrefixForMigration = (migrationId: number): string => { const appKeyPrefix = METADATA_MIGRATIONS.slice(0, migrationId) diff --git a/src/modules/metadata/services/MetadataReader.ts b/src/modules/metadata/services/MetadataReader.ts index a4cbfe1e..6b9510c9 100644 --- a/src/modules/metadata/services/MetadataReader.ts +++ b/src/modules/metadata/services/MetadataReader.ts @@ -17,11 +17,11 @@ import { } from '@/modules/metadata/Metadata.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 { doesMetadataKeyExistIn, getMetadataKey } from '@/modules/metadata/Metadata.utils.ts'; import { applyMetadataMigrations } from '@/modules/metadata/services/MetadataMigrations.ts'; import { SourceIdInfo } from '@/modules/source/Source.types.ts'; +import { ChapterIdInfo } from '@/modules/chapter/Chapter.types.ts'; const getMetadataValueFrom = ( metadata: Metadata | undefined, diff --git a/src/modules/metadata/services/MetadataUpdater.ts b/src/modules/metadata/services/MetadataUpdater.ts index d5705eeb..00b3d00e 100644 --- a/src/modules/metadata/services/MetadataUpdater.ts +++ b/src/modules/metadata/services/MetadataUpdater.ts @@ -7,7 +7,6 @@ */ import { requestManager } from '@/lib/requests/RequestManager.ts'; -import { ChapterIdInfo } from '@/modules/chapter/services/Chapters.ts'; import { CategoryIdInfo } from '@/modules/category/Category.types.ts'; import { AllowedMetadataValueTypes, @@ -21,6 +20,7 @@ import { MangaIdInfo } from '@/modules/manga/Manga.types.ts'; import { getMetadataKey } from '@/modules/metadata/Metadata.utils.ts'; import { convertToGqlMeta } from '@/modules/metadata/services/MetadataConverter.ts'; import { SourceIdInfo } from '@/modules/source/Source.types.ts'; +import { ChapterIdInfo } from '@/modules/chapter/Chapter.types.ts'; const requestUpdateMetadataValue = async ( metadataHolder: GqlMetaHolder, diff --git a/src/modules/reader/components/overlay/navigation/ReaderBookmarkButton.tsx b/src/modules/reader/components/overlay/navigation/ReaderBookmarkButton.tsx index 6fa7986a..d5923815 100644 --- a/src/modules/reader/components/overlay/navigation/ReaderBookmarkButton.tsx +++ b/src/modules/reader/components/overlay/navigation/ReaderBookmarkButton.tsx @@ -12,8 +12,9 @@ import { memo } from 'react'; import BookmarkIcon from '@mui/icons-material/Bookmark'; import BookmarkBorderIcon from '@mui/icons-material/BookmarkBorder'; import { CustomTooltip } from '@/modules/core/components/CustomTooltip.tsx'; -import { CHAPTER_ACTION_TO_TRANSLATION, ChapterAction, Chapters } from '@/modules/chapter/services/Chapters.ts'; -import { TChapterReader } from '@/modules/chapter/Chapter.types.ts'; +import { Chapters } from '@/modules/chapter/services/Chapters.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) => { const { t } = useTranslation(); diff --git a/src/modules/reader/components/overlay/navigation/desktop/ReaderNavBarDesktopActions.tsx b/src/modules/reader/components/overlay/navigation/desktop/ReaderNavBarDesktopActions.tsx index 7db0e18e..307bf10f 100644 --- a/src/modules/reader/components/overlay/navigation/desktop/ReaderNavBarDesktopActions.tsx +++ b/src/modules/reader/components/overlay/navigation/desktop/ReaderNavBarDesktopActions.tsx @@ -15,7 +15,7 @@ import ReplayIcon from '@mui/icons-material/Replay'; import { memo, useMemo, useRef } from 'react'; import DeleteIcon from '@mui/icons-material/Delete'; 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 { DownloadStateIndicator } from '@/modules/core/components/downloads/DownloadStateIndicator.tsx'; 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 { ReaderLibraryButton } from '@/modules/reader/components/overlay/navigation/ReaderLibraryButton.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>) => { const { t } = useTranslation(); diff --git a/src/modules/reader/components/viewer/ReaderChapterViewer.tsx b/src/modules/reader/components/viewer/ReaderChapterViewer.tsx index e219e2fa..9cf5ab32 100644 --- a/src/modules/reader/components/viewer/ReaderChapterViewer.tsx +++ b/src/modules/reader/components/viewer/ReaderChapterViewer.tsx @@ -37,7 +37,6 @@ import { import { useReaderConvertPagesForReadingMode } from '@/modules/reader/hooks/useReaderConvertPagesForReadingMode.ts'; import { ReaderTransitionPage } from '@/modules/reader/components/viewer/ReaderTransitionPage.tsx'; 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 { requestManager } from '@/lib/requests/RequestManager.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 { ReaderInfiniteScrollUpdateChapter } from '@/modules/reader/components/viewer/ReaderInfiniteScrollUpdateChapter.tsx'; import { useResizeObserver } from '@/modules/core/hooks/useResizeObserver.tsx'; +import { ChapterIdInfo } from '@/modules/chapter/Chapter.types.ts'; const BaseReaderChapterViewer = ({ currentPageIndex, diff --git a/src/modules/reader/components/viewer/ReaderInfiniteScrollUpdateChapter.tsx b/src/modules/reader/components/viewer/ReaderInfiniteScrollUpdateChapter.tsx index 25be6f46..f4046302 100644 --- a/src/modules/reader/components/viewer/ReaderInfiniteScrollUpdateChapter.tsx +++ b/src/modules/reader/components/viewer/ReaderInfiniteScrollUpdateChapter.tsx @@ -11,8 +11,8 @@ import { withPropsFrom } from '@/modules/core/hoc/withPropsFrom.tsx'; import { useReaderInfiniteScrollUpdateChapter } from '@/modules/reader/hooks/useReaderInfiniteScrollUpdateChapter.ts'; import { IReaderSettings, TReaderScrollbarContext } from '@/modules/reader/types/Reader.types.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 { ChapterIdInfo } from '@/modules/chapter/Chapter.types.ts'; const BaseReaderInfiniteScrollUpdateChapter = ({ readingMode, diff --git a/src/modules/reader/components/viewer/ReaderTransitionPage.tsx b/src/modules/reader/components/viewer/ReaderTransitionPage.tsx index 4f22f33c..369a4243 100644 --- a/src/modules/reader/components/viewer/ReaderTransitionPage.tsx +++ b/src/modules/reader/components/viewer/ReaderTransitionPage.tsx @@ -15,7 +15,6 @@ import { ComponentProps, memo, useMemo } from 'react'; import { alpha, useTheme } from '@mui/material/styles'; import { useReaderScrollbarContext } from '@/modules/reader/contexts/ReaderScrollbarContext.tsx'; import { useReaderStateChaptersContext } from '@/modules/reader/contexts/state/ReaderStateChaptersContext.tsx'; -import { ChapterIdInfo } from '@/modules/chapter/services/Chapters.ts'; import { IReaderSettings, ReaderTransitionPageMode, @@ -41,6 +40,7 @@ import { ReaderService } from '@/modules/reader/services/ReaderService.ts'; import { ReaderStatePages } from '@/modules/reader/types/ReaderProgressBar.types.ts'; import { userReaderStatePagesContext } from '@/modules/reader/contexts/state/ReaderStatePagesContext.tsx'; import { ChapterType } from '@/lib/graphql/generated/graphql.ts'; +import { ChapterIdInfo } from '@/modules/chapter/Chapter.types.ts'; const ChapterInfo = ({ title, diff --git a/src/modules/reader/components/viewer/ReaderViewer.tsx b/src/modules/reader/components/viewer/ReaderViewer.tsx index 0f0fae22..1d03b493 100644 --- a/src/modules/reader/components/viewer/ReaderViewer.tsx +++ b/src/modules/reader/components/viewer/ReaderViewer.tsx @@ -67,7 +67,8 @@ import { coerceIn, noOp } from '@/lib/HelperFunctions.ts'; import { useNavBarContext } from '@/modules/navigation-bar/contexts/NavbarContext.tsx'; import { NavbarContextType } from '@/modules/navigation-bar/NavigationBar.types.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.SINGLE_PAGE]: PageInViewportType.X, diff --git a/src/modules/reader/hooks/useReaderPreserveScrollPosition.ts b/src/modules/reader/hooks/useReaderPreserveScrollPosition.ts index d5751906..5bd4f7ae 100644 --- a/src/modules/reader/hooks/useReaderPreserveScrollPosition.ts +++ b/src/modules/reader/hooks/useReaderPreserveScrollPosition.ts @@ -22,8 +22,7 @@ import { isReaderWidthEditable, } from '@/modules/reader/utils/ReaderSettings.utils.tsx'; import { getPreviousNextChapterVisibility } from '@/modules/reader/utils/Reader.utils.ts'; -import { ChapterIdInfo } from '@/modules/chapter/services/Chapters.ts'; -import { TChapterReader } from '@/modules/chapter/Chapter.types.ts'; +import { ChapterIdInfo, TChapterReader } from '@/modules/chapter/Chapter.types.ts'; const shouldPreserveOnResizeChange = ( readingMode: ReadingMode, diff --git a/src/modules/reader/services/ReaderControls.ts b/src/modules/reader/services/ReaderControls.ts index a73504f2..c892418c 100644 --- a/src/modules/reader/services/ReaderControls.ts +++ b/src/modules/reader/services/ReaderControls.ts @@ -48,10 +48,10 @@ import { getReaderOpenChapterResumeMode, updateReaderStateVisibleChapters, } 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 { 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 { defaultPromiseErrorHandler } from '@/lib/DefaultPromiseErrorHandler.ts'; import { TReaderOverlayContext } from '@/modules/reader/types/ReaderOverlay.types.ts'; diff --git a/src/modules/reader/services/ReaderService.ts b/src/modules/reader/services/ReaderService.ts index 73d54374..163ef3bd 100644 --- a/src/modules/reader/services/ReaderService.ts +++ b/src/modules/reader/services/ReaderService.ts @@ -10,8 +10,8 @@ import { useCallback, useMemo } from 'react'; import { useNavigate } from 'react-router-dom'; import { Direction, useTheme } from '@mui/material/styles'; import { t as translate } from 'i18next'; -import { TChapterReader } from '@/modules/chapter/Chapter.types.ts'; -import { ChapterIdInfo, Chapters } from '@/modules/chapter/services/Chapters.ts'; +import { ChapterIdInfo, TChapterReader } from '@/modules/chapter/Chapter.types.ts'; +import { Chapters } from '@/modules/chapter/services/Chapters.ts'; import { IReaderSettings, IReaderSettingsWithDefaultFlag, diff --git a/src/modules/reader/utils/Reader.utils.ts b/src/modules/reader/utils/Reader.utils.ts index c30010b8..5ed837ab 100644 --- a/src/modules/reader/utils/Reader.utils.ts +++ b/src/modules/reader/utils/Reader.utils.ts @@ -13,8 +13,8 @@ import { ReadingMode, } from '@/modules/reader/types/Reader.types.ts'; import { UpdateChapterPatchInput } from '@/lib/graphql/generated/graphql.ts'; -import { TChapterReader } from '@/modules/chapter/Chapter.types.ts'; -import { ChapterIdInfo, Chapters } from '@/modules/chapter/services/Chapters.ts'; +import { ChapterIdInfo, TChapterReader } from '@/modules/chapter/Chapter.types.ts'; +import { Chapters } from '@/modules/chapter/services/Chapters.ts'; import { CHAPTER_READER_FIELDS } from '@/lib/graphql/fragments/ChapterFragments.ts'; import { isPageOfOutdatedPageLoadStates, isSpreadPage } from '@/modules/reader/utils/ReaderPager.utils.tsx'; import { ReaderStatePages } from '@/modules/reader/types/ReaderProgressBar.types.ts';