diff --git a/.husky/pre-commit b/.husky/pre-commit index 1a1f1f06..e69de29b 100644 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1 +0,0 @@ -yarn lint-staged \ No newline at end of file diff --git a/src/components/manga/MangaActionMenuItems.tsx b/src/components/manga/MangaActionMenuItems.tsx index fe469be4..6705a9d6 100644 --- a/src/components/manga/MangaActionMenuItems.tsx +++ b/src/components/manga/MangaActionMenuItems.tsx @@ -37,7 +37,7 @@ import { import { defaultPromiseErrorHandler } from '@/lib/DefaultPromiseErrorHandler.ts'; import { TrackManga } from '@/components/tracker/TrackManga.tsx'; import { useCategorySelect } from '@/components/navbar/action/useCategorySelect.tsx'; -import { ChaptersDownloadActionMenuItems } from '@/components/chapter/ChaptersDownloadActionMenuItems.tsx'; +import { ChaptersDownloadActionMenuItems } from '@/modules/chapter/components/actions/ChaptersDownloadActionMenuItems.tsx'; import { NestedMenuItem } from '@/modules/core/components/menu/NestedMenuItem.tsx'; import { MangaChapterStatFieldsFragment, MangaType } from '@/lib/graphql/generated/graphql.ts'; diff --git a/src/lib/data/Mangas.ts b/src/lib/data/Mangas.ts index aea6f7f6..14830b7d 100644 --- a/src/lib/data/Mangas.ts +++ b/src/lib/data/Mangas.ts @@ -24,7 +24,7 @@ import { TrackRecordType, UpdateMangaCategoriesPatchInput, } from '@/lib/graphql/generated/graphql.ts'; -import { Chapters } from '@/lib/data/Chapters.ts'; +import { Chapters } from '@/modules/chapter/services/Chapters.ts'; import { makeToast } from '@/lib/ui/Toast.ts'; import { getMetadataServerSettings } from '@/lib/metadata/metadataServerSettings.ts'; import { GET_MANGAS_BASE } from '@/lib/graphql/queries/MangaQuery.ts'; diff --git a/src/lib/metadata/metadata.ts b/src/lib/metadata/metadata.ts index 139ae323..1ac84aaa 100644 --- a/src/lib/metadata/metadata.ts +++ b/src/lib/metadata/metadata.ts @@ -19,7 +19,7 @@ import { requestManager } from '@/lib/requests/requests/RequestManager.ts'; import { MetaType, SourceType } from '@/lib/graphql/generated/graphql.ts'; import { DEFAULT_DEVICE, getActiveDevice } from '@/util/device.ts'; import { CategoryIdInfo } from '@/lib/data/Categories.ts'; -import { ChapterIdInfo } from '@/lib/data/Chapters.ts'; +import { ChapterIdInfo } from '@/modules/chapter/services/Chapters.ts'; import { MangaIdInfo } from '@/lib/data/Mangas.ts'; const APP_METADATA_KEY_PREFIX = 'webUI_'; diff --git a/src/modules/chapter/Chapter.constants.ts b/src/modules/chapter/Chapter.constants.ts new file mode 100644 index 00000000..0ff9586b --- /dev/null +++ b/src/modules/chapter/Chapter.constants.ts @@ -0,0 +1,27 @@ +/* + * Copyright (C) Contributors to the Suwayomi project + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +import { TranslationKey } from '@/Base.types.ts'; +import { ChapterListOptions, ChapterSortMode } from '@/modules/chapter/Chapter.types.ts'; + +export const DEFAULT_CHAPTER_OPTIONS: ChapterListOptions = { + active: false, + unread: undefined, + downloaded: undefined, + bookmarked: undefined, + reverse: true, + sortBy: 'source', + showChapterNumber: false, +}; + +export const CHAPTER_SORT_OPTIONS_TO_TRANSLATION_KEY: Record = { + source: 'global.sort.label.by_source', + chapterNumber: 'global.sort.label.by_chapter_number', + uploadedAt: 'global.sort.label.by_upload_date', + fetchedAt: 'global.sort.label.by_fetch_date', +}; diff --git a/src/modules/chapter/Chapter.types.ts b/src/modules/chapter/Chapter.types.ts new file mode 100644 index 00000000..73beec61 --- /dev/null +++ b/src/modules/chapter/Chapter.types.ts @@ -0,0 +1,27 @@ +/* + * Copyright (C) Contributors to the Suwayomi project + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +import { NullAndUndefined } from '@/Base.types.ts'; + +export type ChapterSortMode = 'fetchedAt' | 'source' | 'chapterNumber' | 'uploadedAt'; + +export interface ChapterListOptions { + active: boolean; + unread: NullAndUndefined; + downloaded: NullAndUndefined; + bookmarked: NullAndUndefined; + reverse: boolean; + sortBy: ChapterSortMode; + showChapterNumber: boolean; +} + +export type ChapterOptionsReducerAction = + | { type: 'filter'; filterType: string; filterValue: NullAndUndefined } + | { type: 'sortBy'; sortBy: ChapterSortMode } + | { type: 'sortReverse' } + | { type: 'showChapterNumber' }; diff --git a/src/components/chapter/ChapterList.tsx b/src/modules/chapter/components/ChapterList.tsx similarity index 93% rename from src/components/chapter/ChapterList.tsx rename to src/modules/chapter/components/ChapterList.tsx index 6eae7b30..c0cca0c7 100644 --- a/src/components/chapter/ChapterList.tsx +++ b/src/modules/chapter/components/ChapterList.tsx @@ -20,11 +20,11 @@ import DoneAllIcon from '@mui/icons-material/DoneAll'; import PopupState, { bindMenu, bindTrigger } from 'material-ui-popup-state'; import Menu from '@mui/material/Menu'; import { requestManager } from '@/lib/requests/requests/RequestManager.ts'; -import { ChapterCard } from '@/components/chapter/ChapterCard.tsx'; +import { ChapterCard } from '@/modules/chapter/components/cards/ChapterCard.tsx'; import { ResumeFab } from '@/components/manga/ResumeFAB.tsx'; -import { filterAndSortChapters, useChapterOptions } from '@/components/chapter/util.tsx'; +import { filterAndSortChapters } from '@/modules/chapter/utils/ChapterList.util.tsx'; import { EmptyViewAbsoluteCentered } from '@/modules/core/components/placeholder/EmptyViewAbsoluteCentered.tsx'; -import { ChaptersToolbarMenu } from '@/components/chapter/ChaptersToolbarMenu.tsx'; +import { ChaptersToolbarMenu } from '@/modules/chapter/components/ChaptersToolbarMenu.tsx'; import { SelectionFAB } from '@/components/collection/SelectionFAB.tsx'; import { DEFAULT_FULL_FAB_HEIGHT } from '@/modules/core/components/buttons/StyledFab.tsx'; import { @@ -34,18 +34,19 @@ import { } from '@/lib/graphql/generated/graphql.ts'; import { useSelectableCollection } from '@/components/collection/useSelectableCollection.ts'; import { SelectableCollectionSelectAll } from '@/components/collection/SelectableCollectionSelectAll.tsx'; -import { Chapters } from '@/lib/data/Chapters.ts'; -import { ChaptersWithMeta, ChapterWithMetaType } from '@/lib/data/ChaptersWithMeta.ts'; -import { ChapterActionMenuItems } from '@/components/chapter/ChapterActionMenuItems.tsx'; -import { ChaptersDownloadActionMenuItems } from '@/components/chapter/ChaptersDownloadActionMenuItems.tsx'; +import { Chapters } from '@/modules/chapter/services/Chapters.ts'; +import { ChaptersWithMeta, ChapterWithMetaType } from '@/modules/chapter/services/ChaptersWithMeta.ts'; +import { ChapterActionMenuItems } from '@/modules/chapter/components/actions/ChapterActionMenuItems.tsx'; +import { ChaptersDownloadActionMenuItems } from '@/modules/chapter/components/actions/ChaptersDownloadActionMenuItems.tsx'; import { defaultPromiseErrorHandler } from '@/lib/DefaultPromiseErrorHandler.ts'; import { LoadingPlaceholder } from '@/modules/core/components/placeholder/LoadingPlaceholder.tsx'; import { GET_CHAPTERS_MANGA } from '@/lib/graphql/queries/ChapterQuery.ts'; -import { Mangas } from '@/lib/data/Mangas'; +import { Mangas } from '@/lib/data/Mangas.ts'; import { useNavBarContext } from '@/components/context/NavbarContext.tsx'; import { useResizeObserver } from '@/modules/core/hooks/useResizeObserver.tsx'; import { MediaQuery } from '@/lib/ui/MediaQuery.tsx'; import { shouldForwardProp } from '@/modules/core/utils/ShouldForwardProp.ts'; +import { useChapterOptions } from '@/modules/chapter/hooks/useChapterOptions.tsx'; type ChapterListHeaderProps = { scrollbarWidth: number; diff --git a/src/components/chapter/ChapterOptions.tsx b/src/modules/chapter/components/ChapterOptions.tsx similarity index 90% rename from src/components/chapter/ChapterOptions.tsx rename to src/modules/chapter/components/ChapterOptions.tsx index 3eb2a82f..a0f5a389 100644 --- a/src/components/chapter/ChapterOptions.tsx +++ b/src/modules/chapter/components/ChapterOptions.tsx @@ -9,13 +9,13 @@ import RadioGroup from '@mui/material/RadioGroup'; import React from 'react'; import { useTranslation } from 'react-i18next'; -import { ChapterListOptions, ChapterOptionsReducerAction } from '@/typings.ts'; import { RadioInput } from '@/modules/core/components/inputs/RadioInput.tsx'; import { SortRadioInput } from '@/modules/core/components/inputs/SortRadioInput.tsx'; import { ThreeStateCheckboxInput } from '@/modules/core/components/inputs/ThreeStateCheckboxInput.tsx'; import { OptionsTabs } from '@/modules/core/components/OptionsTabs.tsx'; -import { SORT_OPTIONS } from '@/components/chapter/util.tsx'; +import { CHAPTER_SORT_OPTIONS_TO_TRANSLATION_KEY } from '@/modules/chapter/Chapter.constants.ts'; import { TranslationKey } from '@/Base.types.ts'; +import { ChapterListOptions, ChapterOptionsReducerAction } from '@/modules/chapter/Chapter.types.ts'; interface IProps { open: boolean; @@ -81,7 +81,7 @@ export const ChapterOptions: React.FC = ({ open, onClose, options, optio ); } if (key === 'sort') { - return Object.entries(SORT_OPTIONS).map(([mode, label]) => ( + return Object.entries(CHAPTER_SORT_OPTIONS_TO_TRANSLATION_KEY).map(([mode, label]) => ( = ({ open, onClose, options, optio sortDescending={options.reverse} onClick={() => mode !== options.sortBy - ? optionsDispatch({ type: 'sortBy', sortBy: mode as keyof typeof SORT_OPTIONS }) + ? optionsDispatch({ + type: 'sortBy', + sortBy: mode as keyof typeof CHAPTER_SORT_OPTIONS_TO_TRANSLATION_KEY, + }) : optionsDispatch({ type: 'sortReverse' }) } /> diff --git a/src/components/chapter/ChaptersToolbarMenu.tsx b/src/modules/chapter/components/ChaptersToolbarMenu.tsx similarity index 87% rename from src/components/chapter/ChaptersToolbarMenu.tsx rename to src/modules/chapter/components/ChaptersToolbarMenu.tsx index e3997c7a..015a33be 100644 --- a/src/components/chapter/ChaptersToolbarMenu.tsx +++ b/src/modules/chapter/components/ChaptersToolbarMenu.tsx @@ -11,9 +11,9 @@ import IconButton from '@mui/material/IconButton'; import Tooltip from '@mui/material/Tooltip'; import * as React from 'react'; import { useTranslation } from 'react-i18next'; -import { ChapterListOptions, ChapterOptionsReducerAction } from '@/typings.ts'; -import { ChapterOptions } from '@/components/chapter/ChapterOptions.tsx'; -import { isFilterActive } from '@/components/chapter/util.tsx'; +import { ChapterOptions } from '@/modules/chapter/components/ChapterOptions.tsx'; +import { isFilterActive } from '@/modules/chapter/utils/ChapterList.util.tsx'; +import { ChapterListOptions, ChapterOptionsReducerAction } from '@/modules/chapter/Chapter.types.ts'; interface IProps { options: ChapterListOptions; diff --git a/src/components/chapter/ChapterActionMenuItems.tsx b/src/modules/chapter/components/actions/ChapterActionMenuItems.tsx similarity index 97% rename from src/components/chapter/ChapterActionMenuItems.tsx rename to src/modules/chapter/components/actions/ChapterActionMenuItems.tsx index cc74951c..7c727212 100644 --- a/src/components/chapter/ChapterActionMenuItems.tsx +++ b/src/modules/chapter/components/actions/ChapterActionMenuItems.tsx @@ -28,10 +28,10 @@ import { ChapterReadInfo, ChapterRealUrlInfo, Chapters, -} from '@/lib/data/Chapters.ts'; +} from '@/modules/chapter/services/Chapters.ts'; import { MenuItem } from '@/modules/core/components/menu/MenuItem.tsx'; -import { IChapterWithMeta } from '@/components/chapter/ChapterList.tsx'; -import { ChaptersWithMeta } from '@/lib/data/ChaptersWithMeta.ts'; +import { IChapterWithMeta } from '@/modules/chapter/components/ChapterList.tsx'; +import { ChaptersWithMeta } from '@/modules/chapter/services/ChaptersWithMeta.ts'; import { createGetMenuItemTitle, createIsMenuItemDisabled, diff --git a/src/components/chapter/ChaptersDownloadActionMenuItems.tsx b/src/modules/chapter/components/actions/ChaptersDownloadActionMenuItems.tsx similarity index 100% rename from src/components/chapter/ChaptersDownloadActionMenuItems.tsx rename to src/modules/chapter/components/actions/ChaptersDownloadActionMenuItems.tsx diff --git a/src/components/chapter/ChapterCard.tsx b/src/modules/chapter/components/cards/ChapterCard.tsx similarity index 97% rename from src/components/chapter/ChapterCard.tsx rename to src/modules/chapter/components/cards/ChapterCard.tsx index 908af3b0..2031773f 100644 --- a/src/components/chapter/ChapterCard.tsx +++ b/src/modules/chapter/components/cards/ChapterCard.tsx @@ -25,7 +25,7 @@ import { useLongPress } from 'use-long-press'; import { getDateString } from '@/util/DateHelper.ts'; import { DownloadStateIndicator } from '@/modules/core/components/DownloadStateIndicator.tsx'; import { ChapterType } from '@/lib/graphql/generated/graphql.ts'; -import { ChapterActionMenuItems } from '@/components/chapter/ChapterActionMenuItems.tsx'; +import { ChapterActionMenuItems } from '@/modules/chapter/components/actions/ChapterActionMenuItems.tsx'; import { Menu } from '@/modules/core/components/menu/Menu.tsx'; import { TypographyMaxLines } from '@/modules/core/components/TypographyMaxLines.tsx'; import { @@ -37,8 +37,8 @@ import { ChapterNumberInfo, ChapterReadInfo, ChapterScanlatorInfo, -} from '@/lib/data/Chapters.ts'; -import { ChaptersWithMeta } from '@/lib/data/ChaptersWithMeta.ts'; +} from '@/modules/chapter/services/Chapters.ts'; +import { ChaptersWithMeta } from '@/modules/chapter/services/ChaptersWithMeta.ts'; type TChapter = ChapterIdInfo & ChapterMangaInfo & diff --git a/src/modules/chapter/hooks/useChapterOptions.tsx b/src/modules/chapter/hooks/useChapterOptions.tsx new file mode 100644 index 00000000..66ffcf6a --- /dev/null +++ b/src/modules/chapter/hooks/useChapterOptions.tsx @@ -0,0 +1,38 @@ +/* + * Copyright (C) Contributors to the Suwayomi project + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +import { t } from 'i18next'; +import { useReducerLocalStorage } from '@/modules/core/hooks/useStorage.tsx'; +import { DEFAULT_CHAPTER_OPTIONS } from '@/modules/chapter/Chapter.constants.ts'; +import { ChapterListOptions, ChapterOptionsReducerAction } from '@/modules/chapter/Chapter.types.ts'; + +function chapterOptionsReducer(state: ChapterListOptions, actions: ChapterOptionsReducerAction): ChapterListOptions { + switch (actions.type) { + case 'filter': + return { + ...state, + active: state.unread !== false && state.downloaded !== false && state.bookmarked !== false, + [actions.filterType!]: actions.filterValue, + }; + case 'sortBy': + return { ...state, sortBy: actions.sortBy }; + case 'sortReverse': + return { ...state, reverse: !state.reverse }; + case 'showChapterNumber': + return { ...state, showChapterNumber: !state.showChapterNumber }; + default: + throw Error(t('global.error.label.invalid_action')); + } +} + +export const useChapterOptions = (mangaId: number) => + useReducerLocalStorage( + chapterOptionsReducer, + `${mangaId}filterOptions`, + DEFAULT_CHAPTER_OPTIONS, + ); diff --git a/src/lib/data/Chapters.ts b/src/modules/chapter/services/Chapters.ts similarity index 100% rename from src/lib/data/Chapters.ts rename to src/modules/chapter/services/Chapters.ts diff --git a/src/lib/data/ChaptersWithMeta.ts b/src/modules/chapter/services/ChaptersWithMeta.ts similarity index 98% rename from src/lib/data/ChaptersWithMeta.ts rename to src/modules/chapter/services/ChaptersWithMeta.ts index 1e3fd460..ca949c3b 100644 --- a/src/lib/data/ChaptersWithMeta.ts +++ b/src/modules/chapter/services/ChaptersWithMeta.ts @@ -12,7 +12,7 @@ import { ChapterDownloadStatus, ChapterReadInfo, Chapters, -} from '@/lib/data/Chapters.ts'; +} from '@/modules/chapter/services/Chapters.ts'; import { DownloadState } from '@/lib/graphql/generated/graphql.ts'; export type ChapterWithMetaType< diff --git a/src/components/chapter/util.tsx b/src/modules/chapter/utils/ChapterList.util.tsx similarity index 63% rename from src/components/chapter/util.tsx rename to src/modules/chapter/utils/ChapterList.util.tsx index 494b713d..3bfde45c 100644 --- a/src/components/chapter/util.tsx +++ b/src/modules/chapter/utils/ChapterList.util.tsx @@ -6,41 +6,10 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -import { t } from 'i18next'; -import { ChapterListOptions, ChapterOptionsReducerAction, ChapterSortMode } from '@/typings.ts'; -import { useReducerLocalStorage } from '@/modules/core/hooks/useStorage.tsx'; -import { ChapterBookmarkInfo, ChapterDownloadInfo, ChapterReadInfo } from '@/lib/data/Chapters.ts'; +import { ChapterBookmarkInfo, ChapterDownloadInfo, ChapterReadInfo } from '@/modules/chapter/services/Chapters.ts'; import { ChapterType } from '@/lib/graphql/generated/graphql.ts'; -import { NullAndUndefined, TranslationKey } from '@/Base.types.ts'; - -const defaultChapterOptions: ChapterListOptions = { - active: false, - unread: undefined, - downloaded: undefined, - bookmarked: undefined, - reverse: true, - sortBy: 'source', - showChapterNumber: false, -}; - -function chapterOptionsReducer(state: ChapterListOptions, actions: ChapterOptionsReducerAction): ChapterListOptions { - switch (actions.type) { - case 'filter': - return { - ...state, - active: state.unread !== false && state.downloaded !== false && state.bookmarked !== false, - [actions.filterType!]: actions.filterValue, - }; - case 'sortBy': - return { ...state, sortBy: actions.sortBy }; - case 'sortReverse': - return { ...state, reverse: !state.reverse }; - case 'showChapterNumber': - return { ...state, showChapterNumber: !state.showChapterNumber }; - default: - throw Error(t('global.error.label.invalid_action')); - } -} +import { NullAndUndefined } from '@/Base.types.ts'; +import { ChapterListOptions } from '@/modules/chapter/Chapter.types.ts'; export function unreadFilter(unread: NullAndUndefined, { isRead: isChapterRead }: ChapterReadInfo) { switch (unread) { @@ -126,20 +95,6 @@ export function filterAndSortChapters( return sortChapters(filtered, options); } -export const useChapterOptions = (mangaId: number) => - useReducerLocalStorage( - chapterOptionsReducer, - `${mangaId}filterOptions`, - defaultChapterOptions, - ); - -export const SORT_OPTIONS: Record = { - source: 'global.sort.label.by_source', - chapterNumber: 'global.sort.label.by_chapter_number', - uploadedAt: 'global.sort.label.by_upload_date', - fetchedAt: 'global.sort.label.by_fetch_date', -}; - export const isFilterActive = (options: ChapterListOptions) => { const { unread, downloaded, bookmarked } = options; return unread != null || downloaded != null || bookmarked != null; diff --git a/src/modules/core/components/DownloadStateIndicator.tsx b/src/modules/core/components/DownloadStateIndicator.tsx index 8e387ec0..c3894895 100644 --- a/src/modules/core/components/DownloadStateIndicator.tsx +++ b/src/modules/core/components/DownloadStateIndicator.tsx @@ -11,7 +11,7 @@ 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 { ChapterDownloadStatus } from '@/lib/data/Chapters.ts'; +import { ChapterDownloadStatus } from '@/modules/chapter/services/Chapters.ts'; import { TranslationKey } from '@/Base.types.ts'; const DOWNLOAD_STATE_TO_TRANSLATION_KEY_MAP: { [state in DownloadState]: TranslationKey } = { diff --git a/src/screens/DownloadQueue.tsx b/src/screens/DownloadQueue.tsx index c1977d22..bd4d391a 100644 --- a/src/screens/DownloadQueue.tsx +++ b/src/screens/DownloadQueue.tsx @@ -33,7 +33,7 @@ import { EmptyViewAbsoluteCentered } from '@/modules/core/components/placeholder import { NavBarContext } from '@/components/context/NavbarContext.tsx'; import { LoadingPlaceholder } from '@/modules/core/components/placeholder/LoadingPlaceholder.tsx'; import { defaultPromiseErrorHandler } from '@/lib/DefaultPromiseErrorHandler.ts'; -import { ChapterDownloadStatus, ChapterIdInfo } from '@/lib/data/Chapters.ts'; +import { ChapterDownloadStatus, ChapterIdInfo } from '@/modules/chapter/services/Chapters.ts'; import { DownloadState } from '@/lib/graphql/generated/graphql.ts'; const HeightPreservingItem = ({ children, ...props }: BoxProps) => ( diff --git a/src/screens/Manga.tsx b/src/screens/Manga.tsx index faa9f3bd..1bcbf620 100644 --- a/src/screens/Manga.tsx +++ b/src/screens/Manga.tsx @@ -18,7 +18,7 @@ import { useParams } from 'react-router-dom'; import { isNetworkRequestInFlight } from '@apollo/client/core/networkStatus'; import { requestManager } from '@/lib/requests/requests/RequestManager.ts'; import { NavBarContext } from '@/components/context/NavbarContext'; -import { ChapterList } from '@/components/chapter/ChapterList.tsx'; +import { ChapterList } from '@/modules/chapter/components/ChapterList.tsx'; import { useRefreshManga } from '@/components/manga/useRefreshManga.ts'; import { MangaDetails } from '@/components/manga/MangaDetails'; import { MangaToolbarMenu } from '@/components/manga/MangaToolbarMenu'; diff --git a/src/screens/Reader.tsx b/src/screens/Reader.tsx index 4ae0fa49..873a2774 100644 --- a/src/screens/Reader.tsx +++ b/src/screens/Reader.tsx @@ -36,7 +36,7 @@ import { } from '@/lib/graphql/generated/graphql.ts'; import { useMetadataServerSettings } from '@/lib/metadata/metadataServerSettings.ts'; import { defaultPromiseErrorHandler } from '@/lib/DefaultPromiseErrorHandler.ts'; -import { ChapterIdInfo, Chapters } from '@/lib/data/Chapters.ts'; +import { ChapterIdInfo, Chapters } from '@/modules/chapter/services/Chapters.ts'; import { EmptyViewAbsoluteCentered } from '@/modules/core/components/placeholder/EmptyViewAbsoluteCentered.tsx'; import { GET_CHAPTERS_READER } from '@/lib/graphql/queries/ChapterQuery.ts'; import { GET_MANGA_READER } from '@/lib/graphql/queries/MangaQuery.ts'; diff --git a/src/screens/Updates.tsx b/src/screens/Updates.tsx index b0b0bd3e..1449d7dd 100644 --- a/src/screens/Updates.tsx +++ b/src/screens/Updates.tsx @@ -34,7 +34,7 @@ import { SpinnerImage } from '@/modules/core/components/SpinnerImage.tsx'; import { dateTimeFormatter, epochToDate, getDateString } from '@/util/DateHelper.ts'; import { defaultPromiseErrorHandler } from '@/lib/DefaultPromiseErrorHandler.ts'; import { TypographyMaxLines } from '@/modules/core/components/TypographyMaxLines.tsx'; -import { ChapterIdInfo, ChapterMangaInfo } from '@/lib/data/Chapters.ts'; +import { ChapterIdInfo, ChapterMangaInfo } from '@/modules/chapter/services/Chapters.ts'; import { makeToast } from '@/lib/ui/Toast.ts'; const groupByDate = (updates: Pick[]): [date: string, items: number][] => { diff --git a/src/typings.ts b/src/typings.ts index e0a32068..116eb447 100644 --- a/src/typings.ts +++ b/src/typings.ts @@ -227,24 +227,6 @@ export interface NavbarItem { show: 'mobile' | 'desktop' | 'both'; } -export type ChapterSortMode = 'fetchedAt' | 'source' | 'chapterNumber' | 'uploadedAt'; - -export interface ChapterListOptions { - active: boolean; - unread: NullAndUndefined; - downloaded: NullAndUndefined; - bookmarked: NullAndUndefined; - reverse: boolean; - sortBy: ChapterSortMode; - showChapterNumber: boolean; -} - -export type ChapterOptionsReducerAction = - | { type: 'filter'; filterType: string; filterValue: NullAndUndefined } - | { type: 'sortBy'; sortBy: ChapterSortMode } - | { type: 'sortReverse' } - | { type: 'showChapterNumber' }; - export type LibrarySortMode = | 'unreadChapters' | 'totalChapters'