2021-03-26 04:17:02 +04:30
|
|
|
/*
|
|
|
|
|
* Copyright (C) Contributors to the Suwayomi project
|
|
|
|
|
*
|
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
2021-01-26 23:32:12 +03:30
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
2023-05-18 13:17:41 +02:00
|
|
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
|
|
|
*/
|
2021-01-26 23:32:12 +03:30
|
|
|
|
2023-02-24 16:40:37 +01:00
|
|
|
import { OverridableComponent } from '@mui/material/OverridableComponent';
|
2024-04-14 15:50:12 +02:00
|
|
|
import { SvgIconTypeMap } from '@mui/material/SvgIcon';
|
2023-07-04 21:53:25 +02:00
|
|
|
import { ParseKeys } from 'i18next';
|
2023-06-04 21:30:15 +02:00
|
|
|
import { Location } from 'react-router-dom';
|
2023-09-25 23:32:26 +02:00
|
|
|
import {
|
2023-10-15 16:03:08 +02:00
|
|
|
GetCategoryQuery,
|
|
|
|
|
GetChapterQuery,
|
|
|
|
|
GetExtensionQuery,
|
|
|
|
|
GetMangaQuery,
|
2023-10-29 02:01:59 +02:00
|
|
|
GetServerSettingsQuery,
|
2023-09-25 23:32:26 +02:00
|
|
|
GetSourceQuery,
|
2024-01-09 22:09:31 +01:00
|
|
|
GetSourcesQuery,
|
2023-09-25 23:32:26 +02:00
|
|
|
MetaType,
|
|
|
|
|
SourcePreferenceChangeInput,
|
|
|
|
|
} from '@/lib/graphql/generated/graphql.ts';
|
2024-03-28 20:00:46 +01:00
|
|
|
import { TBaseTracker } from '@/lib/data/Trackers.ts';
|
2023-09-25 23:32:26 +02:00
|
|
|
|
2023-06-04 21:30:15 +02:00
|
|
|
type GenericLocation<State = any> = Omit<Location, 'state'> & { state?: State };
|
|
|
|
|
|
|
|
|
|
declare module 'react-router-dom' {
|
|
|
|
|
export function useParams<Params extends { [K in keyof Params]: string } = {}>(): Params;
|
|
|
|
|
|
|
|
|
|
export function useLocation<State = any>(): GenericLocation<State>;
|
|
|
|
|
}
|
2023-03-23 13:59:32 +01:00
|
|
|
|
2023-07-04 21:53:25 +02:00
|
|
|
export type TranslationKey = ParseKeys;
|
2023-02-24 16:40:37 +01:00
|
|
|
|
2023-10-15 16:03:08 +02:00
|
|
|
export type PartialExtension = GetExtensionQuery['extension'];
|
2020-12-25 06:36:34 +03:30
|
|
|
|
2023-02-24 16:40:37 +01:00
|
|
|
export interface ISource {
|
2023-02-06 10:06:33 +01:00
|
|
|
id: string;
|
|
|
|
|
name: string;
|
|
|
|
|
lang: string;
|
|
|
|
|
iconUrl: string;
|
|
|
|
|
supportsLatest: boolean;
|
|
|
|
|
isConfigurable: boolean;
|
|
|
|
|
isNsfw: boolean;
|
|
|
|
|
displayName: string;
|
2020-12-25 06:36:34 +03:30
|
|
|
}
|
2020-12-25 17:42:22 +01:00
|
|
|
|
2024-01-09 22:09:31 +01:00
|
|
|
export type TPartialSource = GetSourcesQuery['sources']['nodes'][number];
|
|
|
|
|
|
2023-09-24 21:32:23 +02:00
|
|
|
export type SourceFilters = GetSourceQuery['source']['filters'][number];
|
2022-03-04 01:25:10 +00:00
|
|
|
|
2023-02-24 16:40:37 +01:00
|
|
|
export interface IMetadataMigration {
|
2023-02-06 10:06:33 +01:00
|
|
|
appKeyPrefix?: { oldPrefix: string; newPrefix: string };
|
2023-02-17 13:10:44 +01:00
|
|
|
values?: {
|
|
|
|
|
/**
|
|
|
|
|
* In case the migration should only be applied to a specific metadata key.
|
|
|
|
|
* Otherwise, all metadata keys will get migrated.
|
|
|
|
|
*/
|
|
|
|
|
key?: string;
|
|
|
|
|
oldValue: string;
|
|
|
|
|
newValue: string;
|
|
|
|
|
}[];
|
2023-02-06 10:06:33 +01:00
|
|
|
keys?: { oldKey: string; newKey: string }[];
|
2023-01-06 18:19:45 +01:00
|
|
|
}
|
|
|
|
|
|
2023-04-22 11:34:19 +02:00
|
|
|
export type Metadata<Keys extends string = string, Values = string> = {
|
|
|
|
|
[key in Keys]: Values;
|
|
|
|
|
};
|
2023-01-06 17:15:29 +01:00
|
|
|
|
2023-09-08 00:44:01 +02:00
|
|
|
export type GqlMetaHolder = { meta?: MetaType[] };
|
|
|
|
|
|
2023-04-22 11:34:19 +02:00
|
|
|
export type MetadataHolder<Keys extends string = string, Values = string> = {
|
|
|
|
|
meta?: Metadata<Keys, Values>;
|
|
|
|
|
};
|
2023-01-06 17:15:29 +01:00
|
|
|
|
2023-02-24 16:40:37 +01:00
|
|
|
export type AllowedMetadataValueTypes = string | boolean | number | undefined;
|
2023-01-06 17:15:29 +01:00
|
|
|
|
2023-11-19 21:17:35 +01:00
|
|
|
export type MetadataServerSettingKeys = keyof MetadataServerSettings;
|
|
|
|
|
|
2023-02-24 16:40:37 +01:00
|
|
|
export type MangaMetadataKeys = keyof IReaderSettings;
|
2023-01-06 17:15:29 +01:00
|
|
|
|
2023-03-04 22:21:24 +05:30
|
|
|
export type SearchMetadataKeys = keyof ISearchSettings;
|
|
|
|
|
|
2023-11-19 21:17:35 +01:00
|
|
|
export type AppMetadataKeys = MetadataServerSettingKeys | MangaMetadataKeys | SearchMetadataKeys;
|
2023-01-06 17:15:29 +01:00
|
|
|
|
2023-02-24 16:40:37 +01:00
|
|
|
export type MetadataKeyValuePair = [AppMetadataKeys, AllowedMetadataValueTypes];
|
2023-01-06 17:15:29 +01:00
|
|
|
|
2023-02-24 16:40:37 +01:00
|
|
|
export interface IMangaCard {
|
2023-02-06 10:06:33 +01:00
|
|
|
id: number;
|
|
|
|
|
title: string;
|
2023-02-16 11:26:09 +05:30
|
|
|
genre: string[];
|
2023-02-06 10:06:33 +01:00
|
|
|
thumbnailUrl: string;
|
|
|
|
|
unreadCount?: number;
|
|
|
|
|
downloadCount?: number;
|
|
|
|
|
inLibrary?: boolean;
|
2023-04-22 11:34:19 +02:00
|
|
|
meta?: Metadata;
|
2023-03-04 22:21:39 +05:30
|
|
|
inLibraryAt: number;
|
2023-03-05 12:26:50 +05:30
|
|
|
lastReadAt: number;
|
2021-03-17 19:17:03 +03:30
|
|
|
}
|
|
|
|
|
|
2023-10-15 16:03:08 +02:00
|
|
|
export type TManga = GetMangaQuery['manga'];
|
|
|
|
|
|
2024-04-01 01:12:26 +02:00
|
|
|
export type TPartialManga = OptionalProperty<
|
|
|
|
|
TManga,
|
|
|
|
|
'unreadCount' | 'downloadCount' | 'bookmarkCount' | 'categories' | 'chapters'
|
|
|
|
|
>;
|
2023-10-15 16:03:08 +02:00
|
|
|
|
2023-02-24 16:40:37 +01:00
|
|
|
export interface IManga {
|
2023-02-06 10:06:33 +01:00
|
|
|
id: number;
|
|
|
|
|
sourceId: string;
|
2021-03-17 19:17:03 +03:30
|
|
|
|
2023-02-06 10:06:33 +01:00
|
|
|
url: string;
|
|
|
|
|
title: string;
|
|
|
|
|
thumbnailUrl: string;
|
2021-03-17 19:17:03 +03:30
|
|
|
|
2023-02-06 10:06:33 +01:00
|
|
|
artist: string;
|
|
|
|
|
author: string;
|
|
|
|
|
description: string;
|
|
|
|
|
genre: string[];
|
|
|
|
|
status: string;
|
2021-09-05 01:11:25 +04:30
|
|
|
|
2023-02-06 10:06:33 +01:00
|
|
|
inLibrary: boolean;
|
|
|
|
|
source: ISource;
|
2021-09-05 01:11:25 +04:30
|
|
|
|
2023-04-22 11:34:19 +02:00
|
|
|
meta: Metadata;
|
2021-09-05 01:11:25 +04:30
|
|
|
|
2023-02-06 10:06:33 +01:00
|
|
|
realUrl: string;
|
|
|
|
|
freshData: boolean;
|
|
|
|
|
unreadCount?: number;
|
|
|
|
|
downloadCount?: number;
|
2022-11-02 10:42:02 +01:00
|
|
|
|
2023-02-06 10:06:33 +01:00
|
|
|
age: number;
|
|
|
|
|
chaptersAge: number;
|
2023-03-04 22:21:39 +05:30
|
|
|
chaptersLastFetchedAt: number;
|
|
|
|
|
inLibraryAt: number;
|
|
|
|
|
initialized: boolean;
|
|
|
|
|
lastChapterRead: NullAndUndefined<IChapter>;
|
|
|
|
|
lastFetchedAt: number;
|
|
|
|
|
lastReadAt: number;
|
|
|
|
|
thumbnailUrlLastFetched: number;
|
|
|
|
|
updateStrategy: string;
|
2021-09-05 01:11:25 +04:30
|
|
|
}
|
|
|
|
|
|
2023-02-24 16:40:37 +01:00
|
|
|
export interface IChapter {
|
2023-02-06 10:06:33 +01:00
|
|
|
id: number;
|
|
|
|
|
url: string;
|
|
|
|
|
name: string;
|
|
|
|
|
uploadDate: number;
|
|
|
|
|
chapterNumber: number;
|
|
|
|
|
scanlator: string;
|
|
|
|
|
mangaId: number;
|
|
|
|
|
read: boolean;
|
|
|
|
|
bookmarked: boolean;
|
|
|
|
|
lastPageRead: number;
|
|
|
|
|
lastReadAt: number;
|
|
|
|
|
index: number;
|
|
|
|
|
fetchedAt: number;
|
|
|
|
|
chapterCount: number;
|
|
|
|
|
pageCount: number;
|
|
|
|
|
downloaded: boolean;
|
2023-04-22 11:34:19 +02:00
|
|
|
meta: Metadata;
|
2021-01-19 21:02:57 +03:30
|
|
|
}
|
2021-02-20 01:23:52 +03:30
|
|
|
|
2023-02-24 16:40:37 +01:00
|
|
|
export interface IMangaChapter {
|
2023-02-06 10:06:33 +01:00
|
|
|
manga: IManga;
|
|
|
|
|
chapter: IChapter;
|
2021-09-28 00:41:12 +03:30
|
|
|
}
|
|
|
|
|
|
2023-10-15 16:03:08 +02:00
|
|
|
export type TChapter = GetChapterQuery['chapter'];
|
|
|
|
|
|
2023-04-22 13:03:51 +02:00
|
|
|
export enum IncludeInGlobalUpdate {
|
|
|
|
|
EXCLUDE = 0,
|
|
|
|
|
INCLUDE = 1,
|
|
|
|
|
UNSET = -1,
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-15 16:03:08 +02:00
|
|
|
export type TCategory = GetCategoryQuery['category'];
|
|
|
|
|
|
2023-02-24 16:40:37 +01:00
|
|
|
export interface ICategory {
|
2023-02-06 10:06:33 +01:00
|
|
|
id: number;
|
|
|
|
|
order: number;
|
|
|
|
|
name: string;
|
|
|
|
|
default: boolean;
|
2023-04-22 13:03:51 +02:00
|
|
|
includeInUpdate: IncludeInGlobalUpdate;
|
2024-01-21 13:31:04 -08:00
|
|
|
includeInDownload: IncludeInGlobalUpdate;
|
2023-04-22 11:34:19 +02:00
|
|
|
meta: Metadata;
|
2023-04-22 11:39:59 +02:00
|
|
|
size: number;
|
2021-02-20 01:23:52 +03:30
|
|
|
}
|
2021-03-18 21:46:24 +03:30
|
|
|
|
2023-02-24 16:40:37 +01:00
|
|
|
export interface INavbarOverride {
|
2023-02-06 10:06:33 +01:00
|
|
|
status: boolean;
|
|
|
|
|
value: any;
|
2021-03-29 02:47:51 +04:30
|
|
|
}
|
2021-05-15 17:18:57 +04:30
|
|
|
|
2023-02-24 16:40:37 +01:00
|
|
|
export type ReaderType =
|
2023-02-06 10:06:33 +01:00
|
|
|
| 'ContinuesVertical'
|
|
|
|
|
| 'Webtoon'
|
|
|
|
|
| 'SingleVertical'
|
|
|
|
|
| 'SingleRTL'
|
|
|
|
|
| 'SingleLTR'
|
|
|
|
|
| 'DoubleVertical'
|
|
|
|
|
| 'DoubleRTL'
|
|
|
|
|
| 'DoubleLTR'
|
|
|
|
|
| 'ContinuesHorizontalLTR'
|
|
|
|
|
| 'ContinuesHorizontalRTL';
|
|
|
|
|
|
2023-02-24 16:40:37 +01:00
|
|
|
export interface IReaderSettings {
|
2023-02-06 10:06:33 +01:00
|
|
|
staticNav: boolean;
|
|
|
|
|
showPageNumber: boolean;
|
|
|
|
|
loadNextOnEnding: boolean;
|
2023-04-05 13:37:12 +02:00
|
|
|
skipDupChapters: boolean;
|
2023-06-03 20:53:52 +02:00
|
|
|
fitPageToWindow: boolean;
|
2024-02-21 02:42:07 +01:00
|
|
|
scalePage: boolean;
|
2023-02-06 10:06:33 +01:00
|
|
|
readerType: ReaderType;
|
2023-09-27 18:36:47 -04:00
|
|
|
offsetFirstPage: boolean;
|
2024-01-21 13:33:13 -08:00
|
|
|
readerWidth: number;
|
2021-05-15 17:18:57 +04:30
|
|
|
}
|
|
|
|
|
|
2023-04-05 13:37:12 +02:00
|
|
|
export enum ChapterOffset {
|
|
|
|
|
PREV = -1,
|
|
|
|
|
NEXT = 1,
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-16 16:21:15 +01:00
|
|
|
export type MetadataDownloadSettings = {
|
2023-11-19 21:17:35 +01:00
|
|
|
deleteChaptersManuallyMarkedRead: boolean;
|
2023-12-05 22:20:13 +01:00
|
|
|
deleteChaptersWhileReading: number;
|
2023-11-19 21:17:35 +01:00
|
|
|
deleteChaptersWithBookmark: boolean;
|
2024-02-16 19:16:18 +01:00
|
|
|
downloadAheadLimit: number;
|
2024-03-16 16:21:15 +01:00
|
|
|
};
|
2023-12-27 18:08:16 +01:00
|
|
|
|
2024-03-16 16:21:15 +01:00
|
|
|
export type MetadataLibrarySettings = {
|
2023-12-27 18:08:16 +01:00
|
|
|
showAddToLibraryCategorySelectDialog: boolean;
|
|
|
|
|
ignoreFilters: boolean;
|
2024-03-02 15:28:58 +01:00
|
|
|
removeMangaFromCategories: boolean;
|
2024-03-16 16:21:15 +01:00
|
|
|
};
|
2024-03-06 23:07:48 +01:00
|
|
|
|
2024-03-16 16:21:15 +01:00
|
|
|
export type MetadataClientSettings = {
|
2024-03-06 23:07:48 +01:00
|
|
|
devices: string[];
|
2024-03-16 16:21:15 +01:00
|
|
|
};
|
2024-03-16 14:02:54 +01:00
|
|
|
|
2024-03-16 16:21:15 +01:00
|
|
|
export type MetadataMigrationSettings = {
|
2024-03-16 14:02:54 +01:00
|
|
|
includeChapters: boolean;
|
|
|
|
|
includeCategories: boolean;
|
|
|
|
|
deleteChapters: boolean;
|
2023-11-19 21:17:35 +01:00
|
|
|
};
|
|
|
|
|
|
2024-03-23 23:44:46 +01:00
|
|
|
export type MetadataBrowseSettings = {
|
|
|
|
|
hideLibraryEntries: boolean;
|
|
|
|
|
};
|
|
|
|
|
|
2024-04-20 22:14:01 +02:00
|
|
|
export type MetadataTrackingSettings = {
|
|
|
|
|
updateProgressAfterReading: boolean;
|
|
|
|
|
};
|
|
|
|
|
|
2024-03-16 16:21:15 +01:00
|
|
|
export type MetadataServerSettings = MetadataDownloadSettings &
|
|
|
|
|
MetadataLibrarySettings &
|
|
|
|
|
MetadataClientSettings &
|
2024-03-23 23:44:46 +01:00
|
|
|
MetadataMigrationSettings &
|
2024-04-20 22:14:01 +02:00
|
|
|
MetadataBrowseSettings &
|
|
|
|
|
MetadataTrackingSettings;
|
2024-03-16 16:21:15 +01:00
|
|
|
|
2023-03-04 22:21:24 +05:30
|
|
|
export interface ISearchSettings {
|
|
|
|
|
ignoreFilters: boolean;
|
|
|
|
|
}
|
|
|
|
|
|
2023-02-24 16:40:37 +01:00
|
|
|
export interface IReaderPage {
|
2023-02-06 10:06:33 +01:00
|
|
|
index: number;
|
|
|
|
|
src: string;
|
2021-05-15 17:18:57 +04:30
|
|
|
}
|
2021-05-15 23:22:37 +04:30
|
|
|
|
2023-02-24 16:40:37 +01:00
|
|
|
export interface IReaderProps {
|
2023-02-06 10:06:33 +01:00
|
|
|
pages: Array<IReaderPage>;
|
|
|
|
|
pageCount: number;
|
|
|
|
|
setCurPage: React.Dispatch<React.SetStateAction<number>>;
|
|
|
|
|
curPage: number;
|
|
|
|
|
initialPage: number;
|
|
|
|
|
settings: IReaderSettings;
|
2023-10-15 16:03:08 +02:00
|
|
|
manga: TManga;
|
|
|
|
|
chapter: TChapter;
|
2023-02-06 10:06:33 +01:00
|
|
|
nextChapter: () => void;
|
|
|
|
|
prevChapter: () => void;
|
2021-05-15 23:22:37 +04:30
|
|
|
}
|
2021-05-25 21:06:27 +04:30
|
|
|
|
2023-02-24 16:40:37 +01:00
|
|
|
export interface IDownloadChapter {
|
2023-02-06 10:06:33 +01:00
|
|
|
chapterIndex: number;
|
|
|
|
|
mangaId: number;
|
|
|
|
|
state: 'Queued' | 'Downloading' | 'Finished' | 'Error';
|
|
|
|
|
progress: number;
|
|
|
|
|
chapter: IChapter;
|
|
|
|
|
manga: IManga;
|
2021-05-30 04:01:49 +04:30
|
|
|
}
|
|
|
|
|
|
2023-02-24 16:40:37 +01:00
|
|
|
export interface IQueue {
|
2023-02-06 10:06:33 +01:00
|
|
|
status: 'Stopped' | 'Started';
|
|
|
|
|
queue: IDownloadChapter[];
|
2021-05-30 04:01:49 +04:30
|
|
|
}
|
2021-08-06 04:53:53 +04:30
|
|
|
|
2023-02-24 16:40:37 +01:00
|
|
|
export interface IUpdateStatus {
|
2023-02-06 10:06:33 +01:00
|
|
|
running: boolean;
|
2023-08-28 23:47:40 +02:00
|
|
|
mangaStatusMap: {
|
2023-02-06 10:06:33 +01:00
|
|
|
COMPLETE?: IManga[];
|
|
|
|
|
RUNNING?: IManga[];
|
|
|
|
|
PENDING?: IManga[];
|
|
|
|
|
};
|
2022-04-18 10:26:36 +02:00
|
|
|
}
|
|
|
|
|
|
2023-09-25 23:32:26 +02:00
|
|
|
export type SourcePreferences = GetSourceQuery['source']['preferences'][number];
|
2021-09-13 19:18:21 +04:30
|
|
|
|
2023-09-25 23:32:26 +02:00
|
|
|
export interface PreferenceProps {
|
|
|
|
|
updateValue: <Key extends keyof Omit<SourcePreferenceChangeInput, 'position'>>(
|
|
|
|
|
type: Key,
|
|
|
|
|
value: SourcePreferenceChangeInput[Key],
|
|
|
|
|
) => void;
|
2021-08-06 04:53:53 +04:30
|
|
|
}
|
|
|
|
|
|
2023-09-25 23:32:26 +02:00
|
|
|
export type TwoStatePreferenceProps = (CheckBoxPreferenceProps | SwitchPreferenceCompatProps) & {
|
2021-09-13 19:18:21 +04:30
|
|
|
// intetnal props
|
2023-09-25 23:32:26 +02:00
|
|
|
twoStateType: 'Switch' | 'Checkbox';
|
|
|
|
|
};
|
2021-11-29 19:08:02 +03:30
|
|
|
|
2023-09-25 23:32:26 +02:00
|
|
|
export type CheckBoxPreferenceProps = PreferenceProps &
|
|
|
|
|
ExtractByKeyValue<SourcePreferences, '__typename', 'CheckBoxPreference'>;
|
2021-11-29 19:08:02 +03:30
|
|
|
|
2023-09-25 23:32:26 +02:00
|
|
|
export type SwitchPreferenceCompatProps = PreferenceProps &
|
|
|
|
|
ExtractByKeyValue<SourcePreferences, '__typename', 'SwitchPreference'>;
|
2021-11-29 19:08:02 +03:30
|
|
|
|
2023-09-25 23:32:26 +02:00
|
|
|
export type ListPreferenceProps = PreferenceProps &
|
|
|
|
|
ExtractByKeyValue<SourcePreferences, '__typename', 'ListPreference'>;
|
2021-11-29 19:08:02 +03:30
|
|
|
|
2023-09-25 23:32:26 +02:00
|
|
|
export type MultiSelectListPreferenceProps = PreferenceProps &
|
|
|
|
|
ExtractByKeyValue<SourcePreferences, '__typename', 'MultiSelectListPreference'>;
|
2021-09-13 19:18:21 +04:30
|
|
|
|
2023-09-25 23:32:26 +02:00
|
|
|
export type EditTextPreferenceProps = PreferenceProps &
|
|
|
|
|
ExtractByKeyValue<SourcePreferences, '__typename', 'EditTextPreference'>;
|
2021-10-24 21:34:38 +05:30
|
|
|
|
2023-02-24 16:40:37 +01:00
|
|
|
export interface NavbarItem {
|
2023-02-06 10:06:33 +01:00
|
|
|
path: string;
|
2023-03-23 13:59:32 +01:00
|
|
|
title: TranslationKey;
|
2023-02-06 10:06:33 +01:00
|
|
|
SelectedIconComponent: OverridableComponent<SvgIconTypeMap<{}, 'svg'>>;
|
|
|
|
|
IconComponent: OverridableComponent<SvgIconTypeMap<{}, 'svg'>>;
|
|
|
|
|
show: 'mobile' | 'desktop' | 'both';
|
2021-10-24 21:34:38 +05:30
|
|
|
}
|
2021-11-10 23:04:04 +03:30
|
|
|
|
2023-02-24 16:40:37 +01:00
|
|
|
export interface PaginatedList<T> {
|
2023-02-06 10:06:33 +01:00
|
|
|
page: T[];
|
|
|
|
|
hasNextPage: boolean;
|
2021-11-10 23:04:04 +03:30
|
|
|
}
|
2021-12-13 19:52:56 +05:30
|
|
|
|
2023-05-20 13:12:23 +02:00
|
|
|
export type PaginatedMangaList = {
|
|
|
|
|
mangaList: IManga[];
|
|
|
|
|
hasNextPage: boolean;
|
|
|
|
|
};
|
|
|
|
|
|
2023-02-24 16:40:37 +01:00
|
|
|
export type NullAndUndefined<T> = T | null | undefined;
|
2021-12-13 19:52:56 +05:30
|
|
|
|
2023-02-24 16:40:37 +01:00
|
|
|
export type ChapterSortMode = 'fetchedAt' | 'source';
|
2021-12-13 19:52:56 +05:30
|
|
|
|
2023-02-24 16:40:37 +01:00
|
|
|
export interface ChapterListOptions {
|
2023-02-06 10:06:33 +01:00
|
|
|
active: boolean;
|
|
|
|
|
unread: NullAndUndefined<boolean>;
|
|
|
|
|
downloaded: NullAndUndefined<boolean>;
|
|
|
|
|
bookmarked: NullAndUndefined<boolean>;
|
|
|
|
|
reverse: boolean;
|
|
|
|
|
sortBy: ChapterSortMode;
|
|
|
|
|
showChapterNumber: boolean;
|
2021-12-13 19:52:56 +05:30
|
|
|
}
|
2022-01-24 15:09:28 +05:30
|
|
|
|
2023-02-24 16:40:37 +01:00
|
|
|
export type ChapterOptionsReducerAction =
|
2023-02-06 10:06:33 +01:00
|
|
|
| { type: 'filter'; filterType: string; filterValue: NullAndUndefined<boolean> }
|
|
|
|
|
| { type: 'sortBy'; sortBy: ChapterSortMode }
|
|
|
|
|
| { type: 'sortReverse' }
|
|
|
|
|
| { type: 'showChapterNumber' };
|
2022-03-03 18:19:01 +05:30
|
|
|
|
2024-01-11 03:56:04 +01:00
|
|
|
export type LibrarySortMode =
|
|
|
|
|
| 'sortToRead'
|
|
|
|
|
| 'sortAlph'
|
|
|
|
|
| 'sortDateAdded'
|
|
|
|
|
| 'sortLastRead'
|
|
|
|
|
| 'sortLatestFetchedChapter'
|
|
|
|
|
| 'sortLatestUploadedChapter';
|
2022-11-24 09:41:03 +01:00
|
|
|
|
2022-12-20 07:05:31 +02:00
|
|
|
enum GridLayout {
|
|
|
|
|
Compact = 0,
|
|
|
|
|
Comfortable = 1,
|
|
|
|
|
List = 2,
|
|
|
|
|
}
|
|
|
|
|
|
2023-02-24 16:40:37 +01:00
|
|
|
export interface LibraryOptions {
|
2022-04-07 12:53:14 +02:00
|
|
|
// display options
|
2023-12-19 15:17:00 +01:00
|
|
|
showContinueReadingButton: boolean;
|
2023-02-06 10:06:33 +01:00
|
|
|
showDownloadBadge: boolean;
|
|
|
|
|
showUnreadBadge: boolean;
|
|
|
|
|
gridLayout: GridLayout;
|
|
|
|
|
SourcegridLayout: GridLayout;
|
2022-04-07 12:53:14 +02:00
|
|
|
|
|
|
|
|
// filter options
|
2023-02-06 10:06:33 +01:00
|
|
|
downloaded: NullAndUndefined<boolean>;
|
2024-04-01 01:12:26 +02:00
|
|
|
bookmarked: NullAndUndefined<boolean>;
|
2023-02-06 10:06:33 +01:00
|
|
|
unread: NullAndUndefined<boolean>;
|
|
|
|
|
sorts: NullAndUndefined<LibrarySortMode>;
|
|
|
|
|
sortDesc: NullAndUndefined<boolean>;
|
2023-04-22 11:39:59 +02:00
|
|
|
showTabSize: boolean;
|
2024-03-28 20:00:46 +01:00
|
|
|
tracker: Record<TBaseTracker['id'], NullAndUndefined<boolean>>;
|
2022-03-03 18:19:01 +05:30
|
|
|
}
|
2022-11-21 01:33:21 +01:00
|
|
|
|
2023-05-18 13:25:19 +02:00
|
|
|
export type UpdateCheck = {
|
|
|
|
|
channel: 'Stable' | 'Preview';
|
|
|
|
|
tag: string;
|
|
|
|
|
url: string;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export type SourceSearchResult = {
|
|
|
|
|
mangaList: IManga[];
|
|
|
|
|
hasNextPage: boolean;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export type BackupValidationResult = {
|
|
|
|
|
missingSources: string[];
|
|
|
|
|
missingTrackers: string[];
|
|
|
|
|
mangasMissingSources: string[];
|
|
|
|
|
};
|
2023-10-29 02:01:59 +02:00
|
|
|
|
|
|
|
|
export type ServerSettings = GetServerSettingsQuery['settings'];
|