Feat: Vite + React (#991)

* remove test_web

* integrate reactjs-vite

* update lint-staged

* simple cors proxy server which handles cookies and redirections

* overrider global fetch with proxy call

* simple examples for set cookies and fetch request

* app bar

* add redux

* loadPlugins.
error: cant load urlencode module

* add ts-node for transforming

* plugin search & select

* plugin slice

* accordion components

* path item & popular novel

* optional for filters

* search novel

* parse novel

* parseChapter

* update cookies

* default filters

* fix: import path

* bundler module resolution

* new json_plugins

* fix: generate multisrc (missing filters)

* fix: host scripts

* fix: plugin code path

* remove typechecking action
This commit is contained in:
nyagami
2024-06-16 18:13:41 +07:00
committed by GitHub
parent a4cb781f32
commit d36e8ec85f
333 changed files with 5857 additions and 28579 deletions
+15
View File
@@ -0,0 +1,15 @@
import { useEffect, useState } from 'react';
export default function useDebounce(text: string, delay: number) {
const [value, setValue] = useState('');
useEffect(() => {
const timerId = setTimeout(() => {
setValue(text);
}, delay);
return () => {
clearTimeout(timerId);
};
}, [text, delay]);
return value;
}
+18
View File
@@ -0,0 +1,18 @@
import { AppState } from '@redux/store';
import { useEffect, useState } from 'react';
import { useSelector } from 'react-redux';
import { Plugin } from '@typings/plugin';
import { getPlugin } from '@provider/plugins';
export default function usePlugin() {
const selectedPluginItem = useSelector(
(state: AppState) => state.plugin.selected,
);
const [plugin, setPlugin] = useState<Plugin.PluginBase | undefined>();
useEffect(() => {
if (selectedPluginItem) {
setPlugin(getPlugin(selectedPluginItem.id));
}
}, [selectedPluginItem]);
return plugin;
}