Move to Zustand and add Filters to web_test (#1077)
* Moved to zustand and started refactored filters - Move from redux to zustand - Refactor Filters typings and add some helper types - Add Filters button and Picker/Switch filter options - Fixed Syosetu typings * Add rule consistent-type-definitions - Add consistent-type-definitions eslint rule to force consistent use of types instead of interfaces - Run eslint to auto-change every interface to types https://dev.to/atheodosiou/types-vs-interfaces-in-typescript-making-the-right-choice-48a4 https://www.youtube.com/watch?v=zM9UPcIyyhQ * Add other filters and refactor - Move Dialog to FiltersDialog - CheckboxFilter, TextFilter, XCheckboxFilter added - Added TripleCheckbox and TripleSwitch as tri-state checkbox/switch items using Mui stylings * TriStateCheckbox/Switch refactor - Change name of TripleSwitch and TripleCheckbox to TriState - Change slightly TriStateSwitch and StyledSwitch styles - Add option to change into TriStateSwitches via `localStorage` value `useSwitches` * Refactor code and fix issues * fix: prettier --------- Co-authored-by: nyagami <hoangquan05112002@gmail.com>
This commit is contained in:
@@ -143,7 +143,7 @@ class RNRF implements Plugin.PluginBase {
|
||||
|
||||
export default new RNRF();
|
||||
|
||||
interface response {
|
||||
type response = {
|
||||
props: Props;
|
||||
page: string;
|
||||
query: Query;
|
||||
@@ -152,25 +152,25 @@ interface response {
|
||||
gssp: boolean;
|
||||
appGip: boolean;
|
||||
dynamicIds?: string[];
|
||||
}
|
||||
};
|
||||
|
||||
interface Props {
|
||||
type Props = {
|
||||
pageProps: PageProps;
|
||||
isMobile: boolean;
|
||||
theme: string;
|
||||
__N_SSP: boolean;
|
||||
}
|
||||
};
|
||||
|
||||
interface PageProps {
|
||||
type PageProps = {
|
||||
initialReduxState: InitialReduxState;
|
||||
book?: PagePropsBook;
|
||||
totalData?: TotalData;
|
||||
layoutViewCookies?: string;
|
||||
displayBanner?: boolean;
|
||||
chapter?: PagePropsChapter;
|
||||
}
|
||||
};
|
||||
|
||||
interface PagePropsBook {
|
||||
type PagePropsBook = {
|
||||
id: number;
|
||||
countryId: number;
|
||||
creatorId: number;
|
||||
@@ -215,9 +215,9 @@ interface PagePropsBook {
|
||||
verticalImage: Image;
|
||||
horizontalImage: Image;
|
||||
squareImage: Image;
|
||||
}
|
||||
};
|
||||
|
||||
interface ChapterElement {
|
||||
type ChapterElement = {
|
||||
id: number;
|
||||
bookId: number;
|
||||
title: string;
|
||||
@@ -233,35 +233,35 @@ interface ChapterElement {
|
||||
price: number;
|
||||
views: number;
|
||||
isUserPaid?: boolean;
|
||||
}
|
||||
};
|
||||
|
||||
interface Country {
|
||||
type Country = {
|
||||
id: number;
|
||||
title: string;
|
||||
code: string;
|
||||
}
|
||||
};
|
||||
|
||||
interface Genre {
|
||||
type Genre = {
|
||||
id: number;
|
||||
title: string;
|
||||
slug: string;
|
||||
}
|
||||
};
|
||||
|
||||
interface Image {
|
||||
type Image = {
|
||||
id: number;
|
||||
alt: string;
|
||||
path: string;
|
||||
name: string;
|
||||
url: string;
|
||||
}
|
||||
};
|
||||
|
||||
interface Timer {
|
||||
type Timer = {
|
||||
value: null;
|
||||
for: null;
|
||||
message: string;
|
||||
}
|
||||
};
|
||||
|
||||
interface PagePropsChapter {
|
||||
type PagePropsChapter = {
|
||||
id: number;
|
||||
bookId: number;
|
||||
editorId: null;
|
||||
@@ -289,94 +289,94 @@ interface PagePropsChapter {
|
||||
nextChapter: null;
|
||||
previousChapter: PreviousChapter;
|
||||
corrections: null;
|
||||
}
|
||||
};
|
||||
|
||||
interface ChapterBook {
|
||||
type ChapterBook = {
|
||||
id: number;
|
||||
title: string;
|
||||
titleEn: string;
|
||||
url: string;
|
||||
}
|
||||
};
|
||||
|
||||
interface Content {
|
||||
type Content = {
|
||||
id: number;
|
||||
text: string;
|
||||
symbolsCount: number;
|
||||
}
|
||||
};
|
||||
|
||||
interface PreviousChapter {
|
||||
type PreviousChapter = {
|
||||
id: number;
|
||||
title: string;
|
||||
views: number;
|
||||
publishedAt: Date;
|
||||
url: string;
|
||||
numberChapter: string;
|
||||
}
|
||||
};
|
||||
|
||||
interface InitialReduxState {
|
||||
type InitialReduxState = {
|
||||
data?: Data;
|
||||
auth: Auth;
|
||||
banners?: Banners;
|
||||
corrections?: Corrections;
|
||||
readerSettings?: ReaderSettings;
|
||||
}
|
||||
};
|
||||
|
||||
interface Auth {
|
||||
type Auth = {
|
||||
isAuth: boolean;
|
||||
user: null;
|
||||
}
|
||||
};
|
||||
|
||||
interface Banners {
|
||||
type Banners = {
|
||||
displaySale: boolean;
|
||||
}
|
||||
};
|
||||
|
||||
interface Corrections {
|
||||
type Corrections = {
|
||||
items: null;
|
||||
data: null;
|
||||
}
|
||||
};
|
||||
|
||||
interface Data {
|
||||
type Data = {
|
||||
bookPage: BookPage | null;
|
||||
chapterPage: ChapterPage | null;
|
||||
}
|
||||
};
|
||||
|
||||
interface BookPage {
|
||||
type BookPage = {
|
||||
bookId: number;
|
||||
bookmark: null;
|
||||
}
|
||||
};
|
||||
|
||||
interface ChapterPage {
|
||||
type ChapterPage = {
|
||||
chapterId: number;
|
||||
bookId: number;
|
||||
bookmark: null;
|
||||
}
|
||||
};
|
||||
|
||||
interface ReaderSettings {
|
||||
type ReaderSettings = {
|
||||
fontSize: number;
|
||||
lineHeight: number;
|
||||
textIndent: number;
|
||||
sidebarHide: number;
|
||||
textAlign: string;
|
||||
}
|
||||
};
|
||||
|
||||
interface TotalData {
|
||||
type TotalData = {
|
||||
items: Item[];
|
||||
_links: Links;
|
||||
pagesData: PagesData;
|
||||
}
|
||||
};
|
||||
|
||||
interface Links {
|
||||
type Links = {
|
||||
self: First;
|
||||
first: First;
|
||||
last: First;
|
||||
next: First;
|
||||
}
|
||||
};
|
||||
|
||||
interface First {
|
||||
type First = {
|
||||
href: string;
|
||||
}
|
||||
};
|
||||
|
||||
interface Item {
|
||||
type Item = {
|
||||
id: number;
|
||||
title: string;
|
||||
description: string;
|
||||
@@ -390,16 +390,16 @@ interface Item {
|
||||
verticalImage: Image;
|
||||
horizontalImage: Image;
|
||||
squareImage: Image;
|
||||
}
|
||||
};
|
||||
|
||||
interface PagesData {
|
||||
type PagesData = {
|
||||
totalCount: number;
|
||||
pageCount: number;
|
||||
currentPage: number;
|
||||
perPage: number;
|
||||
}
|
||||
};
|
||||
|
||||
interface Query {
|
||||
type Query = {
|
||||
book?: string;
|
||||
chapter?: string;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user