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:
@@ -3,7 +3,6 @@ import { fetchApi } from '@libs/fetch';
|
||||
import { Plugin } from '@typings/plugin';
|
||||
import { defaultCover } from '@libs/defaultCover';
|
||||
import { FilterTypes, Filters } from '@libs/filterInputs';
|
||||
import { NovelItem } from '../../test_web/static/js';
|
||||
// const novelStatus = require('@libs/novelStatus');
|
||||
// const isUrlAbsolute = require('@libs/isAbsoluteUrl');
|
||||
// const parseDate = require('@libs/parseDate');
|
||||
@@ -52,13 +51,13 @@ class Syosetu implements Plugin.PluginBase {
|
||||
if (parseInt(loadedCheerio('.is-current').html() || '1') !== pagenumber)
|
||||
return [];
|
||||
|
||||
const novels: NovelItem[] = [];
|
||||
const novels: Plugin.NovelItem[] = [];
|
||||
loadedCheerio('.c-card').each((_, e) => {
|
||||
const anchor = loadedCheerio(e).find('.p-ranklist-item__title a');
|
||||
const url = anchor.attr('href');
|
||||
if (!url) return;
|
||||
const name = anchor.text();
|
||||
const novel: NovelItem = {
|
||||
const novel: Plugin.NovelItem = {
|
||||
path: url.replace(this.novelPrefix, ''),
|
||||
name,
|
||||
cover: defaultCover,
|
||||
@@ -93,12 +92,12 @@ class Syosetu implements Plugin.PluginBase {
|
||||
novel.summary = loadedCheerio('#novel_ex')
|
||||
.text()
|
||||
.replace(/<\s*br.*?>/g, '\n');
|
||||
cqGetChapters.each(() => {
|
||||
const chapterA = loadedCheerio(this).find('a');
|
||||
cqGetChapters.each((_, e) => {
|
||||
const chapterA = loadedCheerio(e).find('a');
|
||||
const [chapterName, releaseDate, chapterUrl] = [
|
||||
// set the variables
|
||||
chapterA.text(),
|
||||
loadedCheerio(this)
|
||||
loadedCheerio(e)
|
||||
.find('dt') // get title
|
||||
.text() // get text
|
||||
.replace(/(.)/g, '') // remove "(edited)" mark
|
||||
|
||||
Reference in New Issue
Block a user