drawDB/src/App.jsx

44 lines
1.2 KiB
React
Raw Normal View History

2024-02-26 19:17:20 +08:00
import { BrowserRouter, Routes, Route, useLocation } from "react-router-dom";
import Editor from "./pages/Editor";
import Survey from "./pages/Survey";
import BugReport from "./pages/BugReport";
2024-01-07 11:10:34 +08:00
import Shortcuts from "./pages/Shortcuts";
2023-11-30 15:18:41 +08:00
import Templates from "./pages/Templates";
2024-02-26 19:17:20 +08:00
import { useEffect } from "react";
import LandingPage from "./pages/LandingPage";
2024-03-10 01:42:09 +08:00
import LayoutContextProvider from "./context/LayoutContext";
2024-02-26 19:17:20 +08:00
const Wrapper = ({ children }) => {
const location = useLocation();
useEffect(() => {
window.scroll(0, 0);
}, [location.pathname]);
return children;
};
2023-09-19 20:46:33 +08:00
function App() {
return (
2024-02-26 19:17:20 +08:00
<BrowserRouter>
<Wrapper>
2024-01-07 11:10:34 +08:00
<Routes>
2024-02-26 19:17:20 +08:00
<Route path="/" element={<LandingPage />} />
2024-03-10 01:42:09 +08:00
<Route
path="/editor"
element={
<LayoutContextProvider>
<Editor />
</LayoutContextProvider>
}
/>
2024-01-07 11:10:34 +08:00
<Route path="/survey" element={<Survey />} />
<Route path="/shortcuts" element={<Shortcuts />} />
<Route path="/bug_report" element={<BugReport />} />
<Route path="/templates" element={<Templates />} />
</Routes>
2024-02-26 19:17:20 +08:00
</Wrapper>
</BrowserRouter>
2023-09-19 20:46:33 +08:00
);
}
export default App;