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:
Marcin Majewski
2024-08-18 17:31:41 +02:00
committed by GitHub
parent eb5522b066
commit b2caf26da3
73 changed files with 1914 additions and 916 deletions
+28 -28
View File
@@ -111,10 +111,10 @@ class SkyNovels implements Plugin.PluginBase {
export default new SkyNovels();
interface response {
type response = {
novels?: NovelsEntity[] | null;
}
interface NovelsEntity {
};
type NovelsEntity = {
id: number;
nvl_author?: number | null;
nvl_content: string;
@@ -135,16 +135,16 @@ interface NovelsEntity {
nvl_rating?: number | null;
nvl_ratings_count: number;
genres?: GenresEntity[] | null;
}
interface GenresEntity {
};
type GenresEntity = {
id: number;
genre_name: string;
}
};
interface responseBook {
type responseBook = {
novel?: NovelEntity[] | null;
}
interface NovelEntity {
};
type NovelEntity = {
id: number;
nvl_author: number;
nvl_content: string;
@@ -168,29 +168,29 @@ interface NovelEntity {
novel_ratings?: NovelRatingsEntity[] | null;
collaborators?: CollaboratorsEntity[] | null;
genres?: GenresEntity[] | null;
}
interface BookmarksEntity {
};
type BookmarksEntity = {
id: number;
user_id: number;
chp_id: number;
chp_name: string;
}
interface VolumesEntity {
};
type VolumesEntity = {
vlm_title: string;
id: number;
nvl_id: number;
user_id?: number | null;
chapters?: ChaptersEntity[] | null;
}
interface ChaptersEntity {
};
type ChaptersEntity = {
id: number;
chp_index_title: string;
chp_name: string;
chp_number: number;
chp_status: string;
createdAt: string;
}
interface NovelRatingsEntity {
};
type NovelRatingsEntity = {
user_id: number;
rate_value: number;
rate_comment: string;
@@ -201,21 +201,21 @@ interface NovelRatingsEntity {
user_login: string;
image?: string | null;
likes?: (LikesEntity | null)[] | null;
}
interface LikesEntity {
};
type LikesEntity = {
id: number;
user_id: number;
user_login: string;
}
interface CollaboratorsEntity {
};
type CollaboratorsEntity = {
user_id: number;
user_login: string;
}
};
interface responseChapter {
type responseChapter = {
chapter?: ChapterEntity[] | null;
}
interface ChapterEntity {
};
type ChapterEntity = {
id: number;
chp_author: number;
chp_translator?: null;
@@ -237,9 +237,9 @@ interface ChapterEntity {
comments?: null[] | null;
reactions?: null[] | null;
total_reactions?: TotalReactionsEntity[] | null;
}
interface TotalReactionsEntity {
};
type TotalReactionsEntity = {
reaction_id: number;
reaction_name: string;
reaction_count: number;
}
};