migrate frontend

This commit is contained in:
LeeShuang
2021-12-08 23:43:52 +08:00
parent 2f72bfa946
commit 06bffd0ba5
145 changed files with 11409 additions and 0 deletions

30
web/src/App.tsx Normal file
View File

@ -0,0 +1,30 @@
import { useContext, useEffect } from "react";
import appContext from "./stores/appContext";
import { appRouterSwitch } from "./routers";
import { globalStateService } from "./services";
import "./less/app.less";
import 'prismjs/themes/prism.css';
function App() {
const {
locationState: { pathname },
} = useContext(appContext);
useEffect(() => {
const handleWindowResize = () => {
globalStateService.setIsMobileView(document.body.clientWidth <= 875);
};
handleWindowResize();
window.addEventListener("resize", handleWindowResize);
return () => {
window.removeEventListener("resize", handleWindowResize);
};
}, []);
return <>{appRouterSwitch(pathname)}</>;
}
export default App;