mirror of
https://github.com/drawdb-io/drawdb.git
synced 2025-10-14 14:30:35 +00:00
34 lines
1.0 KiB
JavaScript
34 lines
1.0 KiB
JavaScript
import { BrowserRouter, Routes, Route, useLocation } from "react-router-dom";
|
|
import { useLayoutEffect } from "react";
|
|
import Editor from "./pages/Editor";
|
|
import BugReport from "./pages/BugReport";
|
|
import Templates from "./pages/Templates";
|
|
import LandingPage from "./pages/LandingPage";
|
|
import SettingsContextProvider from "./context/SettingsContext";
|
|
import NotFound from "./pages/NotFound";
|
|
|
|
export default function App() {
|
|
return (
|
|
<SettingsContextProvider>
|
|
<BrowserRouter>
|
|
<RestoreScroll />
|
|
<Routes>
|
|
<Route path="/" element={<LandingPage />} />
|
|
<Route path="/editor" element={<Editor />} />
|
|
<Route path="/bug-report" element={<BugReport />} />
|
|
<Route path="/templates" element={<Templates />} />
|
|
<Route path="*" element={<NotFound />} />
|
|
</Routes>
|
|
</BrowserRouter>
|
|
</SettingsContextProvider>
|
|
);
|
|
}
|
|
|
|
function RestoreScroll() {
|
|
const location = useLocation();
|
|
useLayoutEffect(() => {
|
|
window.scroll(0, 0);
|
|
}, [location.pathname]);
|
|
return null;
|
|
}
|