Move category files into new folder
This commit is contained in:
@@ -31,7 +31,10 @@ const { SearchAll } = loadable(() => import('@/screens/SearchAll'), lazyLoadFall
|
|||||||
const { Settings } = loadable(() => import('@/screens/Settings'), lazyLoadFallback);
|
const { Settings } = loadable(() => import('@/screens/Settings'), lazyLoadFallback);
|
||||||
const { About } = loadable(() => import('@/screens/settings/About'), lazyLoadFallback);
|
const { About } = loadable(() => import('@/screens/settings/About'), lazyLoadFallback);
|
||||||
const { Backup } = loadable(() => import('@/screens/settings/Backup'), lazyLoadFallback);
|
const { Backup } = loadable(() => import('@/screens/settings/Backup'), lazyLoadFallback);
|
||||||
const { Categories } = loadable(() => import('@/screens/settings/Categories'), lazyLoadFallback);
|
const { CategorySettings } = loadable(
|
||||||
|
() => import('@/modules/category/screens/CategorySettings.tsx'),
|
||||||
|
lazyLoadFallback,
|
||||||
|
);
|
||||||
const { DefaultReaderSettings } = loadable(
|
const { DefaultReaderSettings } = loadable(
|
||||||
() => import('@/modules/reader/screens/DefaultReaderSettings.tsx'),
|
() => import('@/modules/reader/screens/DefaultReaderSettings.tsx'),
|
||||||
lazyLoadFallback,
|
lazyLoadFallback,
|
||||||
@@ -112,7 +115,7 @@ const MainApp = () => {
|
|||||||
<Route path="settings">
|
<Route path="settings">
|
||||||
<Route index element={<Settings />} />
|
<Route index element={<Settings />} />
|
||||||
<Route path="about" element={<About />} />
|
<Route path="about" element={<About />} />
|
||||||
<Route path="categories" element={<Categories />} />
|
<Route path="categories" element={<CategorySettings />} />
|
||||||
<Route path="defaultReaderSettings" element={<DefaultReaderSettings />} />
|
<Route path="defaultReaderSettings" element={<DefaultReaderSettings />} />
|
||||||
<Route path="librarySettings">
|
<Route path="librarySettings">
|
||||||
<Route index element={<LibrarySettings />} />
|
<Route index element={<LibrarySettings />} />
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import Switch from '@mui/material/Switch';
|
|||||||
import {
|
import {
|
||||||
CategoriesInclusionSetting,
|
CategoriesInclusionSetting,
|
||||||
CategoriesInclusionSettingProps,
|
CategoriesInclusionSettingProps,
|
||||||
} from '@/components/settings/CategoriesInclusionSetting.tsx';
|
} from '@/modules/category/components/CategoriesInclusionSetting.tsx';
|
||||||
import { GlobalUpdateSettingsEntries } from '@/components/settings/globalUpdate/GlobalUpdateSettingsEntries.tsx';
|
import { GlobalUpdateSettingsEntries } from '@/components/settings/globalUpdate/GlobalUpdateSettingsEntries.tsx';
|
||||||
import { GlobalUpdateSettingsInterval } from '@/components/settings/globalUpdate/GlobalUpdateSettingsInterval.tsx';
|
import { GlobalUpdateSettingsInterval } from '@/components/settings/globalUpdate/GlobalUpdateSettingsInterval.tsx';
|
||||||
import { requestManager } from '@/lib/requests/requests/RequestManager.ts';
|
import { requestManager } from '@/lib/requests/requests/RequestManager.ts';
|
||||||
|
|||||||
@@ -18,9 +18,9 @@ import {
|
|||||||
import { requestManager } from '@/lib/requests/requests/RequestManager.ts';
|
import { requestManager } from '@/lib/requests/requests/RequestManager.ts';
|
||||||
import { MetaType, SourceType } from '@/lib/graphql/generated/graphql.ts';
|
import { MetaType, SourceType } from '@/lib/graphql/generated/graphql.ts';
|
||||||
import { DEFAULT_DEVICE, getActiveDevice } from '@/util/device.ts';
|
import { DEFAULT_DEVICE, getActiveDevice } from '@/util/device.ts';
|
||||||
import { CategoryIdInfo } from '@/lib/data/Categories.ts';
|
|
||||||
import { ChapterIdInfo } from '@/modules/chapter/services/Chapters.ts';
|
import { ChapterIdInfo } from '@/modules/chapter/services/Chapters.ts';
|
||||||
import { MangaIdInfo } from '@/modules/manga/services/Mangas.ts';
|
import { MangaIdInfo } from '@/modules/manga/services/Mangas.ts';
|
||||||
|
import { CategoryIdInfo } from '@/modules/category/Category.types.ts';
|
||||||
|
|
||||||
const APP_METADATA_KEY_PREFIX = 'webUI_';
|
const APP_METADATA_KEY_PREFIX = 'webUI_';
|
||||||
|
|
||||||
|
|||||||
21
src/modules/category/Category.types.ts
Normal file
21
src/modules/category/Category.types.ts
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
* 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 { LibraryOptions } from '@/modules/library/Library.types.ts';
|
||||||
|
import { CategoryMetaType, CategoryType } from '@/lib/graphql/generated/graphql.ts';
|
||||||
|
|
||||||
|
export interface ICategoryMetadata extends LibraryOptions {}
|
||||||
|
|
||||||
|
export type CategoryMetadataKeys = keyof ICategoryMetadata;
|
||||||
|
|
||||||
|
export type CategoryIdInfo = Pick<CategoryType, 'id'>;
|
||||||
|
export type CategoryNameInfo = Pick<CategoryType, 'name'>;
|
||||||
|
export type CategoryDefaultInfo = Pick<CategoryType, 'default'>;
|
||||||
|
export type CategoryUpdateInclusionInfo = Pick<CategoryType, 'includeInUpdate'>;
|
||||||
|
export type CategoryDownloadInclusionInfo = Pick<CategoryType, 'includeInDownload'>;
|
||||||
|
export type CategoryMetadataInfo = CategoryIdInfo & { meta: Pick<CategoryMetaType, 'key' | 'value'>[] };
|
||||||
@@ -27,7 +27,7 @@ import {
|
|||||||
CategoryIdInfo,
|
CategoryIdInfo,
|
||||||
CategoryNameInfo,
|
CategoryNameInfo,
|
||||||
CategoryUpdateInclusionInfo,
|
CategoryUpdateInclusionInfo,
|
||||||
} from '@/lib/data/Categories.ts';
|
} from '@/modules/category/Category.types.ts';
|
||||||
|
|
||||||
type CategoryType = CategoryIdInfo & CategoryNameInfo & CategoryUpdateInclusionInfo & CategoryDownloadInclusionInfo;
|
type CategoryType = CategoryIdInfo & CategoryNameInfo & CategoryUpdateInclusionInfo & CategoryDownloadInclusionInfo;
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@ import { requestManager } from '@/lib/requests/requests/RequestManager.ts';
|
|||||||
import { Mangas } from '@/modules/manga/services/Mangas.ts';
|
import { Mangas } from '@/modules/manga/services/Mangas.ts';
|
||||||
import { useSelectableCollection } from '@/modules/collection/hooks/useSelectableCollection.ts';
|
import { useSelectableCollection } from '@/modules/collection/hooks/useSelectableCollection.ts';
|
||||||
import { ThreeStateCheckboxInput } from '@/modules/core/components/inputs/ThreeStateCheckboxInput.tsx';
|
import { ThreeStateCheckboxInput } from '@/modules/core/components/inputs/ThreeStateCheckboxInput.tsx';
|
||||||
import { Categories } from '@/lib/data/Categories.ts';
|
import { Categories } from '@/modules/category/services/Categories.ts';
|
||||||
import { CheckboxInput } from '@/modules/core/components/inputs/CheckboxInput.tsx';
|
import { CheckboxInput } from '@/modules/core/components/inputs/CheckboxInput.tsx';
|
||||||
import { makeToast } from '@/lib/ui/Toast.ts';
|
import { makeToast } from '@/lib/ui/Toast.ts';
|
||||||
import { defaultPromiseErrorHandler } from '@/lib/DefaultPromiseErrorHandler.ts';
|
import { defaultPromiseErrorHandler } from '@/lib/DefaultPromiseErrorHandler.ts';
|
||||||
74
src/modules/category/components/CategorySettingsCard.tsx
Normal file
74
src/modules/category/components/CategorySettingsCard.tsx
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
/*
|
||||||
|
* 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 IconButton from '@mui/material/IconButton';
|
||||||
|
import Tooltip from '@mui/material/Tooltip';
|
||||||
|
import { DraggableProvided } from 'react-beautiful-dnd';
|
||||||
|
import DragHandleIcon from '@mui/icons-material/DragHandle';
|
||||||
|
import EditIcon from '@mui/icons-material/Edit';
|
||||||
|
import DeleteIcon from '@mui/icons-material/Delete';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import Box from '@mui/material/Box';
|
||||||
|
import Card from '@mui/material/Card';
|
||||||
|
import CardContent from '@mui/material/CardContent';
|
||||||
|
import Stack from '@mui/material/Stack';
|
||||||
|
import Typography from '@mui/material/Typography';
|
||||||
|
import { requestManager } from '@/lib/requests/requests/RequestManager.ts';
|
||||||
|
import { CategoryType } from '@/lib/graphql/generated/graphql.ts';
|
||||||
|
|
||||||
|
export const CategorySettingsCard = ({
|
||||||
|
category,
|
||||||
|
provided,
|
||||||
|
onEdit,
|
||||||
|
}: {
|
||||||
|
category: Pick<CategoryType, 'id' | 'name'>;
|
||||||
|
provided: DraggableProvided;
|
||||||
|
onEdit: () => void;
|
||||||
|
}) => {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
const deleteCategory = () => {
|
||||||
|
requestManager.deleteCategory(category.id);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Box sx={{ p: 1, pb: 0 }} {...provided.draggableProps} {...provided.dragHandleProps} ref={provided.innerRef}>
|
||||||
|
<Card>
|
||||||
|
<CardContent
|
||||||
|
sx={{
|
||||||
|
display: 'flex',
|
||||||
|
justifyContent: 'space-between',
|
||||||
|
alignItems: 'center',
|
||||||
|
padding: 1.5,
|
||||||
|
'&:last-child': {
|
||||||
|
paddingBottom: 1.5,
|
||||||
|
},
|
||||||
|
gap: 2,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<DragHandleIcon />
|
||||||
|
<Typography sx={{ flexGrow: 1 }} variant="h6" component="h2">
|
||||||
|
{category.name}
|
||||||
|
</Typography>
|
||||||
|
<Stack sx={{ flexDirection: 'row' }}>
|
||||||
|
<Tooltip title={t('global.button.edit')}>
|
||||||
|
<IconButton component={Box} onClick={onEdit} size="large">
|
||||||
|
<EditIcon />
|
||||||
|
</IconButton>
|
||||||
|
</Tooltip>
|
||||||
|
<Tooltip title={t('chapter.action.download.delete.label.action')}>
|
||||||
|
<IconButton component={Box} onClick={deleteCategory} size="large">
|
||||||
|
<DeleteIcon />
|
||||||
|
</IconButton>
|
||||||
|
</Tooltip>
|
||||||
|
</Stack>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
</Box>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { useMemo, useState } from 'react';
|
import { useMemo, useState } from 'react';
|
||||||
import { CategorySelect, CategorySelectProps } from '@/components/navbar/action/CategorySelect.tsx';
|
import { CategorySelect, CategorySelectProps } from '@/modules/category/components/CategorySelect.tsx';
|
||||||
|
|
||||||
export const useCategorySelect = ({
|
export const useCategorySelect = ({
|
||||||
mangaId,
|
mangaId,
|
||||||
@@ -6,16 +6,11 @@
|
|||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { useMemo, useState, useContext, useLayoutEffect } from 'react';
|
import { useContext, useLayoutEffect, useMemo, useState } from 'react';
|
||||||
import IconButton from '@mui/material/IconButton';
|
import { DragDropContext, Draggable, DropResult } from 'react-beautiful-dnd';
|
||||||
import Tooltip from '@mui/material/Tooltip';
|
|
||||||
import { DragDropContext, Draggable, DraggableProvided, DropResult } from 'react-beautiful-dnd';
|
|
||||||
import DragHandleIcon from '@mui/icons-material/DragHandle';
|
|
||||||
import EditIcon from '@mui/icons-material/Edit';
|
|
||||||
import { useTheme } from '@mui/material/styles';
|
import { useTheme } from '@mui/material/styles';
|
||||||
import Fab from '@mui/material/Fab';
|
import Fab from '@mui/material/Fab';
|
||||||
import AddIcon from '@mui/icons-material/Add';
|
import AddIcon from '@mui/icons-material/Add';
|
||||||
import DeleteIcon from '@mui/icons-material/Delete';
|
|
||||||
import Button from '@mui/material/Button';
|
import Button from '@mui/material/Button';
|
||||||
import TextField from '@mui/material/TextField';
|
import TextField from '@mui/material/TextField';
|
||||||
import Dialog from '@mui/material/Dialog';
|
import Dialog from '@mui/material/Dialog';
|
||||||
@@ -26,77 +21,19 @@ import Checkbox from '@mui/material/Checkbox';
|
|||||||
import FormControlLabel from '@mui/material/FormControlLabel';
|
import FormControlLabel from '@mui/material/FormControlLabel';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import Box from '@mui/material/Box';
|
import Box from '@mui/material/Box';
|
||||||
import Card from '@mui/material/Card';
|
|
||||||
import CardContent from '@mui/material/CardContent';
|
|
||||||
import Stack from '@mui/material/Stack';
|
|
||||||
import Typography from '@mui/material/Typography';
|
|
||||||
import { requestManager } from '@/lib/requests/requests/RequestManager.ts';
|
import { requestManager } from '@/lib/requests/requests/RequestManager.ts';
|
||||||
import { StrictModeDroppable } from '@/modules/core/components/StrictModeDroppable.tsx';
|
import { StrictModeDroppable } from '@/modules/core/components/StrictModeDroppable.tsx';
|
||||||
import { DEFAULT_FULL_FAB_HEIGHT } from '@/modules/core/components/buttons/StyledFab.tsx';
|
import { DEFAULT_FULL_FAB_HEIGHT } from '@/modules/core/components/buttons/StyledFab.tsx';
|
||||||
import { NavBarContext } from '@/components/context/NavbarContext';
|
import { NavBarContext } from '@/components/context/NavbarContext.tsx';
|
||||||
import { LoadingPlaceholder } from '@/modules/core/components/placeholder/LoadingPlaceholder.tsx';
|
import { LoadingPlaceholder } from '@/modules/core/components/placeholder/LoadingPlaceholder.tsx';
|
||||||
import { EmptyViewAbsoluteCentered } from '@/modules/core/components/placeholder/EmptyViewAbsoluteCentered.tsx';
|
import { EmptyViewAbsoluteCentered } from '@/modules/core/components/placeholder/EmptyViewAbsoluteCentered.tsx';
|
||||||
import { defaultPromiseErrorHandler } from '@/lib/DefaultPromiseErrorHandler.ts';
|
import { defaultPromiseErrorHandler } from '@/lib/DefaultPromiseErrorHandler.ts';
|
||||||
import {
|
import { GetCategoriesSettingsQuery, GetCategoriesSettingsQueryVariables } from '@/lib/graphql/generated/graphql.ts';
|
||||||
CategoryType,
|
|
||||||
GetCategoriesSettingsQuery,
|
|
||||||
GetCategoriesSettingsQueryVariables,
|
|
||||||
} from '@/lib/graphql/generated/graphql.ts';
|
|
||||||
import { GET_CATEGORIES_SETTINGS } from '@/lib/graphql/queries/CategoryQuery.ts';
|
import { GET_CATEGORIES_SETTINGS } from '@/lib/graphql/queries/CategoryQuery.ts';
|
||||||
import { CategoryIdInfo } from '@/lib/data/Categories.ts';
|
import { CategorySettingsCard } from '@/modules/category/components/CategorySettingsCard.tsx';
|
||||||
|
import { CategoryIdInfo } from '@/modules/category/Category.types.ts';
|
||||||
|
|
||||||
const CategoryCard = ({
|
export function CategorySettings() {
|
||||||
category,
|
|
||||||
provided,
|
|
||||||
onEdit,
|
|
||||||
}: {
|
|
||||||
category: Pick<CategoryType, 'id' | 'name'>;
|
|
||||||
provided: DraggableProvided;
|
|
||||||
onEdit: () => void;
|
|
||||||
}) => {
|
|
||||||
const { t } = useTranslation();
|
|
||||||
|
|
||||||
const deleteCategory = () => {
|
|
||||||
requestManager.deleteCategory(category.id);
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Box sx={{ p: 1, pb: 0 }} {...provided.draggableProps} {...provided.dragHandleProps} ref={provided.innerRef}>
|
|
||||||
<Card>
|
|
||||||
<CardContent
|
|
||||||
sx={{
|
|
||||||
display: 'flex',
|
|
||||||
justifyContent: 'space-between',
|
|
||||||
alignItems: 'center',
|
|
||||||
padding: 1.5,
|
|
||||||
'&:last-child': {
|
|
||||||
paddingBottom: 1.5,
|
|
||||||
},
|
|
||||||
gap: 2,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<DragHandleIcon />
|
|
||||||
<Typography sx={{ flexGrow: 1 }} variant="h6" component="h2">
|
|
||||||
{category.name}
|
|
||||||
</Typography>
|
|
||||||
<Stack sx={{ flexDirection: 'row' }}>
|
|
||||||
<Tooltip title={t('global.button.edit')}>
|
|
||||||
<IconButton component={Box} onClick={onEdit} size="large">
|
|
||||||
<EditIcon />
|
|
||||||
</IconButton>
|
|
||||||
</Tooltip>
|
|
||||||
<Tooltip title={t('chapter.action.download.delete.label.action')}>
|
|
||||||
<IconButton component={Box} onClick={deleteCategory} size="large">
|
|
||||||
<DeleteIcon />
|
|
||||||
</IconButton>
|
|
||||||
</Tooltip>
|
|
||||||
</Stack>
|
|
||||||
</CardContent>
|
|
||||||
</Card>
|
|
||||||
</Box>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
export function Categories() {
|
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const { setTitle, setAction } = useContext(NavBarContext);
|
const { setTitle, setAction } = useContext(NavBarContext);
|
||||||
@@ -188,7 +125,7 @@ export function Categories() {
|
|||||||
<EmptyViewAbsoluteCentered
|
<EmptyViewAbsoluteCentered
|
||||||
message={t('category.error.label.request_failure')}
|
message={t('category.error.label.request_failure')}
|
||||||
messageExtra={error.message}
|
messageExtra={error.message}
|
||||||
retry={() => refetch().catch(defaultPromiseErrorHandler('Categories::refetch'))}
|
retry={() => refetch().catch(defaultPromiseErrorHandler('CategorySettings::refetch'))}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -202,7 +139,7 @@ export function Categories() {
|
|||||||
{categories.map((category, index) => (
|
{categories.map((category, index) => (
|
||||||
<Draggable key={category.id} draggableId={category.id.toString()} index={index}>
|
<Draggable key={category.id} draggableId={category.id.toString()} index={index}>
|
||||||
{(draggableProvided) => (
|
{(draggableProvided) => (
|
||||||
<CategoryCard
|
<CategorySettingsCard
|
||||||
provided={draggableProvided}
|
provided={draggableProvided}
|
||||||
category={category}
|
category={category}
|
||||||
onEdit={() => handleEditDialogOpen(index)}
|
onEdit={() => handleEditDialogOpen(index)}
|
||||||
@@ -6,17 +6,10 @@
|
|||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { CategoryMetaType, CategoryType } from '@/lib/graphql/generated/graphql.ts';
|
import { CategoryDefaultInfo, CategoryIdInfo } from '@/modules/category/Category.types.ts';
|
||||||
|
|
||||||
export const DEFAULT_CATEGORY_ID = 0;
|
export const DEFAULT_CATEGORY_ID = 0;
|
||||||
|
|
||||||
export type CategoryIdInfo = Pick<CategoryType, 'id'>;
|
|
||||||
export type CategoryNameInfo = Pick<CategoryType, 'name'>;
|
|
||||||
export type CategoryDefaultInfo = Pick<CategoryType, 'default'>;
|
|
||||||
export type CategoryUpdateInclusionInfo = Pick<CategoryType, 'includeInUpdate'>;
|
|
||||||
export type CategoryDownloadInclusionInfo = Pick<CategoryType, 'includeInDownload'>;
|
|
||||||
export type CategoryMetadataInfo = CategoryIdInfo & { meta: Pick<CategoryMetaType, 'key' | 'value'>[] };
|
|
||||||
|
|
||||||
export class Categories {
|
export class Categories {
|
||||||
static getIds(categories: CategoryIdInfo[]): number[] {
|
static getIds(categories: CategoryIdInfo[]): number[] {
|
||||||
return categories.map((category) => category.id);
|
return categories.map((category) => category.id);
|
||||||
@@ -6,20 +6,13 @@
|
|||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {
|
import { AllowedMetadataValueTypes, AppMetadataKeys, GqlMetaHolder, Metadata } from '@/typings.ts';
|
||||||
AllowedMetadataValueTypes,
|
|
||||||
AppMetadataKeys,
|
|
||||||
CategoryMetadataKeys,
|
|
||||||
GqlMetaHolder,
|
|
||||||
ICategoryMetadata,
|
|
||||||
Metadata,
|
|
||||||
} from '@/typings.ts';
|
|
||||||
import { jsonSaveParse } from '@/lib/HelperFunctions.ts';
|
import { jsonSaveParse } from '@/lib/HelperFunctions.ts';
|
||||||
import { convertFromGqlMeta, getMetadataFrom, requestUpdateCategoryMetadata } from '@/lib/metadata/metadata.ts';
|
import { convertFromGqlMeta, getMetadataFrom, requestUpdateCategoryMetadata } from '@/lib/metadata/metadata.ts';
|
||||||
import { defaultPromiseErrorHandler } from '@/lib/DefaultPromiseErrorHandler.ts';
|
import { defaultPromiseErrorHandler } from '@/lib/DefaultPromiseErrorHandler.ts';
|
||||||
import { CategoryIdInfo } from '@/lib/data/Categories.ts';
|
|
||||||
import { GridLayout } from '@/modules/library/contexts/LibraryOptionsContext.tsx';
|
import { GridLayout } from '@/modules/library/contexts/LibraryOptionsContext.tsx';
|
||||||
import { LibraryOptions } from '@/modules/library/Library.types.ts';
|
import { LibraryOptions } from '@/modules/library/Library.types.ts';
|
||||||
|
import { CategoryIdInfo, CategoryMetadataKeys, ICategoryMetadata } from '@/modules/category/Category.types.ts';
|
||||||
|
|
||||||
export const getDefaultCategoryMetadata = (): ICategoryMetadata => ({
|
export const getDefaultCategoryMetadata = (): ICategoryMetadata => ({
|
||||||
// display options
|
// display options
|
||||||
@@ -23,7 +23,8 @@ import { Progress } from '@/modules/core/components/Progress.tsx';
|
|||||||
import { defaultPromiseErrorHandler } from '@/lib/DefaultPromiseErrorHandler.ts';
|
import { defaultPromiseErrorHandler } from '@/lib/DefaultPromiseErrorHandler.ts';
|
||||||
import { dateTimeFormatter } from '@/util/DateHelper.ts';
|
import { dateTimeFormatter } from '@/util/DateHelper.ts';
|
||||||
import { MediaQuery } from '@/lib/ui/MediaQuery.tsx';
|
import { MediaQuery } from '@/lib/ui/MediaQuery.tsx';
|
||||||
import { CategoryIdInfo } from '@/lib/data/Categories.ts';
|
|
||||||
|
import { CategoryIdInfo } from '@/modules/category/Category.types.ts';
|
||||||
|
|
||||||
const calcProgress = (status: UpdaterSubscription['updateStatusChanged'] | undefined) => {
|
const calcProgress = (status: UpdaterSubscription['updateStatusChanged'] | undefined) => {
|
||||||
if (!status) {
|
if (!status) {
|
||||||
|
|||||||
@@ -21,8 +21,7 @@ import { Trackers } from '@/modules/tracker/services/Trackers.ts';
|
|||||||
import { GetTrackersSettingsQuery, MangaStatus } from '@/lib/graphql/generated/graphql.ts';
|
import { GetTrackersSettingsQuery, MangaStatus } from '@/lib/graphql/generated/graphql.ts';
|
||||||
import { GET_TRACKERS_SETTINGS } from '@/lib/graphql/queries/TrackerQuery.ts';
|
import { GET_TRACKERS_SETTINGS } from '@/lib/graphql/queries/TrackerQuery.ts';
|
||||||
import { statusToTranslationKey } from '@/modules/manga/services/Mangas.ts';
|
import { statusToTranslationKey } from '@/modules/manga/services/Mangas.ts';
|
||||||
import { CategoryMetadataInfo } from '@/lib/data/Categories.ts';
|
import { createUpdateCategoryMetadata, getCategoryMetadata } from '@/modules/category/services/CategoryMetadata.ts';
|
||||||
import { createUpdateCategoryMetadata, getCategoryMetadata } from '@/lib/metadata/categoryMetadata.ts';
|
|
||||||
import { makeToast } from '@/lib/ui/Toast.ts';
|
import { makeToast } from '@/lib/ui/Toast.ts';
|
||||||
import {
|
import {
|
||||||
createUpdateMetadataServerSettings,
|
createUpdateMetadataServerSettings,
|
||||||
@@ -30,6 +29,7 @@ import {
|
|||||||
} from '@/lib/metadata/metadataServerSettings.ts';
|
} from '@/lib/metadata/metadataServerSettings.ts';
|
||||||
import { TranslationKey } from '@/Base.types.ts';
|
import { TranslationKey } from '@/Base.types.ts';
|
||||||
import { LibrarySortMode } from '@/modules/library/Library.types.ts';
|
import { LibrarySortMode } from '@/modules/library/Library.types.ts';
|
||||||
|
import { CategoryMetadataInfo } from '@/modules/category/Category.types.ts';
|
||||||
|
|
||||||
const TITLES: { [key in 'filter' | 'sort' | 'display']: TranslationKey } = {
|
const TITLES: { [key in 'filter' | 'sort' | 'display']: TranslationKey } = {
|
||||||
filter: 'global.label.filter',
|
filter: 'global.label.filter',
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import React, { useContext } from 'react';
|
import React, { useContext } from 'react';
|
||||||
import { getDefaultCategoryMetadata } from '@/lib/metadata/categoryMetadata.ts';
|
import { getDefaultCategoryMetadata } from '@/modules/category/services/CategoryMetadata.ts';
|
||||||
import { LibraryOptions } from '@/modules/library/Library.types.ts';
|
import { LibraryOptions } from '@/modules/library/Library.types.ts';
|
||||||
|
|
||||||
type ContextType = {
|
type ContextType = {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
import React, { useMemo } from 'react';
|
import React, { useMemo } from 'react';
|
||||||
import { useLocalStorage } from '@/modules/core/hooks/useStorage.tsx';
|
import { useLocalStorage } from '@/modules/core/hooks/useStorage.tsx';
|
||||||
import { LibraryOptionsContext } from '@/modules/library/contexts/LibraryOptionsContext.tsx';
|
import { LibraryOptionsContext } from '@/modules/library/contexts/LibraryOptionsContext.tsx';
|
||||||
import { getDefaultCategoryMetadata } from '@/lib/metadata/categoryMetadata.ts';
|
import { getDefaultCategoryMetadata } from '@/modules/category/services/CategoryMetadata.ts';
|
||||||
import { LibraryOptions } from '@/modules/library/Library.types.ts';
|
import { LibraryOptions } from '@/modules/library/Library.types.ts';
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
|
|||||||
@@ -12,10 +12,10 @@ import { useMetadataServerSettings } from '@/lib/metadata/metadataServerSettings
|
|||||||
import { ChapterType, MangaType, SourceType, TrackRecordType } from '@/lib/graphql/generated/graphql.ts';
|
import { ChapterType, MangaType, SourceType, TrackRecordType } from '@/lib/graphql/generated/graphql.ts';
|
||||||
import { MangaChapterCountInfo, MangaIdInfo } from '@/modules/manga/services/Mangas.ts';
|
import { MangaChapterCountInfo, MangaIdInfo } from '@/modules/manga/services/Mangas.ts';
|
||||||
import { enhancedCleanup } from '@/lib/data/Strings.ts';
|
import { enhancedCleanup } from '@/lib/data/Strings.ts';
|
||||||
import { CategoryMetadataInfo } from '@/lib/data/Categories.ts';
|
import { getCategoryMetadata } from '@/modules/category/services/CategoryMetadata.ts';
|
||||||
import { getCategoryMetadata } from '@/lib/metadata/categoryMetadata.ts';
|
|
||||||
import { NullAndUndefined } from '@/Base.types.ts';
|
import { NullAndUndefined } from '@/Base.types.ts';
|
||||||
import { LibraryOptions, LibrarySortMode } from '@/modules/library/Library.types.ts';
|
import { LibraryOptions, LibrarySortMode } from '@/modules/library/Library.types.ts';
|
||||||
|
import { CategoryMetadataInfo } from '@/modules/category/Category.types.ts';
|
||||||
|
|
||||||
const triStateFilter = (
|
const triStateFilter = (
|
||||||
triState: NullAndUndefined<boolean>,
|
triState: NullAndUndefined<boolean>,
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ import { Mangas } from '@/modules/manga/services/Mangas.ts';
|
|||||||
import { MANGA_CHAPTER_STAT_FIELDS } from '@/lib/graphql/fragments/MangaFragments.ts';
|
import { MANGA_CHAPTER_STAT_FIELDS } from '@/lib/graphql/fragments/MangaFragments.ts';
|
||||||
import { useLibraryOptionsContext } from '@/modules/library/contexts/LibraryOptionsContext.tsx';
|
import { useLibraryOptionsContext } from '@/modules/library/contexts/LibraryOptionsContext.tsx';
|
||||||
import { useMetadataServerSettings } from '@/lib/metadata/metadataServerSettings.ts';
|
import { useMetadataServerSettings } from '@/lib/metadata/metadataServerSettings.ts';
|
||||||
import { getCategoryMetadata } from '@/lib/metadata/categoryMetadata.ts';
|
import { getCategoryMetadata } from '@/modules/category/services/CategoryMetadata.ts';
|
||||||
|
|
||||||
const TitleWithSizeTag = styled('span')({
|
const TitleWithSizeTag = styled('span')({
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ import {
|
|||||||
} from '@/modules/core/components/menu/Menu.utils.ts';
|
} from '@/modules/core/components/menu/Menu.utils.ts';
|
||||||
import { defaultPromiseErrorHandler } from '@/lib/DefaultPromiseErrorHandler.ts';
|
import { defaultPromiseErrorHandler } from '@/lib/DefaultPromiseErrorHandler.ts';
|
||||||
import { TrackManga } from '@/modules/tracker/components/TrackManga.tsx';
|
import { TrackManga } from '@/modules/tracker/components/TrackManga.tsx';
|
||||||
import { useCategorySelect } from '@/components/navbar/action/useCategorySelect.tsx';
|
import { useCategorySelect } from '@/modules/category/hooks/useCategorySelect.tsx';
|
||||||
import { ChaptersDownloadActionMenuItems } from '@/modules/chapter/components/actions/ChaptersDownloadActionMenuItems.tsx';
|
import { ChaptersDownloadActionMenuItems } from '@/modules/chapter/components/actions/ChaptersDownloadActionMenuItems.tsx';
|
||||||
import { NestedMenuItem } from '@/modules/core/components/menu/NestedMenuItem.tsx';
|
import { NestedMenuItem } from '@/modules/core/components/menu/NestedMenuItem.tsx';
|
||||||
import { MangaChapterStatFieldsFragment, MangaType } from '@/lib/graphql/generated/graphql.ts';
|
import { MangaChapterStatFieldsFragment, MangaType } from '@/lib/graphql/generated/graphql.ts';
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import { Link } from 'react-router-dom';
|
|||||||
import SyncAltIcon from '@mui/icons-material/SyncAlt';
|
import SyncAltIcon from '@mui/icons-material/SyncAlt';
|
||||||
import { useTheme } from '@mui/material/styles';
|
import { useTheme } from '@mui/material/styles';
|
||||||
import useMediaQuery from '@mui/material/useMediaQuery';
|
import useMediaQuery from '@mui/material/useMediaQuery';
|
||||||
import { useCategorySelect } from '@/components/navbar/action/useCategorySelect.tsx';
|
import { useCategorySelect } from '@/modules/category/hooks/useCategorySelect.tsx';
|
||||||
import { MangaType } from '@/lib/graphql/generated/graphql.ts';
|
import { MangaType } from '@/lib/graphql/generated/graphql.ts';
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
|
|||||||
@@ -10,11 +10,11 @@ import { useCallback, useState } from 'react';
|
|||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
import gql from 'graphql-tag';
|
import gql from 'graphql-tag';
|
||||||
import { useCategorySelect } from '@/components/navbar/action/useCategorySelect.tsx';
|
import { useCategorySelect } from '@/modules/category/hooks/useCategorySelect.tsx';
|
||||||
import { requestManager } from '@/lib/requests/requests/RequestManager.ts';
|
import { requestManager } from '@/lib/requests/requests/RequestManager.ts';
|
||||||
import { makeToast } from '@/lib/ui/Toast.ts';
|
import { makeToast } from '@/lib/ui/Toast.ts';
|
||||||
import { getMetadataServerSettings } from '@/lib/metadata/metadataServerSettings.ts';
|
import { getMetadataServerSettings } from '@/lib/metadata/metadataServerSettings.ts';
|
||||||
import { Categories } from '@/lib/data/Categories.ts';
|
import { Categories } from '@/modules/category/services/Categories.ts';
|
||||||
import { defaultPromiseErrorHandler } from '@/lib/DefaultPromiseErrorHandler.ts';
|
import { defaultPromiseErrorHandler } from '@/lib/DefaultPromiseErrorHandler.ts';
|
||||||
import { Mangas } from '@/modules/manga/services/Mangas.ts';
|
import { Mangas } from '@/modules/manga/services/Mangas.ts';
|
||||||
import { awaitConfirmation } from '@/lib/ui/AwaitableDialog.tsx';
|
import { awaitConfirmation } from '@/lib/ui/AwaitableDialog.tsx';
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import {
|
|||||||
} from '@/lib/metadata/metadataServerSettings.ts';
|
} from '@/lib/metadata/metadataServerSettings.ts';
|
||||||
import { makeToast } from '@/lib/ui/Toast.ts';
|
import { makeToast } from '@/lib/ui/Toast.ts';
|
||||||
import { DeleteChaptersWhileReadingSetting } from '@/components/settings/downloads/DeleteChaptersWhileReadingSetting.tsx';
|
import { DeleteChaptersWhileReadingSetting } from '@/components/settings/downloads/DeleteChaptersWhileReadingSetting.tsx';
|
||||||
import { CategoriesInclusionSetting } from '@/components/settings/CategoriesInclusionSetting.tsx';
|
import { CategoriesInclusionSetting } from '@/modules/category/components/CategoriesInclusionSetting.tsx';
|
||||||
import { NumberSetting } from '@/modules/core/components/settings/NumberSetting.tsx';
|
import { NumberSetting } from '@/modules/core/components/settings/NumberSetting.tsx';
|
||||||
import { LoadingPlaceholder } from '@/modules/core/components/placeholder/LoadingPlaceholder.tsx';
|
import { LoadingPlaceholder } from '@/modules/core/components/placeholder/LoadingPlaceholder.tsx';
|
||||||
import { EmptyViewAbsoluteCentered } from '@/modules/core/components/placeholder/EmptyViewAbsoluteCentered.tsx';
|
import { EmptyViewAbsoluteCentered } from '@/modules/core/components/placeholder/EmptyViewAbsoluteCentered.tsx';
|
||||||
|
|||||||
@@ -13,11 +13,10 @@ import { AppTheme } from '@/lib/ui/AppThemes.ts';
|
|||||||
import { MetadataMigrationSettings } from '@/modules/migration/Migration.types.ts';
|
import { MetadataMigrationSettings } from '@/modules/migration/Migration.types.ts';
|
||||||
import { TranslationKey } from '@/Base.types.ts';
|
import { TranslationKey } from '@/Base.types.ts';
|
||||||
import { MangaMetadataKeys } from '@/modules/manga/MangaCard.types.tsx';
|
import { MangaMetadataKeys } from '@/modules/manga/MangaCard.types.tsx';
|
||||||
import { LibraryOptions, MetadataLibrarySettings } from '@/modules/library/Library.types.ts';
|
import { MetadataLibrarySettings } from '@/modules/library/Library.types.ts';
|
||||||
import { SourceMetadataKeys } from '@/modules/source/Source.types.ts';
|
import { SourceMetadataKeys } from '@/modules/source/Source.types.ts';
|
||||||
import { MetadataTrackingSettings } from '@/modules/tracker/Tracker.types.ts';
|
import { MetadataTrackingSettings } from '@/modules/tracker/Tracker.types.ts';
|
||||||
|
import { CategoryMetadataKeys } from '@/modules/category/Category.types.ts';
|
||||||
export interface ICategoryMetadata extends LibraryOptions {}
|
|
||||||
|
|
||||||
export interface IMetadataMigration {
|
export interface IMetadataMigration {
|
||||||
appKeyPrefix?: { oldPrefix: string; newPrefix: string };
|
appKeyPrefix?: { oldPrefix: string; newPrefix: string };
|
||||||
@@ -49,8 +48,6 @@ export type MetadataServerSettingKeys = keyof MetadataServerSettings;
|
|||||||
|
|
||||||
export type SearchMetadataKeys = keyof ISearchSettings;
|
export type SearchMetadataKeys = keyof ISearchSettings;
|
||||||
|
|
||||||
export type CategoryMetadataKeys = keyof ICategoryMetadata;
|
|
||||||
|
|
||||||
export type AppMetadataKeys =
|
export type AppMetadataKeys =
|
||||||
| MetadataServerSettingKeys
|
| MetadataServerSettingKeys
|
||||||
| MangaMetadataKeys
|
| MangaMetadataKeys
|
||||||
|
|||||||
Reference in New Issue
Block a user