remove manually created typing d ts file (#249)

* Rename file

".d.ts" files are files that are automatically generated during compilation (in case option is set) and shouldn't be created manually.

* Export types and interfaces

* Add missing imports
This commit is contained in:
Daniel
2023-02-24 16:40:37 +01:00
committed by GitHub
parent 1914a61edd
commit 96fd1cf73b
57 changed files with 117 additions and 47 deletions

View File

@@ -14,6 +14,7 @@ import Typography from '@mui/material/Typography';
import client from 'util/client'; import client from 'util/client';
import useLocalStorage from 'util/useLocalStorage'; import useLocalStorage from 'util/useLocalStorage';
import { Box } from '@mui/system'; import { Box } from '@mui/system';
import { IExtension } from 'typings';
interface IProps { interface IProps {
extension: IExtension; extension: IExtension;

View File

@@ -16,6 +16,7 @@ import SpinnerImage from 'components/util/SpinnerImage';
import { Box, styled } from '@mui/system'; import { Box, styled } from '@mui/system';
import { GridLayout, useLibraryOptionsContext } from 'components/context/LibraryOptionsContext'; import { GridLayout, useLibraryOptionsContext } from 'components/context/LibraryOptionsContext';
import { BACK } from 'util/useBackTo'; import { BACK } from 'util/useBackTo';
import { IMangaCard } from 'typings';
const BottomGradient = styled('div')({ const BottomGradient = styled('div')({
position: 'absolute', position: 'absolute',

View File

@@ -13,6 +13,7 @@ import { Typography } from '@mui/material';
import { Box } from '@mui/system'; import { Box } from '@mui/system';
import MangaCard from 'components/MangaCard'; import MangaCard from 'components/MangaCard';
import { GridLayout } from 'components/context/LibraryOptionsContext'; import { GridLayout } from 'components/context/LibraryOptionsContext';
import { IMangaCard } from 'typings';
export interface IMangaGridProps { export interface IMangaGridProps {
mangas: IMangaCard[]; mangas: IMangaCard[];

View File

@@ -16,6 +16,7 @@ import React from 'react';
import { Link, useHistory } from 'react-router-dom'; import { Link, useHistory } from 'react-router-dom';
import { langCodeToName } from 'util/language'; import { langCodeToName } from 'util/language';
import useLocalStorage from 'util/useLocalStorage'; import useLocalStorage from 'util/useLocalStorage';
import { ISource } from 'typings';
const MobileWidthButtons = styled('div')(({ theme }) => ({ const MobileWidthButtons = styled('div')(({ theme }) => ({
display: 'flex', display: 'flex',

View File

@@ -6,6 +6,7 @@
* 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 React, { useContext } from 'react'; import React, { useContext } from 'react';
import { LibraryOptions } from 'typings';
type ContextType = { type ContextType = {
options: LibraryOptions; options: LibraryOptions;

View File

@@ -6,6 +6,7 @@
* 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 React, { useContext, useEffect } from 'react'; import React, { useContext, useEffect } from 'react';
import { INavbarOverride } from 'typings';
type ContextType = { type ContextType = {
// Default back button url // Default back button url

View File

@@ -11,6 +11,7 @@ import MangaGrid from 'components/MangaGrid';
import { useLibraryOptionsContext } from 'components/context/LibraryOptionsContext'; import { useLibraryOptionsContext } from 'components/context/LibraryOptionsContext';
import { StringParam, useQueryParam } from 'use-query-params'; import { StringParam, useQueryParam } from 'use-query-params';
import { useMediaQuery, useTheme } from '@mui/material'; import { useMediaQuery, useTheme } from '@mui/material';
import { IMangaCard, LibrarySortMode, NullAndUndefined } from 'typings';
const FILTERED_OUT_MESSAGE = 'There are no Manga matching this filter'; const FILTERED_OUT_MESSAGE = 'There are no Manga matching this filter';

View File

@@ -13,6 +13,7 @@ import ThreeStateCheckboxInput from 'components/atoms/ThreeStateCheckboxInput';
import { GridLayout, useLibraryOptionsContext } from 'components/context/LibraryOptionsContext'; import { GridLayout, useLibraryOptionsContext } from 'components/context/LibraryOptionsContext';
import OptionsTabs from 'components/molecules/OptionsTabs'; import OptionsTabs from 'components/molecules/OptionsTabs';
import React from 'react'; import React from 'react';
import { LibraryOptions, LibrarySortMode } from 'typings';
const TITLES = { const TITLES = {
filter: 'Filter', filter: 'Filter',

View File

@@ -8,6 +8,7 @@
import LibraryOptionsContext, { DefaultLibraryOptions } from 'components/context/LibraryOptionsContext'; import LibraryOptionsContext, { DefaultLibraryOptions } from 'components/context/LibraryOptionsContext';
import React from 'react'; import React from 'react';
import useLocalStorage from 'util/useLocalStorage'; import useLocalStorage from 'util/useLocalStorage';
import { LibraryOptions } from 'typings';
interface IProps { interface IProps {
children: React.ReactNode; children: React.ReactNode;

View File

@@ -6,6 +6,7 @@ import { Box } from '@mui/system';
import Typography from '@mui/material/Typography'; import Typography from '@mui/material/Typography';
import client from 'util/client'; import client from 'util/client';
import makeToast from 'components/util/Toast'; import makeToast from 'components/util/Toast';
import { IUpdateStatus } from 'typings';
interface IProgressProps { interface IProgressProps {
progress: number; progress: number;

View File

@@ -29,6 +29,7 @@ import { Link } from 'react-router-dom';
import client from 'util/client'; import client from 'util/client';
import { BACK } from 'util/useBackTo'; import { BACK } from 'util/useBackTo';
import { getUploadDateString } from 'util/date'; import { getUploadDateString } from 'util/date';
import { IChapter, IDownloadChapter } from 'typings';
interface IProps { interface IProps {
chapter: IChapter; chapter: IChapter;

View File

@@ -20,6 +20,7 @@ import { Virtuoso } from 'react-virtuoso';
import client, { useQuery } from 'util/client'; import client, { useQuery } from 'util/client';
import ChaptersToolbarMenu from 'components/manga/ChaptersToolbarMenu'; import ChaptersToolbarMenu from 'components/manga/ChaptersToolbarMenu';
import SelectionFAB from 'components/manga/SelectionFAB'; import SelectionFAB from 'components/manga/SelectionFAB';
import { BatchChaptersChange, IChapter, IDownloadChapter, IQueue } from 'typings';
const StyledVirtuoso = styled(Virtuoso)(({ theme }) => ({ const StyledVirtuoso = styled(Virtuoso)(({ theme }) => ({
listStyle: 'none', listStyle: 'none',

View File

@@ -12,6 +12,7 @@ import ThreeStateCheckboxInput from 'components/atoms/ThreeStateCheckboxInput';
import OptionsTabs from 'components/molecules/OptionsTabs'; import OptionsTabs from 'components/molecules/OptionsTabs';
import React from 'react'; import React from 'react';
import { SORT_OPTIONS } from 'components/manga/util'; import { SORT_OPTIONS } from 'components/manga/util';
import { ChapterListOptions, ChapterOptionsReducerAction } from 'typings';
interface IProps { interface IProps {
open: boolean; open: boolean;

View File

@@ -10,6 +10,7 @@ import { IconButton } from '@mui/material';
import * as React from 'react'; import * as React from 'react';
import ChapterOptions from 'components/manga/ChapterOptions'; import ChapterOptions from 'components/manga/ChapterOptions';
import { isFilterActive } from 'components/manga/util'; import { isFilterActive } from 'components/manga/util';
import { ChapterListOptions, ChapterOptionsReducerAction } from 'typings';
interface IProps { interface IProps {
options: ChapterListOptions; options: ChapterListOptions;

View File

@@ -16,6 +16,7 @@ import React from 'react';
import { mutate } from 'swr'; import { mutate } from 'swr';
import client from 'util/client'; import client from 'util/client';
import useLocalStorage from 'util/useLocalStorage'; import useLocalStorage from 'util/useLocalStorage';
import { IManga, ISource } from 'typings';
const useStyles = (inLibrary: boolean) => const useStyles = (inLibrary: boolean) =>
makeStyles((theme: Theme) => ({ makeStyles((theme: Theme) => ({

View File

@@ -20,6 +20,7 @@ import {
} from '@mui/material'; } from '@mui/material';
import CategorySelect from 'components/navbar/action/CategorySelect'; import CategorySelect from 'components/navbar/action/CategorySelect';
import React, { useState } from 'react'; import React, { useState } from 'react';
import { IManga } from 'typings';
interface IProps { interface IProps {
manga: IManga; manga: IManga;

View File

@@ -10,6 +10,7 @@ import { Fab } from '@mui/material';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { PlayArrow } from '@mui/icons-material'; import { PlayArrow } from '@mui/icons-material';
import { BACK } from 'util/useBackTo'; import { BACK } from 'util/useBackTo';
import { IChapter } from 'typings';
interface ResumeFABProps { interface ResumeFABProps {
chapter: IChapter; chapter: IChapter;

View File

@@ -6,6 +6,7 @@
* 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 { useReducerLocalStorage } from 'util/useLocalStorage'; import { useReducerLocalStorage } from 'util/useLocalStorage';
import { ChapterListOptions, ChapterOptionsReducerAction, ChapterSortMode, IChapter, NullAndUndefined } from 'typings';
const defaultChapterOptions: ChapterListOptions = { const defaultChapterOptions: ChapterListOptions = {
active: false, active: false,

View File

@@ -10,6 +10,7 @@ import { CircularProgress } from '@mui/material';
import Typography from '@mui/material/Typography'; import Typography from '@mui/material/Typography';
import { Box } from '@mui/system'; import { Box } from '@mui/system';
import React from 'react'; import React from 'react';
import { IDownloadChapter } from 'typings';
interface DownloadStateIndicatorProps { interface DownloadStateIndicatorProps {
download: IDownloadChapter; download: IDownloadChapter;

View File

@@ -33,6 +33,7 @@ import DesktopSideBar from 'components/navbar/navigation/DesktopSideBar';
import MobileBottomBar from 'components/navbar/navigation/MobileBottomBar'; import MobileBottomBar from 'components/navbar/navigation/MobileBottomBar';
// import { useTranslation } from 'react-i18next'; // import { useTranslation } from 'react-i18next';
import { t } from 'i18next'; import { t } from 'i18next';
import { NavbarItem } from 'typings';
const navbarItems: Array<NavbarItem> = [ const navbarItems: Array<NavbarItem> = [
{ {

View File

@@ -7,6 +7,7 @@
import React, { useState } from 'react'; import React, { useState } from 'react';
import NavBarContext from 'components/context/NavbarContext'; import NavBarContext from 'components/context/NavbarContext';
import { INavbarOverride } from 'typings';
interface IProps { interface IProps {
children: React.ReactNode; children: React.ReactNode;

View File

@@ -25,6 +25,7 @@ import Collapse from '@mui/material/Collapse';
import { styled } from '@mui/system'; import { styled } from '@mui/system';
import useBackTo from 'util/useBackTo'; import useBackTo from 'util/useBackTo';
import ReaderSettingsOptions from 'components/reader/ReaderSettingsOptions'; import ReaderSettingsOptions from 'components/reader/ReaderSettingsOptions';
import { IChapter, IManga, IMangaCard, IReaderSettings } from 'typings';
const Root = styled('div')(({ theme }) => ({ const Root = styled('div')(({ theme }) => ({
top: 0, top: 0,

View File

@@ -15,6 +15,7 @@ import Checkbox from '@mui/material/Checkbox';
import FormControlLabel from '@mui/material/FormControlLabel'; import FormControlLabel from '@mui/material/FormControlLabel';
import FormGroup from '@mui/material/FormGroup'; import FormGroup from '@mui/material/FormGroup';
import client, { useQuery } from 'util/client'; import client, { useQuery } from 'util/client';
import { ICategory } from 'typings';
interface IProps { interface IProps {
open: boolean; open: boolean;

View File

@@ -10,6 +10,7 @@ import { ListItem, ListItemIcon, Tooltip } from '@mui/material';
import { Link, useLocation } from 'react-router-dom'; import { Link, useLocation } from 'react-router-dom';
import { styled } from '@mui/system'; import { styled } from '@mui/system';
import { useTheme } from '@mui/material/styles'; import { useTheme } from '@mui/material/styles';
import { NavbarItem } from 'typings';
const SideNavBarContainer = styled('div')(({ theme }) => ({ const SideNavBarContainer = styled('div')(({ theme }) => ({
height: '100vh', height: '100vh',

View File

@@ -10,6 +10,7 @@ import { ListItem } from '@mui/material';
import { styled, Box } from '@mui/system'; import { styled, Box } from '@mui/system';
import { Link as RRDLink, useLocation } from 'react-router-dom'; import { Link as RRDLink, useLocation } from 'react-router-dom';
import { useTheme } from '@mui/material/styles'; import { useTheme } from '@mui/material/styles';
import { NavbarItem } from 'typings';
const BottomNavContainer = styled('div')(({ theme }) => ({ const BottomNavContainer = styled('div')(({ theme }) => ({
bottom: 0, bottom: 0,

View File

@@ -7,6 +7,7 @@
import React from 'react'; import React from 'react';
import { Box, styled } from '@mui/system'; import { Box, styled } from '@mui/system';
import { IReaderSettings } from 'typings';
const Image = styled('img')({ const Image = styled('img')({
marginBottom: 0, marginBottom: 0,

View File

@@ -9,6 +9,7 @@ import React, { useRef } from 'react';
import SpinnerImage from 'components/util/SpinnerImage'; import SpinnerImage from 'components/util/SpinnerImage';
import useLocalStorage from 'util/useLocalStorage'; import useLocalStorage from 'util/useLocalStorage';
import Box from '@mui/system/Box'; import Box from '@mui/system/Box';
import { IReaderSettings } from 'typings';
function imageStyle(settings: IReaderSettings): any { function imageStyle(settings: IReaderSettings): any {
const [dimensions, setDimensions] = React.useState({ const [dimensions, setDimensions] = React.useState({

View File

@@ -7,6 +7,7 @@
import React from 'react'; import React from 'react';
import { Box } from '@mui/system'; import { Box } from '@mui/system';
import { IReaderSettings } from 'typings';
interface IProps { interface IProps {
settings: IReaderSettings; settings: IReaderSettings;

View File

@@ -11,6 +11,7 @@ import ListItemSecondaryAction from '@mui/material/ListItemSecondaryAction';
import Select from '@mui/material/Select'; import Select from '@mui/material/Select';
import MenuItem from '@mui/material/MenuItem'; import MenuItem from '@mui/material/MenuItem';
import React from 'react'; import React from 'react';
import { IReaderSettings } from 'typings';
interface IProps extends IReaderSettings { interface IProps extends IReaderSettings {
setSettingValue: (key: keyof IReaderSettings, value: string | boolean) => void; setSettingValue: (key: keyof IReaderSettings, value: string | boolean) => void;

View File

@@ -10,6 +10,7 @@ import ReactDOM from 'react-dom';
import { Box } from '@mui/system'; import { Box } from '@mui/system';
import Page from 'components/reader/Page'; import Page from 'components/reader/Page';
import DoublePage from 'components/reader/DoublePage'; import DoublePage from 'components/reader/DoublePage';
import { IReaderProps } from 'typings';
const isSpreadPage = (image: HTMLImageElement): boolean => { const isSpreadPage = (image: HTMLImageElement): boolean => {
const aspectRatio = image.height / image.width; const aspectRatio = image.height / image.width;

View File

@@ -8,6 +8,7 @@
import React, { useEffect, useRef } from 'react'; import React, { useEffect, useRef } from 'react';
import { Box } from '@mui/system'; import { Box } from '@mui/system';
import Page from 'components/reader/Page'; import Page from 'components/reader/Page';
import { IReaderProps } from 'typings';
const findCurrentPageIndex = (wrapper: HTMLDivElement): number => { const findCurrentPageIndex = (wrapper: HTMLDivElement): number => {
for (let i = 0; i < wrapper.children.length; i++) { for (let i = 0; i < wrapper.children.length; i++) {

View File

@@ -8,6 +8,7 @@
import React, { useEffect, useRef } from 'react'; import React, { useEffect, useRef } from 'react';
import { Box } from '@mui/system'; import { Box } from '@mui/system';
import Page from 'components/reader/Page'; import Page from 'components/reader/Page';
import { IReaderProps } from 'typings';
export default function PagedReader(props: IReaderProps) { export default function PagedReader(props: IReaderProps) {
const { pages, settings, setCurPage, initialPage, curPage, nextChapter, prevChapter } = props; const { pages, settings, setCurPage, initialPage, curPage, nextChapter, prevChapter } = props;

View File

@@ -8,6 +8,7 @@
import React, { useCallback, useEffect, useRef } from 'react'; import React, { useCallback, useEffect, useRef } from 'react';
import { Box } from '@mui/system'; import { Box } from '@mui/system';
import Page from 'components/reader/Page'; import Page from 'components/reader/Page';
import { IReaderProps } from 'typings';
const findCurrentPageIndex = (wrapper: HTMLDivElement): number => { const findCurrentPageIndex = (wrapper: HTMLDivElement): number => {
for (let i = 0; i < wrapper.children.length; i++) { for (let i = 0; i < wrapper.children.length; i++) {

View File

@@ -8,6 +8,7 @@
import React from 'react'; import React from 'react';
import MangaGrid, { IMangaGridProps } from 'components/MangaGrid'; import MangaGrid, { IMangaGridProps } from 'components/MangaGrid';
import { IMangaCard } from 'typings';
const FILTERED_OUT_MESSAGE = 'There are no Manga matching this filter'; const FILTERED_OUT_MESSAGE = 'There are no Manga matching this filter';

View File

@@ -21,6 +21,7 @@ import TriStateFilter from 'components/source/filters/TriStateFilter';
// eslint-disable-next-line import/no-cycle // eslint-disable-next-line import/no-cycle
import GroupFilter from 'components/source/filters/GroupFilter'; import GroupFilter from 'components/source/filters/GroupFilter';
import SeperatorFilter from 'components/source/filters/SeparatorFilter'; import SeperatorFilter from 'components/source/filters/SeparatorFilter';
import { ISourceFilters, IState } from 'typings';
interface IFilters { interface IFilters {
sourceFilter: ISourceFilters[]; sourceFilter: ISourceFilters[];

View File

@@ -11,6 +11,7 @@ import { Box } from '@mui/system';
import React from 'react'; import React from 'react';
// eslint-disable-next-line import/no-cycle // eslint-disable-next-line import/no-cycle
import { Options } from 'components/source/SourceOptions'; import { Options } from 'components/source/SourceOptions';
import { ISourceFilters } from 'typings';
interface Props { interface Props {
state: ISourceFilters[]; state: ISourceFilters[];

View File

@@ -10,6 +10,7 @@ import { Collapse, ListItemButton, ListItemText, Stack } from '@mui/material';
import { Box } from '@mui/system'; import { Box } from '@mui/system';
import SortRadioInput from 'components/atoms/SortRadioInput'; import SortRadioInput from 'components/atoms/SortRadioInput';
import React from 'react'; import React from 'react';
import { IState } from 'typings';
interface Props { interface Props {
values: any; values: any;

View File

@@ -15,6 +15,7 @@ import DialogContentText from '@mui/material/DialogContentText';
import DialogActions from '@mui/material/DialogActions'; import DialogActions from '@mui/material/DialogActions';
import TextField from '@mui/material/TextField'; import TextField from '@mui/material/TextField';
import Button from '@mui/material/Button'; import Button from '@mui/material/Button';
import { EditTextPreferenceProps } from 'typings';
export default function EditTextPreference(props: EditTextPreferenceProps) { export default function EditTextPreference(props: EditTextPreferenceProps) {
const { title, summary, dialogTitle, dialogMessage, currentValue, updateValue } = props; const { title, summary, dialogTitle, dialogMessage, currentValue, updateValue } = props;

View File

@@ -16,6 +16,7 @@ import RadioGroup from '@mui/material/RadioGroup';
import Radio from '@mui/material/Radio'; import Radio from '@mui/material/Radio';
import FormControlLabel from '@mui/material/FormControlLabel'; import FormControlLabel from '@mui/material/FormControlLabel';
import Button from '@mui/material/Button'; import Button from '@mui/material/Button';
import { ListPreferenceProps } from 'typings';
interface IListDialogProps { interface IListDialogProps {
value: string; value: string;

View File

@@ -17,6 +17,7 @@ import Checkbox from '@mui/material/Checkbox';
import FormControlLabel from '@mui/material/FormControlLabel'; import FormControlLabel from '@mui/material/FormControlLabel';
import Button from '@mui/material/Button'; import Button from '@mui/material/Button';
import cloneObject from 'util/cloneObject'; import cloneObject from 'util/cloneObject';
import { MultiSelectListPreferenceProps } from 'typings';
interface IListDialogProps { interface IListDialogProps {
selectedValues: string[]; selectedValues: string[];

View File

@@ -11,6 +11,7 @@ import ListItemText from '@mui/material/ListItemText';
import ListItemSecondaryAction from '@mui/material/ListItemSecondaryAction'; import ListItemSecondaryAction from '@mui/material/ListItemSecondaryAction';
import Switch from '@mui/material/Switch'; import Switch from '@mui/material/Switch';
import Checkbox from '@mui/material/Checkbox'; import Checkbox from '@mui/material/Checkbox';
import { CheckBoxPreferenceProps, SwitchPreferenceCompatProps, TwoStatePreferenceProps } from 'typings';
function getTwoStateType(type: 'Checkbox' | 'Switch') { function getTwoStateType(type: 'Checkbox' | 'Switch') {
if (type === 'Switch') { if (type === 'Switch') {

View File

@@ -27,6 +27,7 @@ import { NavbarToolbar } from 'components/navbar/DefaultNavBar';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { BACK } from 'util/useBackTo'; import { BACK } from 'util/useBackTo';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { IChapter, IQueue } from 'typings';
const initialQueue = { const initialQueue = {
status: 'Stopped', status: 'Stopped',

View File

@@ -21,6 +21,7 @@ import AppbarSearch from 'components/util/AppbarSearch';
import { useQueryParam, StringParam } from 'use-query-params'; import { useQueryParam, StringParam } from 'use-query-params';
import { Virtuoso } from 'react-virtuoso'; import { Virtuoso } from 'react-virtuoso';
import { Typography, useMediaQuery, useTheme } from '@mui/material'; import { Typography, useMediaQuery, useTheme } from '@mui/material';
import { IExtension } from 'typings';
const LANGUAGE = 0; const LANGUAGE = 0;
const EXTENSIONS = 1; const EXTENSIONS = 1;

View File

@@ -18,6 +18,7 @@ import { useQueryParam, NumberParam } from 'use-query-params';
import { useQuery } from 'util/client'; import { useQuery } from 'util/client';
import UpdateChecker from 'components/library/UpdateChecker'; import UpdateChecker from 'components/library/UpdateChecker';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { ICategory, IManga } from 'typings';
export default function Library() { export default function Library() {
const { t } = useTranslation(); const { t } = useTranslation();

View File

@@ -19,6 +19,7 @@ import LoadingPlaceholder from 'components/util/LoadingPlaceholder';
import React, { useContext, useEffect, useRef } from 'react'; import React, { useContext, useEffect, useRef } from 'react';
import { useParams } from 'react-router-dom'; import { useParams } from 'react-router-dom';
import { useQuery } from 'util/client'; import { useQuery } from 'util/client';
import { IManga } from 'typings';
const AUTOFETCH_AGE = 60 * 60 * 24; // 24 hours const AUTOFETCH_AGE = 60 * 60 * 24; // 24 hours

View File

@@ -25,6 +25,7 @@ import {
useDefaultReaderSettings, useDefaultReaderSettings,
} from 'util/readerSettings'; } from 'util/readerSettings';
import makeToast from 'components/util/Toast'; import makeToast from 'components/util/Toast';
import { IChapter, IManga, IMangaCard, IPartialChapter, IReaderSettings, ReaderType } from 'typings';
const getReaderComponent = (readerType: ReaderType) => { const getReaderComponent = (readerType: ReaderType) => {
switch (readerType) { switch (readerType) {

View File

@@ -18,6 +18,7 @@ import { StringParam, useQueryParam } from 'use-query-params';
import client from 'util/client'; import client from 'util/client';
import { langCodeToName, langSortCmp, sourceDefualtLangs, sourceForcedDefaultLangs } from 'util/language'; import { langCodeToName, langSortCmp, sourceDefualtLangs, sourceForcedDefaultLangs } from 'util/language';
import useLocalStorage from 'util/useLocalStorage'; import useLocalStorage from 'util/useLocalStorage';
import { ISource } from 'typings';
function sourceToLangList(sources: ISource[]) { function sourceToLangList(sources: ISource[]) {
const result: string[] = []; const result: string[] = [];

View File

@@ -15,6 +15,7 @@ import EditTextPreference from 'components/sourceConfiguration/EditTextPreferenc
import MultiSelectListPreference from 'components/sourceConfiguration/MultiSelectListPreference'; import MultiSelectListPreference from 'components/sourceConfiguration/MultiSelectListPreference';
import List from '@mui/material/List'; import List from '@mui/material/List';
import cloneObject from 'util/cloneObject'; import cloneObject from 'util/cloneObject';
import { SourcePreferences } from 'typings';
function getPrefComponent(type: string) { function getPrefComponent(type: string) {
switch (type) { switch (type) {

View File

@@ -17,6 +17,7 @@ import AppbarSearch from 'components/util/AppbarSearch';
import { useQueryParam, StringParam } from 'use-query-params'; import { useQueryParam, StringParam } from 'use-query-params';
import SourceGridLayout from 'components/source/GridLayouts'; import SourceGridLayout from 'components/source/GridLayouts';
import { useLibraryOptionsContext } from 'components/context/LibraryOptionsContext'; import { useLibraryOptionsContext } from 'components/context/LibraryOptionsContext';
import { IManga, IMangaCard, ISource, ISourceFilters } from 'typings';
interface IPos { interface IPos {
position: number; position: number;

View File

@@ -16,6 +16,7 @@ import { IconButton } from '@mui/material';
import TravelExploreIcon from '@mui/icons-material/TravelExplore'; import TravelExploreIcon from '@mui/icons-material/TravelExplore';
import { useHistory } from 'react-router-dom'; import { useHistory } from 'react-router-dom';
import { useQuery } from 'util/client'; import { useQuery } from 'util/client';
import { ISource } from 'typings';
function sourceToLangList(sources: ISource[]) { function sourceToLangList(sources: ISource[]) {
const result: string[] = []; const result: string[] = [];

View File

@@ -21,6 +21,7 @@ import React, { useContext, useEffect, useRef, useState } from 'react';
import { Link, useHistory } from 'react-router-dom'; import { Link, useHistory } from 'react-router-dom';
import client from 'util/client'; import client from 'util/client';
import useLocalStorage from 'util/useLocalStorage'; import useLocalStorage from 'util/useLocalStorage';
import { IChapter, IMangaChapter, IQueue, PaginatedList } from 'typings';
function epochToDate(epoch: number) { function epochToDate(epoch: number) {
const date = new Date(0); // The 0 there is the key, which sets the date to the epoch const date = new Date(0); // The 0 there is the key, which sets the date to the epoch

View File

@@ -6,6 +6,7 @@ import ListItemLink from 'components/util/ListItemLink';
import NavbarContext from 'components/context/NavbarContext'; import NavbarContext from 'components/context/NavbarContext';
import LoadingPlaceholder from 'components/util/LoadingPlaceholder'; import LoadingPlaceholder from 'components/util/LoadingPlaceholder';
import { useQuery } from 'util/client'; import { useQuery } from 'util/client';
import { IAbout } from 'typings';
export default function About() { export default function About() {
const { setTitle, setAction } = useContext(NavbarContext); const { setTitle, setAction } = useContext(NavbarContext);

View File

@@ -33,6 +33,7 @@ import Checkbox from '@mui/material/Checkbox';
import FormControlLabel from '@mui/material/FormControlLabel'; import FormControlLabel from '@mui/material/FormControlLabel';
import NavbarContext from 'components/context/NavbarContext'; import NavbarContext from 'components/context/NavbarContext';
import client, { useQuery } from 'util/client'; import client, { useQuery } from 'util/client';
import { ICategory } from 'typings';
const getItemStyle = ( const getItemStyle = (
isDragging: boolean, isDragging: boolean,

View File

@@ -20,6 +20,7 @@ import {
useDefaultReaderSettings, useDefaultReaderSettings,
} from 'util/readerSettings'; } from 'util/readerSettings';
import ReaderSettingsOptions from 'components/reader/ReaderSettingsOptions'; import ReaderSettingsOptions from 'components/reader/ReaderSettingsOptions';
import { IReaderSettings } from 'typings';
export default function DefaultReaderSettings() { export default function DefaultReaderSettings() {
const { setTitle, setAction } = useContext(NavbarContext); const { setTitle, setAction } = useContext(NavbarContext);

View File

@@ -5,7 +5,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
interface IExtension { import { OverridableComponent } from '@mui/material/OverridableComponent';
import { SvgIconTypeMap } from '@mui/material/SvgIcon/SvgIcon';
export interface IExtension {
name: string; name: string;
pkgName: string; pkgName: string;
versionName: string; versionName: string;
@@ -19,7 +22,7 @@ interface IExtension {
obsolete: boolean; obsolete: boolean;
} }
interface ISource { export interface ISource {
id: string; id: string;
name: string; name: string;
lang: string; lang: string;
@@ -30,12 +33,12 @@ interface ISource {
displayName: string; displayName: string;
} }
interface ISourceFilters { export interface ISourceFilters {
type: string; type: string;
filter: ISourceFilter; filter: ISourceFilter;
} }
interface ISourceFilter { export interface ISourceFilter {
name: string; name: string;
state: number | string | boolean | ISourceFilters[] | IState; state: number | string | boolean | ISourceFilters[] | IState;
values?: string[]; values?: string[];
@@ -43,18 +46,18 @@ interface ISourceFilter {
selected?: ISelected; selected?: ISelected;
} }
interface ISelected { export interface ISelected {
displayname: string; displayname: string;
value: string; value: string;
_value: string; _value: string;
} }
interface IState { export interface IState {
ascending: boolean; ascending: boolean;
index: number; index: number;
} }
interface IMetadataMigration { export interface IMetadataMigration {
appKeyPrefix?: { oldPrefix: string; newPrefix: string }; appKeyPrefix?: { oldPrefix: string; newPrefix: string };
values?: { values?: {
/** /**
@@ -68,23 +71,23 @@ interface IMetadataMigration {
keys?: { oldKey: string; newKey: string }[]; keys?: { oldKey: string; newKey: string }[];
} }
interface IMetadata<VALUES extends AllowedMetadataValueTypes = string> { export interface IMetadata<VALUES extends AllowedMetadataValueTypes = string> {
[key: string]: VALUES; [key: string]: VALUES;
} }
interface IMetadataHolder<VALUES extends AllowedMetadataValueTypes = string> { export interface IMetadataHolder<VALUES extends AllowedMetadataValueTypes = string> {
meta?: IMetadata<VALUES>; meta?: IMetadata<VALUES>;
} }
type AllowedMetadataValueTypes = string | boolean | number | undefined; export type AllowedMetadataValueTypes = string | boolean | number | undefined;
type MangaMetadataKeys = keyof IReaderSettings; export type MangaMetadataKeys = keyof IReaderSettings;
type AppMetadataKeys = MangaMetadataKeys; export type AppMetadataKeys = MangaMetadataKeys;
type MetadataKeyValuePair = [AppMetadataKeys, AllowedMetadataValueTypes]; export type MetadataKeyValuePair = [AppMetadataKeys, AllowedMetadataValueTypes];
interface IMangaCard { export interface IMangaCard {
id: number; id: number;
title: string; title: string;
genre: string[]; genre: string[];
@@ -95,7 +98,7 @@ interface IMangaCard {
meta?: IMetadata; meta?: IMetadata;
} }
interface IManga { export interface IManga {
id: number; id: number;
sourceId: string; sourceId: string;
@@ -123,7 +126,7 @@ interface IManga {
chaptersAge: number; chaptersAge: number;
} }
interface IChapter { export interface IChapter {
id: number; id: number;
url: string; url: string;
name: string; name: string;
@@ -140,35 +143,35 @@ interface IChapter {
chapterCount: number; chapterCount: number;
pageCount: number; pageCount: number;
downloaded: boolean; downloaded: boolean;
meta: IAppMetadata; meta: IMetadata;
} }
interface IMangaChapter { export interface IMangaChapter {
manga: IManga; manga: IManga;
chapter: IChapter; chapter: IChapter;
} }
interface IPartialChapter { export interface IPartialChapter {
pageCount: number; pageCount: number;
index: number; index: number;
chapterCount: number; chapterCount: number;
lastPageRead: number; lastPageRead: number;
} }
interface ICategory { export interface ICategory {
id: number; id: number;
order: number; order: number;
name: string; name: string;
default: boolean; default: boolean;
meta: IAppMetadata; meta: IMetadata;
} }
interface INavbarOverride { export interface INavbarOverride {
status: boolean; status: boolean;
value: any; value: any;
} }
type ReaderType = export type ReaderType =
| 'ContinuesVertical' | 'ContinuesVertical'
| 'Webtoon' | 'Webtoon'
| 'SingleVertical' | 'SingleVertical'
@@ -180,19 +183,19 @@ type ReaderType =
| 'ContinuesHorizontalLTR' | 'ContinuesHorizontalLTR'
| 'ContinuesHorizontalRTL'; | 'ContinuesHorizontalRTL';
interface IReaderSettings { export interface IReaderSettings {
staticNav: boolean; staticNav: boolean;
showPageNumber: boolean; showPageNumber: boolean;
loadNextOnEnding: boolean; loadNextOnEnding: boolean;
readerType: ReaderType; readerType: ReaderType;
} }
interface IReaderPage { export interface IReaderPage {
index: number; index: number;
src: string; src: string;
} }
interface IReaderProps { export interface IReaderProps {
pages: Array<IReaderPage>; pages: Array<IReaderPage>;
pageCount: number; pageCount: number;
setCurPage: React.Dispatch<React.SetStateAction<number>>; setCurPage: React.Dispatch<React.SetStateAction<number>>;
@@ -205,7 +208,7 @@ interface IReaderProps {
prevChapter: () => void; prevChapter: () => void;
} }
interface IAbout { export interface IAbout {
name: string; name: string;
version: string; version: string;
revision: string; revision: string;
@@ -215,7 +218,7 @@ interface IAbout {
discord: string; discord: string;
} }
interface IDownloadChapter { export interface IDownloadChapter {
chapterIndex: number; chapterIndex: number;
mangaId: number; mangaId: number;
state: 'Queued' | 'Downloading' | 'Finished' | 'Error'; state: 'Queued' | 'Downloading' | 'Finished' | 'Error';
@@ -224,12 +227,12 @@ interface IDownloadChapter {
manga: IManga; manga: IManga;
} }
interface IQueue { export interface IQueue {
status: 'Stopped' | 'Started'; status: 'Stopped' | 'Started';
queue: IDownloadChapter[]; queue: IDownloadChapter[];
} }
interface IUpdateStatus { export interface IUpdateStatus {
running: boolean; running: boolean;
statusMap: { statusMap: {
COMPLETE?: IManga[]; COMPLETE?: IManga[];
@@ -238,7 +241,7 @@ interface IUpdateStatus {
}; };
} }
interface PreferenceProps { export interface PreferenceProps {
key: string; key: string;
title: string; title: string;
summary: string; summary: string;
@@ -250,37 +253,37 @@ interface PreferenceProps {
updateValue: any; updateValue: any;
} }
interface TwoStatePreferenceProps extends PreferenceProps { export interface TwoStatePreferenceProps extends PreferenceProps {
// intetnal props // intetnal props
type: 'Switch' | 'Checkbox'; type: 'Switch' | 'Checkbox';
} }
interface CheckBoxPreferenceProps extends PreferenceProps {} export interface CheckBoxPreferenceProps extends PreferenceProps {}
interface SwitchPreferenceCompatProps extends PreferenceProps {} export interface SwitchPreferenceCompatProps extends PreferenceProps {}
interface ListPreferenceProps extends PreferenceProps { export interface ListPreferenceProps extends PreferenceProps {
entries: string[]; entries: string[];
entryValues: string[]; entryValues: string[];
} }
interface MultiSelectListPreferenceProps extends PreferenceProps { export interface MultiSelectListPreferenceProps extends PreferenceProps {
entries: string[]; entries: string[];
entryValues: string[]; entryValues: string[];
} }
interface EditTextPreferenceProps extends PreferenceProps { export interface EditTextPreferenceProps extends PreferenceProps {
dialogTitle: string; dialogTitle: string;
dialogMessage: string; dialogMessage: string;
text: string; text: string;
} }
interface SourcePreferences { export interface SourcePreferences {
type: string; type: string;
props: any; props: any;
} }
interface NavbarItem { export interface NavbarItem {
path: string; path: string;
title: string; title: string;
SelectedIconComponent: OverridableComponent<SvgIconTypeMap<{}, 'svg'>>; SelectedIconComponent: OverridableComponent<SvgIconTypeMap<{}, 'svg'>>;
@@ -288,16 +291,16 @@ interface NavbarItem {
show: 'mobile' | 'desktop' | 'both'; show: 'mobile' | 'desktop' | 'both';
} }
interface PaginatedList<T> { export interface PaginatedList<T> {
page: T[]; page: T[];
hasNextPage: boolean; hasNextPage: boolean;
} }
type NullAndUndefined<T> = T | null | undefined; export type NullAndUndefined<T> = T | null | undefined;
type ChapterSortMode = 'fetchedAt' | 'source'; export type ChapterSortMode = 'fetchedAt' | 'source';
interface ChapterListOptions { export interface ChapterListOptions {
active: boolean; active: boolean;
unread: NullAndUndefined<boolean>; unread: NullAndUndefined<boolean>;
downloaded: NullAndUndefined<boolean>; downloaded: NullAndUndefined<boolean>;
@@ -307,13 +310,13 @@ interface ChapterListOptions {
showChapterNumber: boolean; showChapterNumber: boolean;
} }
type ChapterOptionsReducerAction = export type ChapterOptionsReducerAction =
| { type: 'filter'; filterType: string; filterValue: NullAndUndefined<boolean> } | { type: 'filter'; filterType: string; filterValue: NullAndUndefined<boolean> }
| { type: 'sortBy'; sortBy: ChapterSortMode } | { type: 'sortBy'; sortBy: ChapterSortMode }
| { type: 'sortReverse' } | { type: 'sortReverse' }
| { type: 'showChapterNumber' }; | { type: 'showChapterNumber' };
type LibrarySortMode = 'sortToRead' | 'sortAlph' | 'sortID'; export type LibrarySortMode = 'sortToRead' | 'sortAlph' | 'sortID';
enum GridLayout { enum GridLayout {
Compact = 0, Compact = 0,
@@ -321,7 +324,7 @@ enum GridLayout {
List = 2, List = 2,
} }
interface LibraryOptions { export interface LibraryOptions {
// display options // display options
showDownloadBadge: boolean; showDownloadBadge: boolean;
showUnreadBadge: boolean; showUnreadBadge: boolean;
@@ -335,7 +338,7 @@ interface LibraryOptions {
sortDesc: NullAndUndefined<boolean>; sortDesc: NullAndUndefined<boolean>;
} }
interface BatchChaptersChange { export interface BatchChaptersChange {
delete?: boolean; delete?: boolean;
isRead?: boolean; isRead?: boolean;
isBookmarked?: boolean; isBookmarked?: boolean;

View File

@@ -8,6 +8,18 @@
import { mutate } from 'swr'; import { mutate } from 'swr';
import client from 'util/client'; import client from 'util/client';
import {
AllowedMetadataValueTypes,
AppMetadataKeys,
ICategory,
IManga,
IMangaCard,
IMangaChapter,
IMetadata,
IMetadataHolder,
IMetadataMigration,
MetadataKeyValuePair,
} from 'typings';
const APP_METADATA_KEY_PREFIX = 'webUI_'; const APP_METADATA_KEY_PREFIX = 'webUI_';

View File

@@ -8,6 +8,7 @@
import { getMetadataFrom, requestUpdateMangaMetadata, requestUpdateServerMetadata } from 'util/metadata'; import { getMetadataFrom, requestUpdateMangaMetadata, requestUpdateServerMetadata } from 'util/metadata';
import { useQuery } from 'util/client'; import { useQuery } from 'util/client';
import { IManga, IMetadata, IMetadataHolder, IReaderSettings, MetadataKeyValuePair } from 'typings';
export const getDefaultSettings = (forceUndefined: boolean = false) => export const getDefaultSettings = (forceUndefined: boolean = false) =>
({ ({